Hello community, here is the log from the commit of package freetype2 for openSUSE:Factory checked in at 2017-01-19 10:32:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/freetype2 (Old) and /work/SRC/openSUSE:Factory/.freetype2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "freetype2" Changes: -------- --- /work/SRC/openSUSE:Factory/freetype2/freetype2.changes 2016-10-10 16:18:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.freetype2.new/freetype2.changes 2017-01-19 10:32:58.529114971 +0100 @@ -1,0 +2,46 @@ +Sun Jan 1 11:58:27 UTC 2017 - [email protected] + +- Update to version 2.7.1: + * IMPORTANT CHANGES + + Support for the new CFF2 font format as introduced with + OpenType 1.8 has been contributed by Dave Arnolds from Adobe. + + Preliminary support for variation fonts as specified in + OpenType 1.8 (in addition to the already existing support for + Adobe's MM and Apple's GX formats). Dave Arnolds contributed + handling of advance width change variation; more will come in + the next version. + * IMPORTANT BUG FIXES + + Handling of raw CID fonts was partially broken (bug introduced + in 2.6.4). + * MISCELLANEOUS + + Some limits for TrueType bytecode execution have been tightened + to speed up FreeType's handling of malformed fonts, in + particular to quickly abort endless loops. + + The number of twilight points can no longer be set to an + arbitrarily large value. + + The total number of jump opcode instructions (like JMPR) with + negative arguments is dynamically restricted; the same holds + for the total number of iterations in LOOPCALL opcodes. + + The dynamic limits are based on the number of points in a glyph + and the number of CVT entries. Please report if you encounter a + font where the selected values are not adequate. + + PCF family names are made more `colourful'; they now include the + foundry and information whether they contain wide characters. + For example, you no longer get `Fixed' but rather `Sony Fixed' + or `Misc Fixed Wide'. + + A new function `FT_Get_Var_Blend_Coordinates' (with its alias + name `FT_Get_MM_Blend_Coordinates') to retrieve the normalized + blend coordinates of the currently selected variation instance + has been added to the Multiple Masters interface. + + A new function `FT_Get_Var_Design_Coordinates' to retrieve the + design coordinates of the currently selected variation instance + has been added to the Multiple Masters interface. + + A new load flag `FT_LOAD_BITMAP_METRICS_ONLY' to retrieve bitmap + information without loading the (embedded) bitmap itself. + + Retrieving advance widths from bitmap strikes (using + `FT_Get_Advance' and `FT_Get_Advances') have been sped up. + + The usual round of fuzzer fixes to better reject malformed + fonts. +- Drop freetype2-bitmap-foundry.patch, merged upstream. + +------------------------------------------------------------------- @@ -15 +61 @@ - - A new option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' has been + + A new option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' has been --- /work/SRC/openSUSE:Factory/freetype2/ft2demos.changes 2016-10-10 16:18:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.freetype2.new/ft2demos.changes 2017-01-19 10:32:58.597105382 +0100 @@ -1,0 +2,16 @@ +Sun Jan 1 12:04:31 UTC 2017 - [email protected] + +- Update to version 2.7.1 + + The `ftmulti' demo program can now switch engines with key `H'. + + The `ftstring' demo program can now show some built-in, + non-latin sample strings (to be selected with the TAB key). + + The `ftview' demo program can now switch between a font's + charmaps using the TAB key. +- Remove ftinspect-library.patch, merged upstream. + +------------------------------------------------------------------- +Tue Sep 20 11:58:32 UTC 2016 - [email protected] + +- Also build ftinspect + +------------------------------------------------------------------- Old: ---- freetype-2.7.tar.bz2 freetype-doc-2.7.tar.bz2 freetype2-bitmap-foundry.patch ft2demos-2.7.tar.bz2 New: ---- freetype-2.7.1.tar.bz2 freetype-doc-2.7.1.tar.bz2 ft2demos-2.7.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ freetype2.spec ++++++ --- /var/tmp/diff_new_pack.XGLaGC/_old 2017-01-19 10:32:59.472981849 +0100 +++ /var/tmp/diff_new_pack.XGLaGC/_new 2017-01-19 10:32:59.472981849 +0100 @@ -1,7 +1,7 @@ # # spec file for package freetype2 # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,9 +17,9 @@ # -%define doc_version 2.7 +%define doc_version 2.7.1 Name: freetype2 -Version: 2.7 +Version: 2.7.1 Release: 0 Summary: A TrueType Font Library License: SUSE-Freetype or GPL-2.0+ @@ -28,7 +28,6 @@ Source0: http://download.savannah.gnu.org/releases/freetype/freetype-%{version}.tar.bz2 Source1: http://download.savannah.gnu.org/releases/freetype/freetype-doc-%{doc_version}.tar.bz2 Source3: baselibs.conf -Patch1: freetype2-bitmap-foundry.patch # PATCH-FIX-OPENSUSE don-t-mark-libpng-as-required-library.patch -- it is private in .pc Patch202: don-t-mark-libpng-as-required-library.patch Patch308961: bugzilla-308961-cmex-workaround.patch @@ -81,7 +80,6 @@ %prep %setup -q -n freetype-%{version} -a 1 -%patch1 -p1 %patch308961 -p 1 %patch202 -p1 ++++++ ft2demos.spec ++++++ --- /var/tmp/diff_new_pack.XGLaGC/_old 2017-01-19 10:32:59.496978465 +0100 +++ /var/tmp/diff_new_pack.XGLaGC/_new 2017-01-19 10:32:59.500977901 +0100 @@ -1,7 +1,7 @@ # # spec file for package ft2demos # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,9 +16,9 @@ # -%define freetype_version 2.7 +%define freetype_version 2.7.1 Name: ft2demos -Version: 2.7 +Version: 2.7.1 Release: 0 Summary: Freetype2 Utilities and Demo Programs License: GPL-2.0+ @@ -38,6 +38,9 @@ Patch308961: bugzilla-308961-cmex-workaround.patch BuildRequires: libpng-devel BuildRequires: xorg-x11-devel +BuildRequires: pkgconfig(Qt5Gui) +BuildRequires: pkgconfig(Qt5Widgets) +BuildRequires: pkgconfig(harfbuzz) Supplements: fonts-config Conflicts: dtc < 1.4.0 # silence our clamav check @@ -58,18 +61,26 @@ %build export CFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE $(getconf LFS_CFLAGS)" -%configure --without-bzip2 +%configure \ + --enable-static \ + --without-bzip2 + make %{?_smp_mflags} pushd .. ln -s freetype-%{freetype_version} freetype2 cd ft2demos-%{version} make %{?_smp_mflags} + + cd src + qmake-qt5 ftinspect.pro + make popd %install mkdir -p %{buildroot}%{_bindir} pushd ../ft2demos-%{version}/bin/.libs install -m 755 ft* %{buildroot}%{_bindir} + install -m 755 ../../src/ftinspect %{buildroot}%{_bindir} popd %check ++++++ freetype-2.7.tar.bz2 -> freetype-2.7.1.tar.bz2 ++++++ ++++ 21857 lines of diff (skipped) ++++++ freetype-doc-2.7.tar.bz2 -> freetype-doc-2.7.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/freetype-2.7/README.freetype-doc new/freetype-2.7.1/README.freetype-doc --- old/freetype-2.7/README.freetype-doc 2016-09-08 11:06:55.000000000 +0200 +++ new/freetype-2.7.1/README.freetype-doc 2016-12-30 21:46:10.000000000 +0100 @@ -7,10 +7,10 @@ mkdir src cd src - tar xzvf freetype-2.7.tar.gz - tar xzvf freetype-doc-2.7.tar.gz + tar xzvf freetype-2.7.1.tar.gz + tar xzvf freetype-doc-2.7.1.tar.gz -Now you can move the `docs' subdirectory of `freetype-2.7' to any place +Now you can move the `docs' subdirectory of `freetype-2.7.1' to any place you want. The entry point for the documentation is diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/freetype-2.7/docs/documentation.html new/freetype-2.7.1/docs/documentation.html --- old/freetype-2.7/docs/documentation.html 2016-09-08 11:06:55.000000000 +0200 +++ new/freetype-2.7.1/docs/documentation.html 2016-12-30 21:46:10.000000000 +0100 @@ -95,6 +95,11 @@ rendering. Useful for better understanding the ‘big picture’.</p> + <h3><a href="subpixel-hinting.html">The v40 TrueType + interpreter mode</a></h3> + <p>This documents the new default hinting mode introduced + with FreeType version 2.7.</p> + <h3><a href="rasterinfo/rasterinfo.html">The RasterInfo Font</a></h3> </div> @@ -103,7 +108,7 @@ <!-- ************************************************** --> <div class="updated"> - <p>Last update: 11-Feb-2016</p> + <p>Last update: 8-Sep-2016</p> </div> </div> </div> Binary files old/freetype-2.7/docs/image/freetype-27-consolas-v35-v40.png and new/freetype-2.7.1/docs/image/freetype-27-consolas-v35-v40.png differ Binary files old/freetype-2.7/docs/image/freetype-27-hinting-comparison.png and new/freetype-2.7.1/docs/image/freetype-27-hinting-comparison.png differ Binary files old/freetype-2.7/docs/image/freetype-27-v35-v40-different-hinting.png and new/freetype-2.7.1/docs/image/freetype-27-v35-v40-different-hinting.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/freetype-2.7/docs/subpixel-hinting.html new/freetype-2.7.1/docs/subpixel-hinting.html --- old/freetype-2.7/docs/subpixel-hinting.html 1970-01-01 01:00:00.000000000 +0100 +++ new/freetype-2.7.1/docs/subpixel-hinting.html 2016-12-30 21:46:10.000000000 +0100 @@ -0,0 +1,310 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> + +<html lang="en"> + +<head> + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8"> + <meta http-equiv="Content-Style-Type" + content="text/css"> + <meta http-equiv="Content-Script-Type" + content="text/javascript"> + <meta name="description" + content="FreeType Documentation"> + + <link rel="icon" + href="image/favicon_-90.ico"> + <link rel="shortcut icon" + href="image/favicon_-90.ico"> + <link rel="stylesheet" + type="text/css" + href="css/freetype2_-90.css"> + + <script type="text/javascript" + src="../../js/jquery-1.11.0.min.js"> + </script> + <script type="text/javascript" + src="../../js/jquery.ba-resize.min.js"> + </script> + <script type="text/javascript" + src="../../js/freetype2.js"> + </script> + + <title>The new v40 TrueType interpreter mode</title> +</head> + + +<body> + +<div id="top" + class="bar"> + <h1><a href="http://freetype.org/index.html">FreeType</a> Subpixel Hinting</h1> +</div> + + +<div id="wrapper"> + +<div class="colmask leftmenu"> + <div class="colright"> + <div class="col1wrap"> + <div class="col1"> + + <!-- ************************************************** --> + + <div id="subpixel-hinting"> + <h2>The new v40 TrueType interpreter mode</h2> + <div class="date">2016-09-08, contributed by Nikolaus + Waxweiler</div> + + <p>FreeType 2.7 ships the new v40 TrueType instructions + interpreter version enabled by default. It finally brings + DirectWrite/ClearType-like rendering to the screen, or + ‘subpixel hinting’ as some FreeType code calls + it. Actually, there is no subpixel hinting. Read on.</p> + + <p><img src="image/freetype-27-hinting-comparison.png" + alt="Demonstration and comparison of the various + hinting modes."></p> + + <p>For the past years, the previous v35 interpreter did as + the TrueType specification from the 90s said. The + TrueType hinting machinery was originally conceived to + make vector outlines render well as black-and-white + bitmaps on the coarse-pixeled CRTs of back in the days. + Look at screenshots of Windows 95 and you'll see pixely, + bitmappy text. In reality, the single glyphs are scalable + vector outlines beaten into the pixel grid by small + programs run on them inside the font before being handed + off to the rasterizer. Read: glyphs were designed to be + reprogrammed on the fly, per size, for sharper on-screen + display. Microsoft invested significant manpower into + what is commonly called the core web fonts (Arial, Times + New Roman, Courier New, etc.) to beat and re-beat each and + every glyph to a full pixel grid at all commonly used + sizes. If this sounds like a lot of sisyphean work, + that's because it is. To this day, only few font families + have had the same amount of work put into them.</p> + + <p>Times changed, LCDs came along and Microsoft rediscovered + subpixel rendering that exploits the physical structure of + LCD subpixels, usually RGB stripes, to increase the + horizontal resolution approximately three times (not quite + actually since you need to apply a blurrying filter to + lessen color fringes). More resolution meant that less + work had to be put into a font and instead of snapping + things to full pixels, they could now be snapped to one of + those three subpixels or a fraction of that for a much + finer appearance (‘subpixel hinting’) while + still appearing sharper than with plain old grayscale + antialiasing. Since fonts are explicitly programmed in + the TrueType model, they now had a lot of older fonts that + would need to be updated to take advantage of the new + possibilities or to even render correctly. Knowing this + would never happen, they implemented supersampling and a + compatibility mode that contained several interpreter rigs + and preventive measures for dirty hacks used in older + fonts to achieve pixel perfection. Older fonts that were + snapping things to full pixels all around could now at + least benefit a little from the increased horizontal + resolution. Beat Stamm describes this work in detail + <a href="http://www.beatstamm.com/typography/RTRCh4.htm#Sec1">on + his site</a>. Microsoft later released the ClearType + collection fonts (Calibri, Cambria, Consolas, etc.) to + demonstrate the new possibilities that just so happened + to rely on this compatibility mode to render correctly. + Many new fonts did and still do.</p> + + <p>FreeType didn't implement a similar compatibility mode. + This had two side effects.</p> + + <ol> + <li> + <p>It lead to glitches when rendering fonts that assumed + a compatibility mode with supersampler and interpreter + rigs is present, i.e., most modern fonts.</p> + + <p><img src="image/freetype-27-consolas-v35-v40.png" + alt="Hinting comparison of the Consolas font."></p> + + <p>The same can happen on Windows if you disable + ClearType in the system settings and look at random + web pages with custom fonts.</p> + </li> + + <li> + <p>Different fonts in a browser could look jarringly + different next to each other. Older fonts like the + core web fonts snap things to full hard pixels on both + axes, newer fonts and especially web fonts often use a + hinting strategy that snaps glyphs to the pixel grid + mainly or only vertically and with varying + strength.</p> + + <p><img src="image/freetype-27-v35-v40-different-hinting.png" + alt="Hinting comparison between Georgia and NotoSerif."></p> + + <p>Snapping things to the grid on one axis instead of + two greatly reduces the complexity and cost of + hinting, looks smoother and comes with important + spacing benefits for horizontal (Latin!) text. And + it's just as readable.</p> + </li> + </ol> + + <p>For some time already, FreeType shipped with a v38 + interpreter, also known as ‘Infinality’. Its + developer set out to make fonts render better than on + Windows and give users the ability to configure font + rendering to their liking. Out of the box, it made fonts + look like they were rendered through ClearType instead of + on Windows 95. It was disabled by default because it was + painfully slow and the original developer lost interest in + developing the code further. You'll find it used in + several distribution repositories maintained by community + members.</p> + + <p>My work on stem darkening (incompatible with explicit + horizontal hinting, i.e., TrueType) and frustration that + v35 was still the default (I prefer what + DirectWrite/ClearType puts on the screen) led me to strip + the v38 Infinality code to the bare minimum and remove all + configurability in the name of speed and simplicity. The + result is called v40 and it's just as fast as v35. v38 is + still there and usable, it just isn't compiled in by + default. If you compile it in, you can switch between the + different interpreters at runtime, using an environment + variable (or using the property API of FreeType). There + is currently no way to switch this from FontConfig or any + other means. Packagers of ‘Infinality’ + packages will probably jump in and update the packages + accordingly.</p> + + <p>Here is the core secret to making fonts render like + through DirectWrite/ClearType on Windows: There actually + is no subpixel hinting going on here. Shock. The code + simply ignores <em>all</em> horizontal hinting + instructions. That's less work than supersampling and + gets us almost identical results <em>and</em> additionally + prevents changes to the advance width of glyphs. This + greatly harmonizes the look of older and newer TrueType + fonts and incidentally solves glyph spacing problems of + less well instructed fonts. Switching to the new mode + might take some getting used to though, so if you think + your fonts are suddenly fat, fuzzy or weird, give your + brain some time to adjust.</p> + + <p>No upside without a downside, though. What made v38 so + slow was its attempt to implement the hacks Microsoft + describes in + a <a href="https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx">whitepaper</a> + for their interpreter and rasterizer <em>and</em> a + configuration layer on top of that so fonts could be + specially handled down to single glyphs. Given the bugs + in and dirty hacks used by Arial and co., this was + necessary to make them render better than on Windows. In + my opinion, this is solid over-engineering in times where + the web is full of good-quality typefaces that display + well without horizontal hinting or don't even have it.</p> + + <p>The v40 code does not use any whitelist or other means to + handle certain fonts differently. It focuses on ignoring + horizontal hinting and preventing the dirtiest hacks that + dent more than they help. Modern fonts like Calibri, + Cambria, Consolas, etc., render well with this approach, + older fonts like Arial, Times New Roman, Georgia and + Verdana display mostly fine with smaller details off. And + that's okay. Basically, the harder a font tries to create + pixel-perfect black and white bitmaps for old CRT + monitors, the worse the results in the new mode. If + someone finds ways to make older fonts render better + without introducing lists or overly complex hacks, I'm + interested.</p> + + <p>PS: I recommend using the Liberation family of fonts + (version 2 and up, important!) instead of Arial, + Times New Roman, and Courier. The family harmonizes much + better internally and is equipped with much better + ClearType-ready hinting. Fedora still ships some 1.x + version; you can get the newer 2.x with improved hinting + and glyph coverage from + <a href="https://fedorahosted.org/liberation-fonts">here</a>.</p> + </div> + + <!-- ************************************************** --> + + <div class="updated"> + <p>Last update: 8-Sep-2016</p> + </div> + </div> + </div> + + + <!-- ************************************************** --> + + <div class="col2"> + </div> + </div> +</div> + + +<!-- ************************************************** --> + +<div id="TOC"> + <ul> + <li class="funding"> + <p><a href="https://pledgie.com/campaigns/24434"> + <img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!" + src="https://pledgie.com/campaigns/24434.png?skin_name=chrome" + border="0" + align="middle"> + </a></p> + + <p><a href="https://flattr.com/thing/421342/lemzwerg-on-Flattr" + target="_blank"> + <img class="with-border" + src="http://api.flattr.com/button/flattr-badge-large.png" + alt="Flattr this" + title="Flattr this" + border="0" + align="middle"> + </a></p> + </li> + <li class="primary"> + <a href="http://freetype.org/index.html">Home</a> + </li> + <li class="primary"> + <a href="http://freetype.org/index.html#news">News</a> + </li> + <li class="primary"> + <a href="index.html">Overview</a> + </li> + <li class="primary"> + <a href="documentation.html">Documentation</a> + </li> + <li class="primary"> + <a href="http://freetype.org/developer.html">Development</a> + </li> + <li class="primary"> + <a href="http://freetype.org/contact.html" + class="emphasis">Contact</a> + </li> + + <li> + <!-- separate primary from secondary entries --> + </li> + + <li class="secondary"> + <a href="#subpixel-hinting" class="current">The v40 Hinting + Mode</a> + </li> + </ul> +</div> + +</div> <!-- id="wrapper" --> + +<div id="TOC-bottom"> +</div> + +</body> +</html> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/freetype-2.7/docs/text-rendering-general.html new/freetype-2.7.1/docs/text-rendering-general.html --- old/freetype-2.7/docs/text-rendering-general.html 1970-01-01 01:00:00.000000000 +0100 +++ new/freetype-2.7.1/docs/text-rendering-general.html 2016-12-30 21:46:10.000000000 +0100 @@ -0,0 +1,504 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> + +<html lang="en"> + +<head> + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8"> + <meta http-equiv="Content-Style-Type" + content="text/css"> + <meta http-equiv="Content-Script-Type" + content="text/javascript"> + <meta name="description" + content="FreeType Documentation"> + + <link rel="icon" + href="image/favicon_-90.ico"> + <link rel="shortcut icon" + href="image/favicon_-90.ico"> + <link rel="stylesheet" + type="text/css" + href="css/freetype2_-90.css"> + + <script type="text/javascript" + src="../../js/jquery-1.11.0.min.js"> + </script> + <script type="text/javascript" + src="../../js/jquery.ba-resize.min.js"> + </script> + <script type="text/javascript" + src="../../js/freetype2.js"> + </script> + + <title>On slight hinting, proper text rendering, stem darkening and + LCD filters</title> +</head> + + +<body> + +<div id="top" + class="bar"> + <h1><a href="http://freetype.org/index.html">FreeType</a> LCD Support</h1> +</div> + + +<div id="wrapper"> + +<div class="colmask leftmenu"> + <div class="colright"> + <div class="col1wrap"> + <div class="col1"> + + <!-- ************************************************** --> + + <div id="slight-hinting"> + <h2>On Slight Hinting, Proper Text Rendering, Stem Darkening + and LCD Filters</h2> + <div class="date">2015-11-30, contributed by Nikolaus + Waxweiler (with corrections from Graham Asher), updated + 2015-12-08</div> + + <p><em>This article was originally written for the 2.6.2 + release of FreeType and explains the technical + background of several features. The information was + deemed useful enough to be added to the documentation + and has therefore been retitled.</em></p> + + <p>FreeType 2.6.2 ships with three interesting details for + users and developers of rendering libraries that deal with + text.</p> + + <ul> + <li> + <a href="#slight-hinting-invokes-the-native-hinter-if-possible">(S)light + hinting invokes the native hinter if possible</a> + </li> + <li> + <a href="#experimental-stem-darkening-for-the-auto-hinter">Experimental: + Stem darkening for the auto-hinter</a> + <ul> + <li><a href="#background">Background</a></li> + <li><a href="#back-to-stem-darkening">Back to stem + darkening</a></li> + </ul> + </li> + <li> + <a href="#disabled-stem-darkening-for-the-autohinter-and-adobes-cff-otf-engine">Disabled + stem darkening for the autohinter and Adobe’s CFF + (<code>.otf</code>) engine</a> + </li> + <li><a href="#the-default-lcd-filter-for-subpixel-rendering-has-been-changed">The + default LCD filter for subpixel rendering has been + changed</a> + </li> + </ul> + + <h3 id="slight-hinting-invokes-the-native-hinter-if-possible">(S)light + hinting invokes the native hinter if possible</h3> + + <p>In the past, setting ‘slight’ hinting via FontConfig or + configuration GUIs meant that native hints within a font + were ignored; FreeType’s auto-hinter would analyze the + font on the fly and automatically do what the font + designer would have to do at least semi-manually. + Technically, the auto-hinter set to (s)light snaps glyphs + to the pixel grid only vertically, just like Adobe’s + proprietary font engine and in a certain way also + Microsoft’s ClearType/DirectWrite. The result is a + compromise between design fidelity and sharpness that + preserves inter-glyph spacing, something very important + for horizontal text such as what you are reading right + now. The sharpness has usually been enhanced with + ‘subpixel rendering’ (ClearType on Windows), exploiting + the physical properties of modern but low-resolution LCD + panels.</p> + + <p>This worked out well so far, Ubuntu has been using this + setting for every font for years now. Werner Lemberg is + adding support for more and more scripts and has also spun + off the code + into <a href="http://www.freetype.org/ttfautohint/">ttfautohint</a>, + to help font designers ease the pain of manual + hinting.</p> + + <p>This also meant that the native hinting machinery of the + font drivers went unused. Historically, this decision was + sound because the native hinting mechanics for Postscript + (<code>.pfa</code>, <code>.pfb</code>), TrueType + (<code>.ttf</code>) and OpenType/CFF (<code>.otf</code>) + were subpar for the longest time. The PostScript hinter + still is, but with Adobe’s high-quality OpenType/CFF + engine contributed to FreeType and recent advances of the + TrueType driver towards full ClearType support, things + have changed.</p> + + <p>Setting ‘slight’ hinting usually leads + to <code>FT_LOAD_TARGET_LIGHT</code>. This mode implied + the auto-hinter before and has now been changed to mean + “Use native vertical-grid-only-snapping if driver and font + supports it and vertical-grid-only auto-hinter otherwise”. + Right now, only the OpenType/CFF driver is supported. In + the future, this will hopefully include the TrueType + engine once full support for ClearType arrives. + Technically, ClearType fonts can and will snap to the + vertical <em>and</em> the horizontal + grid <a href="http://www.beatstamm.com/typography/RTRCh4.htm#Sec12">depending + on several details</a>, but the net result is going in the + direction we want.</p> + + <p>This decision was driven by my personal whim; I wanted + native vertical grid-fitting if the font driver and font + supports it, and the auto-hinter otherwise. I assume that + native hints are made more carefully and take the + (auto-hinting) guesswork out of the process. Instead of + introducing per-format configuration in FontConfig and + fighting <a href="http://www.gtk.org/">GTK</a>/<a href="https://www.gnome.org/">GNOME</a> + that only support a single global hinting setting, it was + found to make more sense to change the definition of light + hinting in FreeType.</p> + + <p>I also hope this change will make it easier for the + non-Windows-and-Apple ecosystem to switch over to slight + hinting as the default. Current full/medium native + hinting, as is the default, tends to bring out the worst + in many, many fonts that haven’t seen the same insane + dedication to on-screen display and hinting as many + popular Microsoft fonts, for example. And since ClearType + is still not fully supported, you usually get a very poor + default experience. Slight hinting gives a much better + one, as Ubuntu has proven over the years.</p> + + + <h3 id="experimental-stem-darkening-for-the-auto-hinter">Experimental: + Stem darkening for the auto-hinter</h3> + + <p><a href="image/freetype-262-autohinter-stem-darkening-demo1.png"> + <img src="image/freetype-262-autohinter-stem-darkening-demo1-thumbnail.png" + alt="Demonstration and comparison of the + emboldening autohinter."></a></p> + + <p>Stem darkening emboldens glyphs at smaller sizes to make + them more readable on common low-DPI screens. If this + sounds familiar to you, that’s because Adobe’s CFF engine + has been doing it since it was contributed in 2013. You + might have noticed that OpenType/CFF fonts (commonly + suffixed <code>.otf</code>) like GNOME 3’s default UI + font <a href="https://en.wikipedia.org/wiki/Cantarell_%28typeface%29">Cantarell</a> + appear bolder and fuzzier than other fonts, at least until + this release. The auto-hinter can do the exact same thing + now, it is just disabled by default.</p> + + <p>But why would you do this if small glyphs are already + fairly readable? It turns out that font rendering in the + Linux ecosystem has been wrong since scalable fonts were + introduced to it. Text must be rendered with linear alpha + blending and gamma correction, which no toolkit or + rendering library does by default on + <a href="http://www.x.org/">X11</a>, even + though <a href="http://www.qt.io/">Qt5</a> + and <a href="https://skia.org/">Skia</a> (as used by + Google Chrome and other browsers) can do it.</p> + + + <h4 id="background">Background</h4> + + <p>First, to understand why they are required, you must know + that when FreeType outputs a grayscale glyph image, it + really outputs a coverage bitmap. If a pixel is + completely covered by a filled-in outline, the pixel is + made 100% black (0% brightness, which is simply black). + If a pixel is only 50% covered, the pixel is made 50% + black (50% brightness or a middle shade of gray) and 0% + covered means 0% black (100% brightness or white). On + high-DPI screens like on smartphones and tablets, the + pixels are so small that the chance of being completely + covered and therefore completely black is fairly good. On + low-DPI screens most of us are sadly stuck with, the + situation is different. The pixels are too large for most + of the details of a glyph and shades of gray are the norm + rather than the exception.</p> + + <p>This is relevant because all our screens have a second + problem: they are not linear. 1 + 1 is + not 2. Twice the value does not result in twice the + brightness. When a pixel is only 50% covered, the + coverage map says 50% black, and this translates to a + pixel value of 128 when you use 8 bits per + channel (0-255). However, this does not translate to 50% + brightness for that pixel on our sRGB and gamma 2.2 + screens. Due to their non-linearity, they dwell longer in + the darks and only a pixel value of about 186 results + in 50% brightness – 128 ends up too dark on both + bright and dark backgrounds. The net result is that dark + text looks burnt-out, pixely and blotchy on bright + background, bright text too frail on dark backgrounds, and + colored text on colored background (for example, red on + green) seems to have dark halos or ‘dirt’ around it. The + situation is especially ugly for diagonal stems like in + glyph ‘w’, where the quality of FreeType’s anti-aliasing + depends on the correct display of grays. On high-DPI + screens where smaller, fully black pixels reign supreme, + this doesn’t matter, but on our low-DPI screens with all + the gray shades, it does. 0% and 100% brightness are the + same things in linear and non-linear space, just all the + shades in-between are not.</p> + + <p>The correct way of rendering a glyph image on a surface + is + to <a href="https://en.wikipedia.org/wiki/Alpha_compositing">alpha + blend</a> it onto the surface in linear space and then + apply <a href="https://en.wikipedia.org/wiki/Gamma_correction">gamma + correction</a> to translate the linear coverage map to + something that is correct for our screens.<sup>1</sup> No + toolkit in the Linux ecosystem does it by default, even + though Qt5 and Skia can and will do it on other platforms. + Windows and Mac OS X do it natively. This procedure + is especially important if glyphs should be + subpixel-rendered (ClearType and Mac + OS X) <a href="http://lists.nongnu.org/archive/html/freetype-devel/2015-11/msg00020.html">with + as few color fringes as possible</a>.</p> + + <p><sup>1</sup> This process can cost performance. There is + an approximation that does not need to know about the + background color. + See <a href="https://bel.fi/alankila/lcd/">https://bel.fi/alankila/lcd/</a> + and <a href="https://bel.fi/alankila/lcd/alpcor.html">https://bel.fi/alankila/lcd/alpcor.html</a> + for details. There is a proof-of-concept pixman hack for + cairo.</p> + + + <h4 id="back-to-stem-darkening">Back to stem darkening</h4> + + <p>Assume we render fonts correctly. Gamma correction + essentially lightens fonts since shades of gray are + shifted to higher pixel values (corresponding to higher + brightness) to match the original intention to the reality + of our screens. The side-effect is that glyphs that were + rendered incorrectly but fairly readable suddenly thin + out. Correctly rendered but hard-to-read text doesn’t do + anyone a favor. So Mac OS X and Adobe’s proprietary + font engine implement a counter-measure: stem darkening at + smaller sizes where shades of gray dominate. By + emboldening a glyph slightly in relation to its pixel + size, individual pixels get higher coverage of filled-in + outlines and are therefore blacker. This increases + contrast and prevents thinning out of glyphs. Text + remains readable at smaller sizes.</p> + + <p><a href="image/BlendingExamples.png"> + <img src="image/BlendingExamples-thumbnail.png" + alt="Comparison of different ways of + blending."></a></p> + + <p>“Gamma 1.0” shows what happens when you take a grayscale + coverage bitmap from FreeType and blend it onto a surface + in linear space. Black-on-white is heavier than + white-on-black and red-on-green has dark halos or dirt + around it. Note that this picture is unrealistic in the + sense that no rendering system on X11 does linear alpha + blending, so imagine something worse. “Gamma 1.8” is the + result of linear alpha blending and gamma correction. It + is much better, but text thins out, making it harder to + read. Adding stem darkening gets us to “Gamma 1.8, + darkened”. Note how it is the cleanest rendering of all. + “Gamma 1.0, darkened”, meaning linear alpha blending + without gamma correction but with stem darkening, + exaggerates the effects of “Gamma 1.0”. Stem darkening + should only be enabled when doing gamma correction, so + ideally it should always be done.</p> + + <p><a href="image/freetype-262-autohinter-stem-darkening-demo2.png"> + <img src="image/freetype-262-autohinter-stem-darkening-demo2-thumbnail.png" + alt="Waterfall comparison of non-emboldening and + emboldening autohinter."></a></p> + + <p>The autohinter has a new toggleable stem darkening + property that works like the stem darkener in Adobe’s CFF + engine. Note how it makes text slightly bolder with the + default parameters, down to small pixel sizes. Gamma + correction is active to demonstrate the thinning out of + text especially at smaller pixel sizes with lots of gray + pixels.</p> + + <p>And that is the story behind this feature.</p> + + + <h3 id="disabled-stem-darkening-for-the-autohinter-and-adobes-cff-otf-engine">Disabled + stem darkening for the autohinter and Adobe’s CFF + (<code>.otf</code>) engine</h3> + + <p>No library supports linear alpha blending and gamma + correction out of the box on X11. Turning on stem + darkening leads to heavy and fuzzy looking glyphs as in + “Gamma 1.0, darkened” above, so it’s better to disable + it.</p> + + <p>Qt5 actually had gamma correction enabled for a short + time while until someone complained that text was too + light and unlike rendering in other toolkits, so the + maintainers disabled it for + the <a href="https://bugreports.qt.io/browse/QTBUG-41590">XCB-backend</a>. + Skia (Chrome) can do gamma-correction, but turns it off + for X11.</p> + + <p>I see autohinter stem darkening as a technology preview + for playing around with until we get stem darkening + generic within FreeType. The plan is to provide it for + all font drivers and make it toggleable + per <code>FT_Library</code> just like + <code>FT_Library_SetLcdFilter</code>. Libraries that + support linear alpha blending and gamma correction can + then just flip the switch and get appropriate glyphs no + matter the font.</p> + + <p>A notable side-effect of disabling all stem darkening by + default is that natively hinted <code>.otf</code> fonts + will render remarkably similar to the auto-hinter and are + no longer heavy and fuzzy. Slight hinting will result in + consistent font rendering.</p> + + + <h3 id="the-default-lcd-filter-for-subpixel-rendering-has-been-changed">The + default LCD filter for subpixel rendering has been + changed</h3> + + <p><a href="image/freetype-262-new-old-filter.png"> + <img src="image/freetype-262-new-old-filter-thumbnail.png" + alt="Comparison of the old and new + filter."></a></p> + + <p>When you look at subpixel-rendered text, no matter + whether it is on some kind of Unix, Windows, or Mac + OS X, you might notice that it is slightly colored. + Using subpixel rendering on LCD panels is a trade-off; you + get three times higher resolution in the direction of the + pixel-substripe (usually horizontal RGB) in exchange for + color artifacts, also called color fringes. For this + reason it is necessary to filter a subpixel-rendered glyph + to reduce those color fringes before putting it somewhere + on the screen. The filter distributes the values of a + subpixel to its neighbors, sacrificing some of the higher + resolution and making the resulting glyph image blurrier, + but the positioning improvement remains! The ideal filter + for you depends on your screen (gamma curves), the + capabilities of the rendering system (linear alpha + blending and gamma correction), your vision and your + taste, probably in that order.</p> + + <p>A filter should have two properties: it should be + normalized, meaning the values used in the filter should + sum up to a figurative 1 (here: 0x100 or 256) and it + should be color-balanced, meaning that values for one + subpixel are equally distributed to all other subpixels of + a pixel to sacrifice some of the higher resolution to + drastically reduce color fringes.</p> + + <p>Previously, FreeType’s default LCD filter was neither + normalized nor color-balanced. That was a deliberate + choice because there is still no rendering system on + Unix-like operating systems that does linear alpha + blending and gamma correction by default to render glyphs + correctly. Going above a filter sum of 1 increased + contrast somewhat at the expense of slight distortions and + increased color-fringing, so this can be seen as a hack. + You might have noticed that thumbnails in various places + on your computer that show text could be quite colorful. + Now you know why.</p> + + <p>The new default filter is both normalized and + color-balanced. It is indeed ever so slightly blurrier + than the previous default one, but also lacks its + harshness and is less color-happy. The blurriness also + means higher tolerance for non-ideal screen gamma (viewing + angles) and rendering systems without linear alpha + blending. Note that color fringes can only be really + minimized when the rendering system will do linear alpha + blending of text.</p> + + <p>The ‘light’ filter that has accompanied the default one + for so long stays unchanged: it already is normalized and + color-balanced. It is sharper than the default one but + less tolerant of uncalibrated screens and rendering + systems without linear alpha blending, producing more + color fringes.</p> + </div> + + <!-- ************************************************** --> + + <div class="updated"> + <p>Last update: 12-Feb-2016</p> + </div> + </div> + </div> + + + <!-- ************************************************** --> + + <div class="col2"> + </div> + </div> +</div> + + +<!-- ************************************************** --> + +<div id="TOC"> + <ul> + <li class="funding"> + <p><a href="https://pledgie.com/campaigns/24434"> + <img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!" + src="https://pledgie.com/campaigns/24434.png?skin_name=chrome" + border="0" + align="middle"> + </a></p> + + <p><a href="https://flattr.com/thing/421342/lemzwerg-on-Flattr" + target="_blank"> + <img class="with-border" + src="http://api.flattr.com/button/flattr-badge-large.png" + alt="Flattr this" + title="Flattr this" + border="0" + align="middle"> + </a></p> + </li> + <li class="primary"> + <a href="http://freetype.org/index.html">Home</a> + </li> + <li class="primary"> + <a href="http://freetype.org/index.html#news">News</a> + </li> + <li class="primary"> + <a href="index.html">Overview</a> + </li> + <li class="primary"> + <a href="documentation.html">Documentation</a> + </li> + <li class="primary"> + <a href="http://freetype.org/developer.html">Development</a> + </li> + <li class="primary"> + <a href="http://freetype.org/contact.html" + class="emphasis">Contact</a> + </li> + + <li> + <!-- separate primary from secondary entries --> + </li> + + <li class="secondary"> + <a href="#slight-hinting" class="current">On Slight + Hinting, …</a> + </li> + </ul> +</div> + +</div> <!-- id="wrapper" --> + +<div id="TOC-bottom"> +</div> + +</body> +</html> ++++++ ft2demos-2.7.tar.bz2 -> ft2demos-2.7.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/ChangeLog new/ft2demos-2.7.1/ChangeLog --- old/ft2demos-2.7/ChangeLog 2016-09-08 10:03:06.000000000 +0200 +++ new/ft2demos-2.7.1/ChangeLog 2016-12-30 21:31:48.000000000 +0100 @@ -1,3 +1,161 @@ +2016-12-30 Werner Lemberg <[email protected]> + + * Version 2.7.1 released. + ========================= + + + Tag sources with `VER-2-7-1'. + + * README: Updated. + * src/*.1: Updated. + * src/ftinspect.pro: Updated. + +2016-12-27 Werner Lemberg <[email protected]> + + [ftmulti] Minor. + + * src/ftmulti.c (Process_Event, main): If MM, round design + coordinates. + +2016-12-25 Werner Lemberg <[email protected]> + + Fixes for clang++. + + * Makefile (COMPILE): Don't add `-std=c99' if using a C++ compiler. + + * src/ftbench.c (_GNU_SOURCE): Declare only if not already defined. + + * src/ftcommon.c (_GNU_SOURCE): Declare only if not already defined. + (FTDemo_Install_Font): Use proper case for `FT_Select_Charmap'. + + * src/ftmulti.c (main): Use proper case for `FT_Select_Charmap'. + +2016-12-20 Werner Lemberg <[email protected]> + + * src/ftmulti.c: Minor clang fixes. + +2016-12-19 Werner Lemberg <[email protected]> + + [ftmulti] Support multiple engines. + + Similar to other programs, use the `H' key to cycle through engines + (if available). + + * src/ftmulti.c: Include FT_FONT_FORMATS_H, FT_MODULE_H, + FT_TRUETYPE_DRIVER_H, FT_CFF_DRIVER_H. + (N_CFF_HINTING_ENGINES): New macro. + (cff_hinting_engine, tt_interpreter_versions, + num_tt_interpreter_versions, tt_interpreter_version_idx, + font_format): New global variables. + (Help): Updated. + (cff_hinting_engine_change, tt_interpreter_version_change): New + functions. + (Process_Event): Handle key `H'. + (main): Set up selection of CFF and TrueType engine versions. + Display selected engine. + Force redisplay of current font if `H' key was pressed. + +2016-11-06 Werner Lemberg <[email protected]> + + * src/ftbench.c (main): Adjust size argument for bitmap strikes. + + For bitmap-only fonts we enforce the selection of the first bitmap + strike size. + This commit also fixes the `size' value itself. + +2016-10-29 Werner Lemberg <[email protected]> + + Minor compilation issues. + + * Makefile: Use ANSIFLAGS and select C99 for GNU-like compilers. + + * src/ftbench.c, src/ftcommon.c (_GNU_SOURCE): Define. We use + functionality not covered by ANSI. + +2016-10-29 Werner Lemberg <[email protected]> + + Fix clang warnings. + + We now have a new `FT_ENCODING_OTHER' tag used for internal + purposes. Since it is not possible to extend an enumeration after + its definition, replace `FT_Encoding' types with `unsigned long'. + + * src/ftcommon.c (FTDemo_Make_Encoding_Tag): Updated. + * src/ftcommon.h (FTDemo_Handle): Ditto. + + * src/ftmulti.c (encoding): Use `unsigned long'. + (main): Updated. + + * src/ftstring.c (Sample): Make array of type `const char*'. + (status): Use `unsigned long' for `encoding' field. + Use `const char*' for `text' field. + + * src/ftview.c (status): Use `unsigned long' for `encoding'. + (FT_ENCODING_OTHER): Use `unsigned long'. + +2016-10-18 Alexei Podtelezhnikov <[email protected]> + + [graph] Untested legacy 15/16-bit color fixes. + + Our tools do not use the legacy 15/16-bit color modes. This is mostly + for the sake of correctness. We might also remove the code. + + * graph/grblit.c (blit_gray{8,}_to_{555,565}): Updated. + * graph/x11/grx11.c (gr_x11_format_{bgr565,rgb555,bgr555}): Updated. + +2016-10-13 Alexei Podtelezhnikov <[email protected]> + + * graph/grblit.c (blit_lcd28_to_24): Typo. + +2016-10-10 Alexei Podtelezhnikov <[email protected]> + + * src/ftdump.c (Print_Charmaps): Dump format info. + +2016-10-09 Alexei Podtelezhnikov <[email protected]> + + [ftview] Recognize other charmaps. + + * src/ftview.c (event_change_encoding): Recognize when + FT_ENCODING_NONE has special other meaning. + (write_header): Default case for `status.encoding'. + +2016-10-07 Alexei Podtelezhnikov <[email protected]> + + [ftview] Fix charmap cycling. + + * src/ftview.c (event_change_encoding): Reimplement relying on + `cmap_index' field in TFont structure. + +2016-10-05 Alexei Podtelezhnikov <[email protected]> + + [ftview] Implement cycling through available charmaps. + + * src/ftview.c (event_change_encoding): New function. + (Process_Event): New [Tab] event to cycle through available charmaps, + also increase index steps to 16, 256, and 4096. + (event_help): Updated. + +2016-10-03 Alexei Podtelezhnikov <[email protected]> + + * graph/grevents.h (grKey): Typo. + +2016-10-01 İsmail Dönmez <[email protected]> + + * src/ftinspect.pro (LIBS): Fix default value. + +2016-09-24 Alexei Podtelezhnikov <[email protected]> + + [ftstring] Add LGC and CJK sample strings. + + * src/ftstring.c (event_text_change): New function. + (Process_Event): New [Tab] event to cycle through sample strings. + (event_help): Offer it. + (status, event_font_change, main): Updated. + +2016-09-16 Werner Lemberg <[email protected]> + + * src/ftbench.1: Improve. + 2016-09-08 Werner Lemberg <[email protected]> * Version 2.7 released. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/Makefile new/ft2demos-2.7.1/Makefile --- old/ft2demos-2.7/Makefile 2016-08-26 11:45:49.000000000 +0200 +++ new/ft2demos-2.7.1/Makefile 2016-12-25 06:45:00.000000000 +0100 @@ -129,9 +129,19 @@ COMPILE = $(CC) $(CPPFLAGS) \ $(CFLAGS) \ + $(ANSIFLAGS) \ $(INCLUDES:%=$I%) \ $DFT_CONFIG_MODULES_H="<ftmodule.h>" + # Enable C99 for gcc to avoid warnings. + # Note that clang++ aborts with an error if we use `-std=C99', + # so check for `++' in $(CC) also. + ifneq ($(findstring -pedantic,$(COMPILE)),) + ifeq ($(findstring ++,$(CC)),) + COMPILE += -std=c99 + endif + endif + FTLIB := $(LIB_DIR)/$(LIBRARY).$A # `-lm' is required to compile on some Unix systems. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/README new/ft2demos-2.7.1/README --- old/ft2demos-2.7/README 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/README 2016-12-30 21:32:34.000000000 +0100 @@ -8,8 +8,8 @@ downloaded one of the stable FreeType 2 source packages from our server, you most probably have to rename its directory, for example: - mv freetype-2.7 freetype2 on Unix - rename freetype-2.7 freetype2 on Windows + mv freetype-2.7.1 freetype2 on Unix + rename freetype-2.7.1 freetype2 on Windows WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/graph/allegro/gralleg.c new/ft2demos-2.7.1/graph/allegro/gralleg.c --- old/ft2demos-2.7/graph/allegro/gralleg.c 2009-03-14 14:58:28.000000000 +0100 +++ new/ft2demos-2.7.1/graph/allegro/gralleg.c 2016-10-14 09:08:52.000000000 +0200 @@ -7,8 +7,8 @@ * graphics, timers, etc., and is available on 32-bit DOS, Windows, * UNIX (X11, DGA, DGA2), Linux (svgalib, framebuffer) and BeOS. * - * http://www.talula.demon.co.uk/allegro/ - * http://sourceforge.net/projects/alleg/ + * http://liballeg.org/ + * https://github.com/liballeg * ******************************************************************/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/graph/grblit.c new/ft2demos-2.7.1/graph/grblit.c --- old/ft2demos-2.7/graph/grblit.c 2016-02-03 19:09:37.000000000 +0100 +++ new/ft2demos-2.7.1/graph/grblit.c 2016-10-19 06:55:23.000000000 +0200 @@ -865,19 +865,15 @@ grColor color ) { int y; - int sr = (color.chroma[0] << 8) & 0x7C00; + int sr = (color.chroma[0] << 7) & 0x7C00; int sg = (color.chroma[1] << 2) & 0x03E0; - int sb = (color.chroma[2] ) & 0x001F; + int sb = (color.chroma[2] >> 3) & 0x001F; unsigned char* read; unsigned char* write; - long color2; read = blit->read + blit->xread; write = blit->write + 2*blit->xwrite; - color2 = color.value; - extract565( color2, color ); - y = blit->height; do { @@ -895,9 +891,7 @@ unsigned short* pixel = (unsigned short*)_write; if (val >= 254 ) - { - pixel[0] = (unsigned short)color2; - } + *pixel = (unsigned short)( sr | sg | sb ); else if ( val >= 2 ) { /* compose gray value */ @@ -906,17 +900,14 @@ int dg = pix & 0x03E0; int db = pix & 0x001F; - dr = pix & 0x7C00; dr += ((sr-dr)*val) >> 8; - dr &= 0xF800; + dr &= 0x7C00; - dg = pix & 0x03E0; dg += ((sg-dg)*val) >> 8; - dg &= 0x7E0; + dg &= 0x03E0; - db = pix & 0x001F; db += ((sb-db)*val) >> 8; - db += 0x001F; + db &= 0x001F; *pixel = (unsigned short)( dr | dg | db ); } @@ -943,14 +934,14 @@ int y; unsigned char* read; unsigned char* write; - long color2; read = blit->read + blit->xread; write = blit->write + 2*blit->xwrite; - /* convert color to R:G:B triplet */ - color2 = color.value; - extract555( color2, color ); + /* scale down R:G:B triplet */ + color.chroma[0] >>= 3; + color.chroma[1] >>= 3; + color.chroma[2] >>= 3; y = blit->height; do @@ -969,7 +960,7 @@ unsigned short* pixel = (unsigned short*)_write; if (val == max) - pixel[0] = (unsigned short)color2; + *pixel = (unsigned short)(inject555( color )); else { /* compose gray value */ @@ -979,7 +970,7 @@ extract555( pix16, pix ); compose_pixel( pix, color, val, max ); - *pixel = (unsigned short)(inject555(pix)); + *pixel = (unsigned short)(inject555( pix )); } } _write += 2; @@ -1008,18 +999,14 @@ { int y; int sr = (color.chroma[0] << 8) & 0xF800; - int sg = (color.chroma[1] << 2) & 0x07E0; - int sb = (color.chroma[2] ) & 0x001F; + int sg = (color.chroma[1] << 3) & 0x07E0; + int sb = (color.chroma[2] >> 3) & 0x001F; unsigned char* read; unsigned char* write; - long color2; read = blit->read + blit->xread; write = blit->write + 2*blit->xwrite; - color2 = color.value; - extract565( color2, color ); - y = blit->height; do { @@ -1037,7 +1024,7 @@ unsigned short* pixel = (unsigned short*)_write; if (val >= 254 ) - pixel[0] = (unsigned short)color2; + *pixel = (unsigned short)( sr | sg | sb ); else if ( val >= 2 ) { /* compose gray value */ @@ -1046,17 +1033,14 @@ int dg = pix & 0x07E0; int db = pix & 0x001F; - dr = pix & 0xF800; dr += ((sr-dr)*val) >> 8; dr &= 0xF800; - dg = pix & 0x07E0; dg += ((sg-dg)*val) >> 8; - dg &= 0x7E0; + dg &= 0x07E0; - db = pix & 0x001F; db += ((sb-db)*val) >> 8; - db += 0x001F; + db &= 0x001F; *pixel = (unsigned short)( dr | dg | db ); } @@ -1082,13 +1066,14 @@ int y; unsigned char* read; unsigned char* write; - long color2; read = blit->read + blit->xread; write = blit->write + 2*blit->xwrite; - color2 = color.value; - extract565( color2, color ); + /* scale down R:G:B triplet */ + color.chroma[0] >>= 3; + color.chroma[1] >>= 2; + color.chroma[2] >>= 3; y = blit->height; do @@ -1107,7 +1092,7 @@ unsigned short* pixel = (unsigned short*)_write; if (val == max) - pixel[0] = (unsigned short)color2; + *pixel = (unsigned short)inject565( color ); else { /* compose gray value */ @@ -1535,7 +1520,7 @@ dg = _write[1]; dg += (sg-dg)*val1 >> 8; - db = _write[1]; + db = _write[2]; db += (sb-db)*val2 >> 8; _write[0] = (unsigned char)dr; @@ -1867,7 +1852,7 @@ static double gblender_gamma = -100.0; if ( glyph->grays != 256 ) - goto DefaultBlit; + goto LegacyBlit; switch ( glyph->mode ) { @@ -1879,7 +1864,7 @@ case gr_pixel_mode_bgra: src_format = GBLENDER_SOURCE_BGRA; break; default: - goto DefaultBlit; + goto LegacyBlit; } width = glyph->width; @@ -1899,7 +1884,7 @@ case gr_pixel_mode_rgb24: dst_format = GBLENDER_TARGET_RGB24; break; case gr_pixel_mode_rgb565: dst_format = GBLENDER_TARGET_RGB565; break; default: - goto DefaultBlit; + goto LegacyBlit; } /* initialize blender when needed, i.e. when gamma changes @@ -1935,7 +1920,7 @@ return 1; } - DefaultBlit: + LegacyBlit: /* no gamma correction, no caching */ /* set up blitter and compute clipping. Return immediately if needed */ blit.source = *glyph; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/graph/grevents.h new/ft2demos-2.7.1/graph/grevents.h --- old/ft2demos-2.7/graph/grevents.h 2016-02-03 19:09:37.000000000 +0100 +++ new/ft2demos-2.7.1/graph/grevents.h 2016-10-08 18:48:22.000000000 +0200 @@ -54,7 +54,7 @@ grKeyExclam = '!', grKeyPercent = '%', grKeyLeftParen = '(', - grKeyRightParen = '(', + grKeyRightParen = ')', grKeyAt = '@', grKey_A = 'A', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/graph/x11/grx11.c new/ft2demos-2.7.1/graph/x11/grx11.c --- old/ft2demos-2.7/graph/x11/grx11.c 2016-02-03 19:09:37.000000000 +0100 +++ new/ft2demos-2.7.1/graph/x11/grx11.c 2016-10-19 06:55:23.000000000 +0200 @@ -362,7 +362,7 @@ static const grX11Format gr_x11_format_bgr565 = { - 16, 16, 0x001F, 0x7E00, 0xF800U, + 16, 16, 0x001F, 0x07E0, 0xF800U, gr_x11_convert_rgb_to_bgr565, gr_x11_convert_gray_to_rgb565 /* the same for bgr565! */ }; @@ -442,7 +442,7 @@ static const grX11Format gr_x11_format_rgb555 = { - 15, 16, 0x7C00, 0x3E00, 0x001F, + 15, 16, 0x7C00, 0x03E0, 0x001F, gr_x11_convert_rgb_to_rgb555, gr_x11_convert_gray_to_rgb555 }; @@ -491,7 +491,7 @@ static const grX11Format gr_x11_format_bgr555 = { - 15, 16, 0x1F00, 0x3E00, 0x7C00, + 15, 16, 0x001F, 0x03E0, 0x7C00, gr_x11_convert_rgb_to_bgr555, gr_x11_convert_gray_to_rgb555 /* the same for bgr555! */ }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftbench.1 new/ft2demos-2.7.1/src/ftbench.1 --- old/ft2demos-2.7/src/ftbench.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftbench.1 2016-12-30 21:32:34.000000000 +0100 @@ -1,5 +1,5 @@ '\" t -.TH FTVIEW 1 "September 2016" "Freetype 2.7" +.TH FTVIEW 1 "December 2016" "Freetype 2.7.1" . . .SH NAME @@ -66,9 +66,9 @@ . .TP .BI \-i \ idx -Start with index +Start with glyph index .I idx -(default is 0). +(default is 0, which means to process all glyphs). . .TP .BI \-m \ m @@ -78,7 +78,10 @@ . .TP .B \-p -Preload font file in memory. +Preload font file in memory (this is, testing +.B FT_New_Memory_Face +instead of +.BR FT_New_Face ). . .TP .BI \-r \ n @@ -129,16 +132,16 @@ .TS tab (@); rB l. -a@load a glyph (FT_Load_Glyph) +a@load glyphs (FT_Load_Glyph) b@load advance widths (FT_Get_Advances) -c@render a glyph (FT_Render_Glyph) -d@load a glyph (FT_Get_Glyph) -e@get glyph cbox (FT_Glyph_Get_CBox) +c@render glyphs (FT_Render_Glyph) +d@load glyphs (FT_Get_Glyph) +e@get glyph cboxes (FT_Glyph_Get_CBox) f@get glyph indices (FT_Get_Char_Index) g@iterate CMap (FT_Get_{First,Next}_Char) -h@open a new face (FT_New_Face) -i@embolden (FT_GlyphSlot_Embolden) -j@get glyph bbox (FT_Outline_Get_BBox) +h@open a new face (FT_New_Face or FT_New_Memory_Face) +i@embolden glyphs (FT_GlyphSlot_Embolden) +j@get glyph bboxes (FT_Outline_Get_BBox) .TE .RE . @@ -147,6 +150,11 @@ .BR abcdefghij , this is, all tests). . +.IP +The number of used glyphs per test (within a single iteration) is given by +option +.BR \-i . +. .TP .B \-v Show version. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftbench.c new/ft2demos-2.7.1/src/ftbench.c --- old/ft2demos-2.7/src/ftbench.c 2016-08-26 11:45:49.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftbench.c 2016-12-25 13:36:51.000000000 +0100 @@ -10,6 +10,10 @@ /****************************************************************************/ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* we want to use extensions to `time.h' if available */ +#endif + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -1065,7 +1069,12 @@ } } else - size = (unsigned int)face->available_sizes[0].width; + { + size = (unsigned int)face->available_sizes[0].size >> 6; + fprintf( stderr, + "using size of first bitmap strike (%dpx)\n", size ); + FT_Select_Size( face, 0 ); + } } FTC_Manager_New( lib, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftcommon.c new/ft2demos-2.7.1/src/ftcommon.c --- old/ft2demos-2.7/src/ftcommon.c 2016-08-26 11:45:49.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftcommon.c 2016-12-25 13:36:44.000000000 +0100 @@ -11,6 +11,10 @@ /****************************************************************************/ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* we use `strcasecmp' */ +#endif + #include <ft2build.h> #include FT_FREETYPE_H @@ -412,7 +416,7 @@ if ( handle->encoding != FT_ENCODING_NONE ) { - error = FT_Select_Charmap( face, handle->encoding ); + error = FT_Select_Charmap( face, (FT_Encoding)handle->encoding ); if ( error ) { FT_Done_Face( face ); @@ -1387,7 +1391,7 @@ } - FT_Encoding + unsigned long FTDemo_Make_Encoding_Tag( const char* s ) { int i; @@ -1402,7 +1406,7 @@ l += (unsigned long)s[i]; } - return (FT_Encoding)l; + return l; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftcommon.h new/ft2demos-2.7.1/src/ftcommon.h --- old/ft2demos-2.7/src/ftcommon.h 2016-08-26 11:45:49.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftcommon.h 2016-10-29 00:12:11.000000000 +0200 @@ -203,7 +203,7 @@ int string_length; int string_reload; - FT_Encoding encoding; + unsigned long encoding; FT_Stroker stroker; FT_Bitmap bitmap; /* used as bitmap conversion buffer */ @@ -335,7 +335,7 @@ /* make a FT_Encoding tag from a string */ - FT_Encoding + unsigned long FTDemo_Make_Encoding_Tag( const char* s ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftdiff.1 new/ft2demos-2.7.1/src/ftdiff.1 --- old/ft2demos-2.7/src/ftdiff.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftdiff.1 2016-12-30 21:32:34.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTDIFF 1 "September 2016" "FreeType 2.7" +.TH FTDIFF 1 "December 2016" "FreeType 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftdump.1 new/ft2demos-2.7.1/src/ftdump.1 --- old/ft2demos-2.7/src/ftdump.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftdump.1 2016-12-30 21:32:34.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTDUMP 1 "September 2016" "FreeType 2.7" +.TH FTDUMP 1 "December 2016" "FreeType 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftdump.c new/ft2demos-2.7.1/src/ftdump.c --- old/ft2demos-2.7/src/ftdump.c 2016-08-26 11:45:49.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftdump.c 2016-10-14 09:08:52.000000000 +0200 @@ -407,11 +407,13 @@ for( i = 0; i < face->num_charmaps; i++ ) { + FT_Long format = FT_Get_CMap_Format( face->charmaps[i] ); FT_ULong lang_id = FT_Get_CMap_Language_ID( face->charmaps[i] ); - printf( " %d: platform %u, encoding %2u", + printf( " %d: format %ld, platform %u, encoding %2u", i, + format, face->charmaps[i]->platform_id, face->charmaps[i]->encoding_id ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftgamma.1 new/ft2demos-2.7.1/src/ftgamma.1 --- old/ft2demos-2.7/src/ftgamma.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftgamma.1 2016-12-30 21:32:34.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTGAMMA 1 "September 2016" "FreeType 2.7" +.TH FTGAMMA 1 "December 2016" "FreeType 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftgrid.1 new/ft2demos-2.7.1/src/ftgrid.1 --- old/ft2demos-2.7/src/ftgrid.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftgrid.1 2016-12-30 21:32:35.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTGRID 1 "September 2016" "Freetype 2.7" +.TH FTGRID 1 "December 2016" "Freetype 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftinspect.pro new/ft2demos-2.7.1/src/ftinspect.pro --- old/ft2demos-2.7/src/ftinspect.pro 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftinspect.pro 2016-12-30 21:32:35.000000000 +0100 @@ -5,13 +5,13 @@ # # You should adapt this to your setup. unix|macx { - LIBS += ../../freetype2/objs/libfreetype.a + LIBS += ../../freetype2/objs/.libs/libfreetype.a CONFIG += link_pkgconfig PKGCONFIG += libpng harfbuzz zlib bzip2 } win32 { - LIBS += ../../freetyp2/objs/vc2010/freetype27.lib + LIBS += ../../freetyp2/objs/vc2010/freetype271.lib LIBS += -lpng -lharfbuzz -lz -lbz2 -lm } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftlint.1 new/ft2demos-2.7.1/src/ftlint.1 --- old/ft2demos-2.7/src/ftlint.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftlint.1 2016-12-30 21:32:35.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTLINT 1 "September 2016" "Freetype 2.7" +.TH FTLINT 1 "December 2016" "Freetype 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftmulti.1 new/ft2demos-2.7.1/src/ftmulti.1 --- old/ft2demos-2.7/src/ftmulti.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftmulti.1 2016-12-30 21:32:35.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTMULTI 1 "September 2016" "Freetype 2.7" +.TH FTMULTI 1 "December 2016" "Freetype 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftmulti.c new/ft2demos-2.7.1/src/ftmulti.c --- old/ft2demos-2.7/src/ftmulti.c 2016-08-26 11:45:49.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftmulti.c 2016-12-27 22:00:01.000000000 +0100 @@ -14,6 +14,10 @@ #include <ft2build.h> #include FT_FREETYPE_H +#include FT_FONT_FORMATS_H +#include FT_MODULE_H +#include FT_TRUETYPE_DRIVER_H +#include FT_CFF_DRIVER_H #include FT_MULTIPLE_MASTERS_H #include "common.h" @@ -33,9 +37,11 @@ #define MAXPTSIZE 500 /* dtp */ #define MAX_MM_AXES 6 +#define N_CFF_HINTING_ENGINES 2 - static char Header[256]; - static char* new_header = 0; + + static char Header[256]; + static char* new_header = NULL; static const unsigned char* Text = (unsigned char*) "The quick brown fox jumps over the lazy dog 0123456789 " @@ -48,7 +54,14 @@ static FT_Size size; /* the font size */ static FT_GlyphSlot glyph; /* the glyph slot */ - static FT_Encoding encoding = FT_ENCODING_NONE; + static unsigned long encoding = FT_ENCODING_NONE; + + static unsigned int cff_hinting_engine; + static unsigned int tt_interpreter_versions[3]; + static unsigned int num_tt_interpreter_versions; + static unsigned int tt_interpreter_version_idx; + + static const char* font_format; static FT_Error error; /* error returned by FreeType? */ @@ -426,6 +439,8 @@ grLn(); grWriteln( "p, n previous/next font" ); grLn(); + grWriteln( "H cycle through hinting engines (if available)" ); + grLn(); grWriteln( "Up, Down change pointsize by 1 unit" ); grWriteln( "PgUp, PgDn change pointsize by 10 units" ); grLn(); @@ -449,6 +464,40 @@ } + static void + cff_hinting_engine_change( int delta ) + { + int new_cff_hinting_engine = 0; + + + if ( delta ) + new_cff_hinting_engine = + ( (int)cff_hinting_engine + + delta + + N_CFF_HINTING_ENGINES ) % N_CFF_HINTING_ENGINES; + + error = FT_Property_Set( library, + "cff", + "hinting-engine", + &new_cff_hinting_engine ); + if ( !error ) + cff_hinting_engine = (FT_UInt)new_cff_hinting_engine; + } + + + static void + tt_interpreter_version_change( void ) + { + tt_interpreter_version_idx += 1; + tt_interpreter_version_idx %= num_tt_interpreter_versions; + + FT_Property_Set( library, + "truetype", + "interpreter-version", + &tt_interpreter_versions[tt_interpreter_version_idx] ); + } + + static int Process_Event( grEvent* event ) { @@ -469,7 +518,7 @@ /* mode keys */ case grKEY( 'a' ): - antialias = !antialias; + antialias = !antialias; new_header = antialias ? (char *)"anti-aliasing is now on" : (char *)"anti-aliasing is now off"; return 1; @@ -486,7 +535,7 @@ return (int)event->key; case grKEY( 'h' ): - hinted = !hinted; + hinted = !hinted; new_header = hinted ? (char *)"glyph hinting is now active" : (char *)"glyph hinting is now ignored"; break; @@ -497,6 +546,13 @@ : (char *)"rendering test text string"; break; + case grKEY( 'H' ): + if ( !strcmp( font_format, "CFF" ) ) + cff_hinting_engine_change( 1 ); + else if ( !strcmp( font_format, "TrueType" ) ) + tt_interpreter_version_change(); + break; + /* MM related keys */ case grKeyF1: @@ -630,25 +686,35 @@ * for optical size even in PS. */ pos += FT_MulDiv( i, a->maximum - a->minimum, 1000 ); - if ( pos < a->minimum ) pos = a->minimum; - if ( pos > a->maximum ) pos = a->maximum; + if ( pos < a->minimum ) + pos = a->minimum; + if ( pos > a->maximum ) + pos = a->maximum; design_pos[axis] = pos; + /* for MM fonts, round the design coordinates to integers */ + if ( !FT_IS_SFNT( face ) ) + design_pos[axis] &= (FT_Fixed)0xFFFF0000L; + FT_Set_Var_Design_Coordinates( face, used_num_axis, design_pos ); } return 1; Do_Scale: ptsize += i; - if ( ptsize < 1 ) ptsize = 1; - if ( ptsize > MAXPTSIZE ) ptsize = MAXPTSIZE; + if ( ptsize < 1 ) + ptsize = 1; + if ( ptsize > MAXPTSIZE ) + ptsize = MAXPTSIZE; return 1; Do_Glyph: Num += i; - if ( Num < 0 ) Num = 0; - if ( Num >= num_glyphs ) Num = num_glyphs - 1; + if ( Num < 0 ) + Num = 0; + if ( Num >= num_glyphs ) + Num = num_glyphs - 1; return 1; } @@ -705,8 +771,15 @@ int option; int file_loaded; + unsigned int n; + grEvent event; + unsigned int dflt_tt_interpreter_version; + unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, + TT_INTERPRETER_VERSION_38, + TT_INTERPRETER_VERSION_40 }; + execname = ft_basename( argv[0] ); @@ -715,6 +788,30 @@ if ( error ) PanicZ( "Could not initialize FreeType library" ); + /* get the default value as compiled into FreeType */ + FT_Property_Get( library, + "cff", + "hinting-engine", &cff_hinting_engine ); + + /* collect all available versions, then set again the default */ + FT_Property_Get( library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + for ( n = 0; n < 3; n++ ) + { + error = FT_Property_Set( library, + "truetype", + "interpreter-version", &versions[n] ); + if ( !error ) + tt_interpreter_versions[ + num_tt_interpreter_versions++] = versions[n]; + if ( versions[n] == dflt_tt_interpreter_version ) + tt_interpreter_version_idx = n; + } + FT_Property_Set( library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + while ( 1 ) { option = getopt( argc, argv, "d:e:f:h:r:vw:" ); @@ -729,7 +826,7 @@ break; case 'e': - encoding = (FT_Encoding)make_tag( optarg ); + encoding = make_tag( optarg ); break; case 'f': @@ -799,9 +896,11 @@ goto Display_Font; } + font_format = FT_Get_Font_Format( face ); + if ( encoding != FT_ENCODING_NONE ) { - error = FT_Select_Charmap( face, encoding ); + error = FT_Select_Charmap( face, (FT_Encoding)encoding ); if ( error ) goto Display_Font; } @@ -816,28 +915,27 @@ /* if the user specified a position, use it, otherwise */ /* set the current position to the median of each axis */ + if ( multimaster->num_axis > MAX_MM_AXES ) { - unsigned int n; - - - if ( multimaster->num_axis > MAX_MM_AXES ) - { - fprintf( stderr, "only handling first %d GX axes (of %d)\n", - MAX_MM_AXES, multimaster->num_axis ); - used_num_axis = MAX_MM_AXES; - } - else - used_num_axis = multimaster->num_axis; + fprintf( stderr, "only handling first %d GX axes (of %d)\n", + MAX_MM_AXES, multimaster->num_axis ); + used_num_axis = MAX_MM_AXES; + } + else + used_num_axis = multimaster->num_axis; - for ( n = 0; n < used_num_axis; n++ ) - { - design_pos[n] = n < requested_cnt ? requested_pos[n] - : multimaster->axis[n].def; - if ( design_pos[n] < multimaster->axis[n].minimum ) - design_pos[n] = multimaster->axis[n].minimum; - else if ( design_pos[n] > multimaster->axis[n].maximum ) - design_pos[n] = multimaster->axis[n].maximum; - } + for ( n = 0; n < used_num_axis; n++ ) + { + design_pos[n] = n < requested_cnt ? requested_pos[n] + : multimaster->axis[n].def; + if ( design_pos[n] < multimaster->axis[n].minimum ) + design_pos[n] = multimaster->axis[n].minimum; + else if ( design_pos[n] > multimaster->axis[n].maximum ) + design_pos[n] = multimaster->axis[n].maximum; + + /* for MM fonts, round the design coordinates to integers */ + if ( !FT_IS_SFNT( face ) ) + design_pos[n] &= (FT_Fixed)0xFFFF0000L; } error = FT_Set_Var_Design_Coordinates( face, used_num_axis, design_pos ); @@ -903,11 +1001,10 @@ new_header = Header; grWriteCellString( &bit, 0, 0, new_header, fore_color ); - new_header = 0; + new_header = NULL; sprintf( Header, "axes:" ); { - unsigned int n; unsigned int limit = used_num_axis > MAX_MM_AXES / 2 ? MAX_MM_AXES / 2 : used_num_axis; @@ -929,7 +1026,6 @@ if ( used_num_axis > MAX_MM_AXES / 2 ) { - unsigned int n; unsigned int limit = used_num_axis; @@ -950,9 +1046,24 @@ grWriteCellString( &bit, 0, 24, Header, fore_color ); } - sprintf( Header, "at %d points, first glyph = %d", - ptsize, - Num ); + { + unsigned int tt_ver = tt_interpreter_versions[ + tt_interpreter_version_idx]; + + + sprintf( Header, "at %d points, first glyph = %d, format = %s", + ptsize, + Num, + strcmp( font_format, "CFF" ) + ? ( tt_ver == TT_INTERPRETER_VERSION_35 + ? "TrueType (v35)" + : ( tt_ver == TT_INTERPRETER_VERSION_38 + ? "TrueType (v38)" + : "TrueType (v40)" ) ) + : ( cff_hinting_engine == FT_CFF_HINTING_FREETYPE + ? "CFF (FreeType)" + : "CFF (Adobe)" ) ); + } } else { @@ -988,6 +1099,15 @@ goto NewFile; } + + if ( key == 'H' ) + { + /* enforce reloading */ + if ( file_loaded >= 1 ) + FT_Done_Face( face ); + + goto NewFile; + } if ( ptsize != old_ptsize ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftstring.1 new/ft2demos-2.7.1/src/ftstring.1 --- old/ft2demos-2.7/src/ftstring.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftstring.1 2016-12-30 21:32:35.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTSTRING 1 "September 2016" "Freetype 2.7" +.TH FTSTRING 1 "December 2016" "Freetype 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftstring.c new/ft2demos-2.7.1/src/ftstring.c --- old/ft2demos-2.7/src/ftstring.c 2016-08-26 11:45:49.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftstring.c 2016-10-29 00:13:50.000000000 +0200 @@ -2,7 +2,7 @@ /* */ /* The FreeType project -- a free and portable quality TrueType renderer. */ /* */ -/* Copyright 1996-2007, 2009-2015 by */ +/* Copyright 1996-2007, 2009-2016 by */ /* D. Turner, R.Wilhelm, and W. Lemberg */ /* */ /* */ @@ -27,7 +27,49 @@ #define MAXPTSIZE 500 /* dtp */ - static char* Text = (char *)"The quick brown fox jumps over the lazy dog"; + static const char* Sample[] = + { + "The quick brown fox jumps over the lazy dog", + + /* Luís argüia à Júlia que «brações, fé, chá, óxido, pôr, zângão» */ + /* eram palavras do português */ + "Lu\u00EDs arg\u00FCia \u00E0 J\u00FAlia que \u00ABbra\u00E7\u00F5es, " + "f\u00E9, ch\u00E1, \u00F3xido, p\u00F4r, z\u00E2ng\u00E3o\u00BB eram " + "palavras do portugu\u00EAs", + + /* Ο καλύμνιος σφουγγαράς ψιθύρισε πως θα βουτήξει χωρίς να διστάζει */ + "\u039F \u03BA\u03B1\u03BB\u03CD\u03BC\u03BD\u03B9\u03BF\u03C2 \u03C3" + "\u03C6\u03BF\u03C5\u03B3\u03B3\u03B1\u03C1\u03AC\u03C2 \u03C8\u03B9" + "\u03B8\u03CD\u03C1\u03B9\u03C3\u03B5 \u03C0\u03C9\u03C2 \u03B8\u03B1 " + "\u03B2\u03BF\u03C5\u03C4\u03AE\u03BE\u03B5\u03B9 \u03C7\u03C9\u03C1" + "\u03AF\u03C2 \u03BD\u03B1 \u03B4\u03B9\u03C3\u03C4\u03AC\u03B6\u03B5" + "\u03B9", + + /* Съешь ещё этих мягких французских булок да выпей же чаю */ + "\u0421\u044A\u0435\u0448\u044C \u0435\u0449\u0451 \u044D\u0442\u0438" + "\u0445 \u043C\u044F\u0433\u043A\u0438\u0445 \u0444\u0440\u0430\u043D" + "\u0446\u0443\u0437\u0441\u043A\u0438\u0445 \u0431\u0443\u043B\u043E" + "\u043A \u0434\u0430 \u0432\u044B\u043F\u0435\u0439 \u0436\u0435 " + "\u0447\u0430\u044E", + + /* 天地玄黃,宇宙洪荒。日月盈昃,辰宿列張。寒來暑往,秋收冬藏。*/ + "\u5929\u5730\u7384\u9EC3\uFF0C\u5B87\u5B99\u6D2A\u8352\u3002\u65E5" + "\u6708\u76C8\u6603\uFF0C\u8FB0\u5BBF\u5217\u5F35\u3002\u5BD2\u4F86" + "\u6691\u5F80\uFF0C\u79CB\u6536\u51AC\u85CF\u3002", + + /* いろはにほへと ちりぬるを わかよたれそ つねならむ */ + /* うゐのおくやま けふこえて あさきゆめみし ゑひもせす */ + "\u3044\u308D\u306F\u306B\u307B\u3078\u3068 \u3061\u308A\u306C\u308B" + "\u3092 \u308F\u304B\u3088\u305F\u308C\u305D \u3064\u306D\u306A\u3089" + "\u3080 \u3046\u3090\u306E\u304A\u304F\u3084\u307E \u3051\u3075\u3053" + "\u3048\u3066 \u3042\u3055\u304D\u3086\u3081\u307F\u3057 \u3091\u3072" + "\u3082\u305B\u3059", + + /* 키스의 고유조건은 입술끼리 만나야 하고 특별한 기술은 필요치 않다 */ + "\uD0A4\uC2A4\uC758 \uACE0\uC720\uC870\uAC74\uC740 \uC785\uC220\uB07C" + "\uB9AC \uB9CC\uB098\uC57C \uD558\uACE0 \uD2B9\uBCC4\uD55C \uAE30" + "\uC220\uC740 \uD544\uC694\uCE58 \uC54A\uB2E4" + }; enum { @@ -38,26 +80,27 @@ static struct status_ { - int width; - int height; + int width; + int height; - int render_mode; - FT_Encoding encoding; - int res; - int ptsize; /* current point size */ - double gamma; - int angle; + int render_mode; + unsigned long encoding; + int res; + int ptsize; /* current point size */ + double gamma; + int angle; + const char* text; FTDemo_String_Context sc; - FT_Byte gamma_ramp[256]; /* for show only */ - FT_Matrix trans_matrix; - int font_index; - char* header; - char header_buffer[256]; + FT_Byte gamma_ramp[256]; /* for show only */ + FT_Matrix trans_matrix; + int font_index; + char* header; + char header_buffer[256]; } status = { DIM_X, DIM_Y, - RENDER_MODE_STRING, FT_ENCODING_UNICODE, 72, 48, GAMMA, 0, + RENDER_MODE_STRING, FT_ENCODING_UNICODE, 72, 48, GAMMA, 0, NULL, { 0, 0, 0, 0, NULL }, { 0 }, { 0, 0, 0, 0 }, 0, NULL, { 0 } }; @@ -120,7 +163,8 @@ grWriteln( " l : cycle through LCD modes" ); grWriteln( " k : cycle through kerning modes" ); grWriteln( " t : cycle through kerning degrees" ); - grWriteln( " space : cycle through color" ); + grWriteln( " Space : cycle through color" ); + grWriteln( " Tab : cycle through sample strings" ); grWriteln( " V : toggle vertical rendering" ); grLn(); grWriteln( " g : increase gamma by 0.1" ); @@ -159,7 +203,7 @@ FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); FTDemo_Update_Current_Flags( handle ); - FTDemo_String_Set( handle, Text ); + FTDemo_String_Set( handle, status.text ); } @@ -250,6 +294,18 @@ static void + event_text_change( void ) + { + static int i = 0; + + status.text = Sample[i]; + + i++; + if ( i >= (int)( sizeof( Sample ) / sizeof( Sample[0] ) ) ) + i = 0; + } + + static void event_gamma_change( double delta ) { int i; @@ -406,6 +462,11 @@ event_color_change(); break; + case grKeyTab: + event_text_change(); + FTDemo_String_Set( handle, status.text ); + break; + case grKEY( 'V' ): sc->vertical = !sc->vertical; status.header = sc->vertical @@ -595,7 +656,7 @@ case 'm': if ( *argc < 3 ) usage( execname ); - Text = optarg; + status.text = optarg; break; case 'r': @@ -690,10 +751,14 @@ grSetTitle( display->surface, "FreeType String Viewer - press ? for help" ); + status.header = NULL; + + if ( !status.text ) + event_text_change(); + event_color_change(); event_gamma_change( 0 ); event_font_change( 0 ); - status.header = 0; do { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftvalid.1 new/ft2demos-2.7.1/src/ftvalid.1 --- old/ft2demos-2.7/src/ftvalid.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftvalid.1 2016-12-30 21:32:35.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTVALID 1 "September 2016" "FreeType 2.7" +.TH FTVALID 1 "December 2016" "FreeType 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftview.1 new/ft2demos-2.7.1/src/ftview.1 --- old/ft2demos-2.7/src/ftview.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftview.1 2016-12-30 21:32:35.000000000 +0100 @@ -1,4 +1,4 @@ -.TH FTVIEW 1 "September 2016" "FreeType 2.7" +.TH FTVIEW 1 "December 2016" "FreeType 2.7.1" . . .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ftview.c new/ft2demos-2.7.1/src/ftview.c --- old/ft2demos-2.7/src/ftview.c 2016-08-26 11:45:49.000000000 +0200 +++ new/ft2demos-2.7.1/src/ftview.c 2016-10-29 00:11:51.000000000 +0200 @@ -88,7 +88,7 @@ int width; int height; int render_mode; - FT_Encoding encoding; + unsigned long encoding; int res; int ptsize; /* current point size, 26.6 format */ @@ -126,6 +126,8 @@ static FTDemo_Display* display; static FTDemo_Handle* handle; + static unsigned long FT_ENC_TAG( FT_ENCODING_OTHER, 'o', 't', 'h', 'e' ); + /* In UTF-8 encoding: @@ -200,7 +202,7 @@ FT_UInt glyph_idx; - if ( handle->encoding == FT_ENCODING_NONE ) + if ( status.encoding == FT_ENCODING_NONE ) glyph_idx = (FT_UInt)i; else glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); @@ -308,7 +310,7 @@ FT_UInt glyph_idx; - if ( handle->encoding == FT_ENCODING_NONE ) + if ( status.encoding == FT_ENCODING_NONE ) glyph_idx = (FT_UInt)i; else glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); @@ -385,7 +387,7 @@ FT_UInt glyph_idx; - if ( handle->encoding == FT_ENCODING_NONE ) + if ( status.encoding == FT_ENCODING_NONE ) glyph_idx = (FT_UInt)i; else glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); @@ -489,7 +491,7 @@ FT_UInt glyph_idx; - if ( handle->encoding == FT_ENCODING_NONE ) + if ( status.encoding == FT_ENCODING_NONE ) glyph_idx = (FT_UInt)i; else glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); @@ -808,19 +810,19 @@ grWriteln( "PgUp, PgDn adjust size by 10 units (in mode 4) " ); grWriteln( " " ); grWriteln( "Left, Right adjust index by 1 L cycle through " ); - grWriteln( "F7, F8 adjust index by 10 LCD filtering " ); - grWriteln( "F9, F10 adjust index by 100 [, ] select custom LCD " ); - grWriteln( "F11, F12 adjust index by 1000 filter weight " ); + grWriteln( "F7, F8 adjust index by 16 LCD filtering " ); + grWriteln( "F9, F10 adjust index by 256 [, ] select custom LCD " ); + grWriteln( "F11, F12 adjust index by 4096 filter weight " ); grWriteln( " (if custom filtering) " ); grWriteln( "h toggle hinting -, +(=) adjust selected custom " ); grWriteln( "H cycle through hinting LCD filter weight " ); grWriteln( " engines (if available) " ); grWriteln( "f toggle forced auto- g, v adjust gamma value " ); grWriteln( " hinting (if hinting) " ); - grWriteln( "w toggle warping (in light " ); - grWriteln( " AA mode, if available) q, ESC quit ftview " ); + grWriteln( "w toggle warping (in light Tab cycle through charmaps " ); + grWriteln( " AA mode, if available) " ); grWriteln( " " ); - grWriteln( "a toggle anti-aliasing " ); + grWriteln( "a toggle anti-aliasing q, ESC quit ftview " ); /* |----------------------------------| |----------------------------------| */ grLn(); grLn(); @@ -1037,6 +1039,63 @@ static int + event_encoding_change( void ) + { + PFont font = handle->fonts[status.font_idx]; + FT_Face face; + + + if ( status.encoding != FT_ENCODING_NONE ) + font->cmap_index++; + else + font->cmap_index = 0; + + error = FTC_Manager_LookupFace( handle->cache_manager, + handle->scaler.face_id, &face ); + + if ( font->cmap_index < face->num_charmaps ) + { + status.encoding = face->charmaps[font->cmap_index]->encoding; + status.offset = 0x20; + + if ( status.encoding == FT_ENCODING_NONE ) /* OTHER, really */ + status.encoding = FT_ENCODING_OTHER; + } + else + { + status.encoding = FT_ENCODING_NONE; + status.offset = 0; + } + + switch ( status.encoding ) + { + case FT_ENCODING_NONE: + font->num_indices = face->num_glyphs; + break; + + case FT_ENCODING_UNICODE: + font->num_indices = 0x110000L; + break; + + case FT_ENCODING_ADOBE_LATIN_1: + case FT_ENCODING_ADOBE_STANDARD: + case FT_ENCODING_ADOBE_EXPERT: + case FT_ENCODING_ADOBE_CUSTOM: + case FT_ENCODING_APPLE_ROMAN: + font->num_indices = 0x100L; + break; + + /* some fonts use range 0x00-0x100, others have 0xF000-0xF0FF */ + case FT_ENCODING_MS_SYMBOL: + default: + font->num_indices = 0x10000L; + } + + return 1; + } + + + static int event_font_change( int delta ) { int num_indices; @@ -1195,6 +1254,10 @@ status.update = 1; break; + case grKeyTab: + status.update = event_encoding_change(); + break; + case grKEY( 's' ): if ( status.render_mode == RENDER_MODE_SLANTED ) status.update = event_slant_change( 0.02 ); @@ -1273,22 +1336,22 @@ status.update = event_index_change( 1 ); break; case grKeyF7: - status.update = event_index_change( -10 ); + status.update = event_index_change( -0x10 ); break; case grKeyF8: - status.update = event_index_change( 10 ); + status.update = event_index_change( 0x10 ); break; case grKeyF9: - status.update = event_index_change( -100 ); + status.update = event_index_change( -0x100 ); break; case grKeyF10: - status.update = event_index_change( 100 ); + status.update = event_index_change( 0x100 ); break; case grKeyF11: - status.update = event_index_change( -1000 ); + status.update = event_index_change( -0x1000 ); break; case grKeyF12: - status.update = event_index_change( 1000 ); + status.update = event_index_change( 0x1000 ); break; case grKEY( 'L' ): @@ -1514,6 +1577,8 @@ case FT_ENCODING_APPLE_ROMAN: encoding = "Apple Roman"; break; + default: + encoding = "Other"; } grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, encoding, display->fore_color ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ft2demos-2.7/src/ttdebug.1 new/ft2demos-2.7.1/src/ttdebug.1 --- old/ft2demos-2.7/src/ttdebug.1 2016-09-08 10:06:57.000000000 +0200 +++ new/ft2demos-2.7.1/src/ttdebug.1 2016-12-30 21:32:35.000000000 +0100 @@ -1,4 +1,4 @@ -.TH TTDEBUG 1 "September 2016" "FreeType 2.7" +.TH TTDEBUG 1 "December 2016" "FreeType 2.7.1" . . .SH NAME
