--- freetype-2.4.12.orig/debian/copyright +++ freetype-2.4.12/debian/copyright @@ -0,0 +1,439 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: freetype +Upstream-Contact: freetype-devel@nongnu.org +Source: http://www.freetype.org/download.html + +Files: * +Copyright: 1996-2012 David Turner, Robert Wilhelm, and Werner Lemberg + 1996-2009 Just van Rossum + 2002-2012 Roberto Alameda + 2003 Huw D M Davies for Codeweavers + 2003-2012 Masatake YAMATO, Redhat K.K. + 2004-2012 Albert Chin-A-Young + 2004-2012 Suzuki Toshiya + 2007 Dmitry Timoshkov for Codeweavers + 2007-2011 Rahul Bhalerao + 2007-2012 Derek Clegg, Michael Toftdal + 2009-2011 Oran Agra, Mickey Gabel + 2010, 2012 Joel Klinghed +License: GPL-2+ or FTL + +Files: debian/* +Copyright: 1996-2012 Christoph Lameter , + Anthony Fok , + Steve Langasek , et al. +License: GPL-2+ + +Files: freetype-*/vms_make.com +Copyright: 2001, 2002 Catharon Productions Inc. http://www.catharon.com/ +License: Catharon-OSL + +Files: freetype-*/src/gzip/* +Copyright: 1995-2002 Jean-loup Gailly and Mark Adler +License: GZip + +Files: freetype-*/src/gzip/ftgzip.c +Copyright: 2002-2006, 2009-2012 David Turner, Robert Wilhelm, Werner Lemberg +License: GPL-2+ or FTL + +Files: freetype-*/src/tools/ftrandom/ftrandom.c +Copyright: 2005-2008 George Williams +License: BSD-3-Clause + +Files: freetype-*/src/pcf/* freetype-*/src/bdf/* +Copyright: 2000-2012 Francesco Zappa Nardelli + 2000 Computing Research Labs, New Mexico State University +License: BSD-2-Clause + +Files: freetype-*/src/pcf/pcfutil.c +Copyright: 1990, 1994, 1998 The Open Group +License: OpenGroup-BSD-like + +License: GPL-2+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA. + . + On Debian GNU/Linux systems, the complete text of the GNU General + Public License version 2 can be found in + `/usr/share/common-licenses/GPL-2'. + +License: BSD-2-Clause + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License: BSD-3-Clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + . + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + . + The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: OpenGroup-BSD-like + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation. + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + . + Except as contained in this notice, the name of The Open Group shall not be + used in advertising or otherwise to promote the sale, use or other dealings + in this Software without prior written authorization from The Open Group. + +License: GZip + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + . + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + . + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +License: FTL + The FreeType Project LICENSE + ---------------------------- + . + 2000-Feb-08 + . + Copyright 1996-2000 by + David Turner, Robert Wilhelm, and Werner Lemberg + . + . + . + Introduction + ============ + . + The FreeType Project is distributed in several archive packages; + some of them may contain, in addition to the FreeType font engine, + various tools and contributions which rely on, or relate to, the + FreeType Project. + . + This license applies to all files found in such packages, and + which do not fall under their own explicit license. The license + affects thus the FreeType font engine, the test programs, + documentation and makefiles, at the very least. + . + This license was inspired by the BSD, Artistic, and IJG + (Independent JPEG Group) licenses, which all encourage inclusion + and use of free software in commercial and freeware products + alike. As a consequence, its main points are that: + . + o We don't promise that this software works. However, we will be + interested in any kind of bug reports. (`as is' distribution) + . + o You can use this software for whatever you want, in parts or + full form, without having to pay us. (`royalty-free' usage) + . + o You may not pretend that you wrote this software. If you use + it, or only parts of it, in a program, you must acknowledge + somewhere in your documentation that you have used the + FreeType code. (`credits') + . + We specifically permit and encourage the inclusion of this + software, with or without modifications, in commercial products. + We disclaim all warranties covering The FreeType Project and + assume no liability related to The FreeType Project. + . + . + Legal Terms + =========== + . + 0. Definitions + -------------- + . + Throughout this license, the terms `package', `FreeType Project', + and `FreeType archive' refer to the set of files originally + distributed by the authors (David Turner, Robert Wilhelm, and + Werner Lemberg) as the `FreeType Project', be they named as alpha, + beta or final release. + . + `You' refers to the licensee, or person using the project, where + `using' is a generic term including compiling the project's source + code as well as linking it to form a `program' or `executable'. + This program is referred to as `a program using the FreeType + engine'. + . + This license applies to all files distributed in the original + FreeType Project, including all source code, binaries and + documentation, unless otherwise stated in the file in its + original, unmodified form as distributed in the original archive. + If you are unsure whether or not a particular file is covered by + this license, you must contact us to verify this. + . + The FreeType Project is copyright (C) 1996-2000 by David Turner, + Robert Wilhelm, and Werner Lemberg. All rights reserved except as + specified below. + . + 1. No Warranty + -------------- + . + THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO + USE, OF THE FREETYPE PROJECT. + . + 2. Redistribution + ----------------- + . + This license grants a worldwide, royalty-free, perpetual and + irrevocable right and license to use, execute, perform, compile, + display, copy, create derivative works of, distribute and + sublicense the FreeType Project (in both source and object code + forms) and derivative works thereof for any purpose; and to + authorize others to exercise some or all of the rights granted + herein, subject to the following conditions: + . + o Redistribution of source code must retain this license file + (`LICENSE.TXT') unaltered; any additions, deletions or changes + to the original files must be clearly indicated in + accompanying documentation. The copyright notices of the + unaltered, original files must be preserved in all copies of + source files. + . + o Redistribution in binary form must provide a disclaimer that + states that the software is based in part of the work of the + FreeType Team, in the distribution documentation. We also + encourage you to put an URL to the FreeType web page in your + documentation, though this isn't mandatory. + . + These conditions apply to any software derived from or based on + the FreeType Project, not just the unmodified files. If you use + our work, you must acknowledge us. However, no fee need be paid + to us. + . + 3. Advertising + -------------- + . + Neither the FreeType authors and contributors nor you shall use + the name of the other for commercial, advertising, or promotional + purposes without specific prior written permission. + . + We suggest, but do not require, that you use one or more of the + following phrases to refer to this software in your documentation + or advertising materials: `FreeType Project', `FreeType Engine', + `FreeType library', or `FreeType Distribution'. + . + As you have not signed this license, you are not required to + accept it. However, as the FreeType Project is copyrighted + material, only this license, or another one contracted with the + authors, grants you the right to use, distribute, and modify it. + Therefore, by using, distributing, or modifying the FreeType + Project, you indicate that you understand and accept all the terms + of this license. + . + 4. Contacts + ----------- + . + There are two mailing lists related to FreeType: + . + o freetype@freetype.org + . + Discusses general use and applications of FreeType, as well as + future and wanted additions to the library and distribution. + If you are looking for support, start in this list if you + haven't found anything to help you in the documentation. + . + o devel@freetype.org + . + Discusses bugs, as well as engine internals, design issues, + specific licenses, porting, etc. + . + o http://www.freetype.org + . + Holds the current FreeType web page, which will allow you to + download our latest development version and read online + documentation. + . + You can also contact us individually at: + . + David Turner + Robert Wilhelm + Werner Lemberg + +License: Catharon-OSL + The Catharon Open Source LICENSE + ---------------------------- + . + 2000-Jul-04 + . + Copyright (C) 2000 by Catharon Productions, Inc. + . + . + . + Introduction + ============ + . + This license applies to source files distributed by Catharon + Productions, Inc. in several archive packages. This license + applies to all files found in such packages which do not fall + under their own explicit license. + . + This license was inspired by the BSD, Artistic, and IJG + (Independent JPEG Group) licenses, which all encourage inclusion + and use of free software in commercial and freeware products + alike. As a consequence, its main points are that: + . + o We don't promise that this software works. However, we are + interested in any kind of bug reports. (`as is' distribution) + . + o You can use this software for whatever you want, in parts or + full form, without having to pay us. (`royalty-free' usage) + . + o You may not pretend that you wrote this software. If you use + it, or only parts of it, in a program, you must acknowledge + somewhere in your documentation that you have used the + Catharon Code. (`credits') + . + We specifically permit and encourage the inclusion of this + software, with or without modifications, in commercial products. + We disclaim all warranties covering the packages distributed by + Catharon Productions, Inc. and assume no liability related to + their use. + . + . + Legal Terms + =========== + . + 0. Definitions + -------------- + . + Throughout this license, the terms `Catharon Package', `package', + and `Catharon Code' refer to the set of files originally + distributed by Catharon Productions, Inc. + . + `You' refers to the licensee, or person using the project, where + `using' is a generic term including compiling the project's source + code as well as linking it to form a `program' or `executable'. + This program is referred to as `a program using one of the + Catharon Packages'. + . + This license applies to all files distributed in the original + Catharon Package(s), including all source code, binaries and + documentation, unless otherwise stated in the file in its + original, unmodified form as distributed in the original archive. + If you are unsure whether or not a particular file is covered by + this license, you must contact us to verify this. + . + The Catharon Packages are copyright (C) 2000 by Catharon + Productions, Inc. All rights reserved except as specified below. + . + 1. No Warranty + -------------- + . + THE CATHARON PACKAGES ARE PROVIDED `AS IS' WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OF OR THE INABILITY TO + USE THE CATHARON PACKAGE. + . + 2. Redistribution + ----------------- + . + This license grants a worldwide, royalty-free, perpetual and + irrevocable right and license to use, execute, perform, compile, + display, copy, create derivative works of, distribute and + sublicense the Catharon Packages (in both source and object code + forms) and derivative works thereof for any purpose; and to + authorize others to exercise some or all of the rights granted + herein, subject to the following conditions: + . + o Redistribution of source code must retain this license file + (`license.txt') unaltered; any additions, deletions or changes + to the original files must be clearly indicated in + accompanying documentation. The copyright notices of the + unaltered, original files must be preserved in all copies of + source files. + . + o Redistribution in binary form must provide a disclaimer that + states that the software is based in part on the work of + Catharon Productions, Inc. in the distribution documentation. + . + These conditions apply to any software derived from or based on + the Catharon Packages, not just the unmodified files. If you use + our work, you must acknowledge us. However, no fee need be paid + to us. + . + 3. Advertising + -------------- + . + Neither Catharon Productions, Inc. and contributors nor you shall + use the name of the other for commercial, advertising, or + promotional purposes without specific prior written permission. + . + We suggest, but do not require, that you use the following phrase + to refer to this software in your documentation: 'this software is + based in part on the Catharon Typography Project'. + . + As you have not signed this license, you are not required to + accept it. However, as the Catharon Packages are copyrighted + material, only this license, or another one contracted with the + authors, grants you the right to use, distribute, and modify it. + Therefore, by using, distributing, or modifying the Catharon + Packages, you indicate that you understand and accept all the + terms of this license. --- freetype-2.4.12.orig/debian/changelog +++ freetype-2.4.12/debian/changelog @@ -0,0 +1,1543 @@ +freetype (2.4.12-0ubuntu1.1ppa3infinality20130515) saucy; urgency=low + + * Ignore compiler warnings + * Add infinality patch + * Disable subpixel patch + * Use infinality patch + * Ignore extra symbols + + -- Bob Chez Tue, 18 Mar 2014 20:50:56 -0400 + +freetype (2.4.12-0ubuntu1.1) saucy-security; urgency=medium + + * SECURITY UPDATE: denial of service and possible code execution in + CFF rasterizer + - debian/patches-freetype/CVE-2014-2240.patch: validate hintMask in + src/cff/cf2hints.c. + - CVE-2014-2240 + * SECURITY UPDATE: denial of service in CFF rasterizer + - debian/patches-freetype/CVE-2014-2241.patch: don't trigger asserts in + src/cff/cf2ft.c. + - CVE-2014-2241 + + -- Marc Deslauriers Thu, 13 Mar 2014 12:52:16 -0400 + +freetype (2.4.12-0ubuntu1) saucy; urgency=low + + * New upstream version (lp: #1179523) + * debian/patches-freetype/git_unitialized_variable.patch, + debian/patches-ft2demos/init_variables.patch: + - fix an unitialized variable warnings which were breaking the build + * debian/libfreetype6.symbols: updated + + -- Sebastien Bacher Mon, 13 May 2013 13:12:42 +0200 + +freetype (2.4.11-0ubuntu1) raring; urgency=low + + * New upstream version + * debian/patches-freetype/CVE-2012-5668.patch, + debian/patches-freetype/CVE-2012-5669.patch, + debian/patches-freetype/CVE-2012-5670.patch: + - dropped, those fixes are in the new version + * debian/patches-ft2demos/compiler_hardening_fixes.patch: + - changed unsigned char* to char* to fix "pointer targets in assignment + differ in signedness" build error + * debian/libfreetype6.symbols: updated for the new version + + -- Sebastien Bacher Fri, 08 Feb 2013 12:50:09 +0100 + +freetype (2.4.10-0ubuntu2) raring; urgency=low + + * SECURITY UPDATE: denial of service and possible code execution via NULL + pointer dereference + - debian/patches-freetype/CVE-2012-5668.patch: reset props_size in case + of allocation error in src/bdf/bdflib.c. + - CVE-2012-5668 + * SECURITY UPDATE: denial of service and possible code execution via heap + buffer over-read in BDF parsing + - debian/patches-freetype/CVE-2012-5669.patch: use correct array size + in src/bdf/bdflib.c. + - CVE-2012-5669 + * SECURITY UPDATE: denial of service and possible code execution via out- + of-bounds write + - debian/patches-freetype/CVE-2012-5670.patch: normalize negative + parameter in src/bdf/bdflib.c. + - CVE-2012-5670 + + -- Marc Deslauriers Mon, 14 Jan 2013 13:24:57 -0500 + +freetype (2.4.10-0ubuntu1) quantal; urgency=low + + * New upstream version + * debian/libfreetype6.symbols: + - new version update + * debian/patches-freetype/savannah-bug-35847.patch, + debian/patches-freetype/savannah-bug-35833.patch: + - dropped, the fixes are in the new version + * Resynchronize on Debian, remaining diff: + * debian/patches-freetype/revert_scalable_fonts_metric.patch: + - revert commit "Fix metrics on size request for scalable fonts.", + it's breaking gtk underlining markups and creating some other + issues as well (lp: #972223) + + -- Sebastien Bacher Fri, 03 Aug 2012 13:57:01 +0200 + +freetype (2.4.9-1) unstable; urgency=low + + * New upstream release + - upstream fix for multiple vulnerabilities: CVE-2012-1126, + CVE-2012-1133, CVE-2012-1134, CVE-2012-1136, CVE-2012-1142, + CVE-2012-1144. and others. Closes: #662864. + - update symbols file for a new symbol, ft_raccess_guess_table + * debian/patches-freetype/savannah-bug-35847.patch, + debian/patches-freetype/savannah-bug-35833.patch: pull two bugfixes from + upstream git on top of 2.4.9, to address regressions affecting + ghostscript. Thanks to Till Kamppeter for pointing this out. + * push CPPFLAGS into CFLAGS for ft2demos, so our demos will be secure. + Closes: #663613. + * don't let a quiltrc override our QUILT_PATCHES settings in debian/rules. + Closes: #617217. + * Migrate debian/copyright to copyright-format 1.0, and fix up the upstream + URL. Closes: #642059. + + -- Steve Langasek Sat, 24 Mar 2012 23:35:16 +0000 + +freetype (2.4.8-1) unstable; urgency=high + + * New upstream release + - upstream fix for CVE-2011-3439. Closes: #649122. + - adjust libfreetype6.symbols for a newly-exported function. + + -- Steve Langasek Thu, 17 Nov 2011 22:28:14 +0000 + +freetype (2.4.7-2) unstable; urgency=low + + * Use dpkg-buildflags through debhelper. + * Don't set -Werror in CFLAGS on alpha or m68k, to work around a compiler + bug. Closes: #646334. + + -- Steve Langasek Mon, 24 Oct 2011 22:02:32 +0000 + +freetype (2.4.7-1) unstable; urgency=low + + * New upstream release + - upstream fix for CVE-2011-3256. Closes: #646120. + - drop debian/patches-freetype/0001-Fix-Savannah-bug-33992.patch, + included upstream. + * Pass --without-bzip2 to configure, to avoid unwanted dependency on + libbz2. Closes: #639638. + * Standards-Version 3.9.2. + + -- Steve Langasek Sat, 22 Oct 2011 20:18:59 +0000 + +freetype (2.4.6-2) unstable; urgency=low + + * debian/patches-freetype/0001-Fix-Savannah-bug-33992.patch: [PATCH] + Fix Savannah bug #33992. Thanks to David Bevan + . Closes: #638348. + + -- Steve Langasek Sat, 20 Aug 2011 06:30:18 +0000 + +freetype (2.4.6-1) unstable; urgency=low + + * New upstream release + - fixes CVE-2011-0226, a vulnerability in parsing of Type 1 fonts. + Closes: #635871. + - upstream now builds cleanly with -Werror and the new gcc-4.6 upstream + warnings. Closes: #625328. + + -- Steve Langasek Thu, 04 Aug 2011 05:49:09 +0000 + +freetype (2.4.4-2) unstable; urgency=low + + * Build for multiarch, using debhelper compat 9. + * Add Pre-Depends: ${misc:Pre-Depends} to pick up multiarch-support + dependency. + + -- Steve Langasek Wed, 22 Jun 2011 14:38:12 -0700 + +freetype (2.4.4-1) unstable; urgency=low + + * Acknowledge security NMU - thanks, Moritz! + * New upstream release, closes: #606286, #600321 + - fixes PDF rendering issues. Closes: #612484, LP: #709229. + - fixes a rendering issue with 'S' glyphs in certain fonts. + LP: #654010. + - drop patches for CVE-2010-3855 and CVE-2010-3814, applied upstream. + - drop patch ft2demos-2.1.7-ftbench.patch; doesn't apply cleanly, the + code has changed significantly, patch never forwarded upstream. If + this is still an issue, someone will provide a fixed patch. + - drop patch ft2demos-grkey.patch, fixed upstream. + * debian/patches-freetype/enable-gxvalid-otvalid.patch: enable the + otvalid and gxvalid table validation modules. Thanks to Paul Wise + . Closes: #520879, LP: #239626. + * debian/libfreetype6.symbols: update the symbols file for the same. + * debian/rules et al.: convert to dh 7 + * drop INSTALL.* from the libfreetype6-dev docs. Closes: #550971. + * move homepage out of debian/copyright and into debian/control. + * fix GPL link to point to GPL-2 explicitly. + * clean up long-obsolete conflicts/replaces. + * drop debian/README.quilt, redundant with debian/README.source. + * drop debian/README.Debian, which talks about the long-finished transition + from freetype1. + * strip dependency_libs out of /usr/lib/libfreetype.la. + * bump standards-version to 3.9.1. + + -- Steve Langasek Mon, 21 Feb 2011 14:10:46 -0800 + +freetype (2.4.2-2.1) unstable; urgency=medium + + * Non-maintainer upload by the Security Team. + * Fix CVE-2010-3855 and CVE-2010-3814 (Closes: #602221) + + -- Moritz Muehlenhoff Thu, 18 Nov 2010 21:16:12 +0100 + +freetype (2.4.2-2) unstable; urgency=low + + * debian/patches-ft2demos/f2tdemos-grkey.patch: update to fix another + problem when building under gcc-4.5 that was overlooked in the previous + version of the patch. LP: #624740. + + -- Steve Langasek Sat, 28 Aug 2010 02:27:15 +0000 + +freetype (2.4.2-1) unstable; urgency=high + + * New upstream release + - High urgency upload for RC security bugfix. + - Corrects a stack overflow in the interpreter for CFF fonts + (CVE-2010-1797). Closes: #592399. + - drop debian/patches-freetype/opentype-missing-glyphs, included + upstream. + * Update libfreetype6.symbols for two new functions. + + -- Steve Langasek Tue, 10 Aug 2010 00:19:04 -0700 + +freetype (2.4.0-2) unstable; urgency=medium + + * debian/patches-freetype/opentype-missing-glyphs: fix from upstream for + glyphs from OpenType fonts failing to render. Closes: #589256, + LP: #605858. + * Medium-urgency upload to fix important regression. + + -- Steve Langasek Fri, 16 Jul 2010 12:37:03 -0700 + +freetype (2.4.0-1) unstable; urgency=high + + * New upstream release (closes: #572576). + - fixes CVE-2010-2497, CVE-2010-2498, CVE-2010-2499, CVE-2010-2500, + CVE-2010-2519, and CVE-2010-2520 + - high-urgency upload for security bugfixes. + - drop debian/patches-freetype/freetype-bytecode-interpreter.patch and + debian/patches-freetype/enable-full-bytecode-interpreter - the + bytecode interpreter is now enabled by default upstream at last! + - drop debian/patches-freetype/freetype-bdflib-large-encodings.patch and + debian/patches-freetype/uninitialized-vars.patch, applied upstream. + - drop debian/patches-freetype/331-hmtx-no-shorts.diff, implemented + differently upstream. + - new symbol FT_Library_SetLcdFilterWeights added to the symbols table, + bump the shlibs. + - fixes problem with outlines for some OpenType fonts. Closes; #583868. + * Add a debian/watch file - though we won't use it internally due to the + multiple tarball issues. + * Begin to simplify debian/rules a little by trimming dead code. + * Don't set SHELL = /bin/bash in debian/rules, no bashisms found in + the current package. + * debian/patches/ft2demos-grkey.patch: don't point grKEY() at an enum when + it's being passed values that aren't defined in that enum, fixing a build + failure with gcc 4.5. Thanks to Brian M. Carlson for the preliminary + patch. Closes: #564989. + * docs/PATENTS no longer exists, so we don't install it. + * Add ${misc:Depends} substitutions to all packages, per lintian. + * Standards-Version to 3.8.4, no changes required. + * Clarify in debian/copyright that freetype can be used under GPLv2 or + later. + + -- Steve Langasek Tue, 13 Jul 2010 17:09:32 -0700 + +freetype (2.3.11-1) unstable; urgency=low + + * New upstream release + - drop debian/patches-freetype/proper-armel-asm-declaration.patch and + debian/patches-freetype/CVE-2009-0946.patch, applied upstream. + - new symbol tt_cmap13_class_rec added to the symbols table, bump the + shlibs. + + -- Steve Langasek Mon, 12 Oct 2009 14:14:49 -0700 + +freetype (2.3.9-5) unstable; urgency=low + + * Pass proper --host/--build args to ./configure, to support + cross-building. Closes: #465292. + * clean up a number of unused variables in debian/rules; maybe someday + we'll get this package to converge on debhelper 7... :) + * Fix the doc-base section for libfreetype6-dev. Closes: #315845. + * Remove one final reference to /usr/X11R6 in debian/rules. + * Drop incorrect Replaces: freetype0, freetype1 + * Add debian/README.source, documenting the madness that is this source + package. + * Standards-Version to 3.8.0. + * Fix multiple integer overflows leading to arbitrary code execution + or DoS (CVE-2009-0946; Closes: #524925). Thanks to Nico Golde for the + NMU. + + -- Steve Langasek Mon, 01 Jun 2009 04:37:19 -0700 + +freetype (2.3.9-4) unstable; urgency=low + + * debian/patches-ft2demos/compiler-hardening-fixes.patch: always check the + return value of fread(), to appease hardened compilers such as what's + used in Ubuntu by default. Set a good example, even if these demos + shouldn't be security-sensitive! Also, along the way catch and fix a + small memory leak on error. :) + * debian/patches-freetype/proper-armel-asm-declaration.patch: use __asm__ + for declaring assembly instead of asm, fixing a build failure on armel. + + -- Steve Langasek Sat, 14 Mar 2009 14:35:23 -0700 + +freetype (2.3.9-3) unstable; urgency=low + + * Drop spurious Suggests: on libfreetype6-dev. Closes: #363937. + * debian/patches-freetype/enable-subpixel-rendering.patch: enable subpixel + rendering features, used by libcairo and xft to provide LCD colour + filtering. This is considered no more or less evil than the bytecode + interpreter which we also enable. + * Move debian/libfreetype6.copyright to debian/copyright, and selectively + install it to the single binary package in debian/rules; the same + copyright file is used for all the binaries anyway via symlinks, so + there's no reason it shouldn't ship as debian/copyright. + Closes: #381228. + * Clip redundant LICENSE.TXT and GPL.TXT files from the + libfreetype6-dev package. Closes: #459802. + + -- Steve Langasek Fri, 13 Mar 2009 23:09:50 -0700 + +freetype (2.3.9-2) unstable; urgency=low + + * debian/rules: bump the shlibs version, since 2.3.9 introduces a handful + of new symbols + * debian/libfreetype6.symbols: add a new symbols file, which should cause + most packages to have relaxed dependencies of libfreetype6 now. + + -- Steve Langasek Fri, 13 Mar 2009 16:57:23 -0700 + +freetype (2.3.9-1) unstable; urgency=low + + * New upstream version; closes: #519168. + * fixes a SIGFPE in evince when displaying some PDFs. Closes: #494350, + LP: #277294. + * fix a rendering issue with embedded Myriad_Pro fonts in some PDFs. + LP: #330438. + * fix a rendering issue with some glyphs not rendering in PDFs when + an embedded font uses CID 0. LP: #252250. + * drop patches-freetype/no-segfault-on-load_mac_face, included + upstream. + * patches-ft2demos/ft2demos-2.1.7-ftbench.patch: drop unused + patch chunk + * fix up the get-orig-source target to autodetect the upstream version + using the changelog by default. + + -- Steve Langasek Fri, 13 Mar 2009 01:07:28 -0700 + +freetype (2.3.7-2) unstable; urgency=high + + * High-urgency upload for RC bugfix. + * Add debian/patches-freetype/no-segfault-on-load_mac_face, patch from + upstream to fix a segfault due to uninitialized memory in certain + failures of FT_Stream_New. Closes: #487101. + + -- Steve Langasek Thu, 21 Aug 2008 12:09:17 -0700 + +freetype (2.3.7-1) unstable; urgency=low + + * New upstream release + * Add a new get-orig-source rule to handle downloading & packing the bits + for us + * Build-depend on x11proto-core-dev instead of the obsolete x-dev. + * Unset DH_VERBOSE when redirecting the output of dh_shlibdeps, + otherwise the substvars are kinda messed up. + * Fix a typo that caused debhelper log junk to be dumped into /usr. + * Replace ${Source-Version} with ${binary:Version} in debian/control. + * Don't install useless copies of /usr/share/doc/libfreetype6 in the + other packages, the symlink is all we need. + + -- Steve Langasek Mon, 30 Jun 2008 17:57:56 -0700 + +freetype (2.3.6-1) unstable; urgency=low + + * New upstream release + - Fixes multiple vulnerabilities in the PFB font parser (CVE-2008-1806, + CVE-2008-1807, CVE-2008-1808). Closes: #485841. + * Fix some very bizarre quoting of $CFLAGS in debian/rules + + -- Steve Langasek Sun, 15 Jun 2008 23:52:53 -0700 + +freetype (2.3.5-1) unstable; urgency=low + + * New upstream release + - Drop patches 374902-composite-glyphs, CVE-2006-3467_pcf-strlen, + and CVE-2007-2754_ttgload, merged upstream. + - Bump the shlibs to 2.3.5 for new symbols. + + -- Steve Langasek Sat, 07 Jul 2007 00:19:30 -0700 + +freetype (2.2.1-6) unstable; urgency=high + + * High-urgency upload for security fix. + * Remove spurious patch file from the package diff, sigh. + * Add debian/patches-freetype/CVE-2007-2754_ttgfload to address + CVE-2007-2754, a bug allowing execution of arbitrary code via a crafted + TTF image by way of an integer overflow. Closes: #425625. + + -- Steve Langasek Wed, 23 May 2007 03:26:25 -0700 + +freetype (2.2.1-5) unstable; urgency=high + + * High-urgency upload for RC bugfix. + * Add debian/patches-freetype/CVE-2006-3467_pcf-strlen.patch to + address CVE-2006-3467, a missing string length check in PCF files that + leads to a possibly exploitable integer overflow. Thanks to Martin + Pitt for the patch. Closes: #379920. + + -- Steve Langasek Tue, 12 Sep 2006 15:04:42 -0700 + +freetype (2.2.1-4) unstable; urgency=low + + * Drop libfreetype6.postinst code for cleaning up /usr/X11R6/lib; + whatever version it applied to is pre-sarge, and this code is + sufficiently blunt that I don't think it should be kept around. + Closes: #386379. + + -- Steve Langasek Fri, 8 Sep 2006 13:35:30 -0700 + +freetype (2.2.1-3) unstable; urgency=low + + * Apply patch from Eugeniy Meshcheryakov , applied + upstream, to fix bug in rendering of composite glyphs. + Closes: #374902. + + -- Steve Langasek Sun, 3 Sep 2006 04:21:43 -0500 + +freetype (2.2.1-2) unstable; urgency=low + + * Enable full bytecode interpreter instead of just the + "non-patented portions". + * Use $(CURDIR) instead of $(PWD) to build with sudo. Closes: #367579. + + -- Keith Packard Wed, 17 May 2006 00:00:35 -0500 + +freetype (2.2.1-1) unstable; urgency=low + + * New upstream release + - Supersedes patches freetype-2.1.10-cvsfixes.patch, + freetype-2.1.10-fixaliasing.patch, freetype-2.1.10-fixautofit.patch, + freetype-2.1.10-fixkerning.patch, freetype-2.1.10-memleak.patch, + freetype-2.1.10-xorgfix.patch + + -- Steve Langasek Sat, 13 May 2006 13:57:54 -0700 + +freetype (2.2~rc4-1) unstable; urgency=low + + * New upstream release + - this version should restore binary compatibility with version + 2.1.7. Closes: #314385. + - use the old ft2demos and freetype-docs for now; patch ft2demos + (temporarily only!) to still use the internal headers, which are + now no longer exported as part of the API + * Patch to handle empty short metrics, as seen in BitStream Vera. + * Bump shlibs to 2.2~rc4-1. Closes: #316031. + * Replace debian/rules patch handling with quilt; thanks to Jurij + Smakov for the patch. + + -- Steve Langasek Sat, 4 Mar 2006 22:06:38 -0800 + +freetype (2.1.10-3) unstable; urgency=low + + * Removed freetype-2.1.10-fixaliasing.patch to restore proper sub-pixel + anti-aliased hinted rendering. Thanks to Michael Biebl for reporting + the bug. I was able to reproduce the bug setting gnome-font-properties + to: 96 dpi, sub-pixel anti-aliasing, full hinting, with Bitstream Vera + Sans Roman 11 as desktop font. (Closes: Bug#359104) + * Added more fixes to debian/patches/freetype-2.1.10-cvsfixes.patch: + * 2006-03-27 David Turner + * src/sfnt/ttkern.c (tt_face_get_kerning): Fix a serious bug that + causes some programs to go into an infinite loop when dealing with + fonts that don't have a properly sorted kerning sub-table. + * 2006-03-21 Zhe Su + * src/base/ftoutln.c (FT_Outline_Get_Orientation): Improve algorithm. + This is to prevent certain emboldened and hinted glyphs from becoming + "weird". See https://bugzilla.novell.com/show_bug.cgi?id=158573 + for details. + * Oops, I inadvertently set the shlibs dependency to (>= 2.1.10-1) + in 2.1.10-2. Reverted to (>= 2.1.5-1). + + -- Anthony Fok Fri, 31 Mar 2006 04:11:27 +0800 + +freetype (2.1.10-2) unstable; urgency=low + + * Will Newton has agreed to let Steve Langasek adopt the package. + Therefore, I have taken the liberty to set the Maintainer field + to Steve, and to add myself as an uploader. :-) (See Bug#351821) + + * Acknowledge NMUs by Frans Pop (shlibs for udeb, Closes: Bug#355939) + and by Joey Hess (xlibs-dev removal, Closes: Bug#346706). + Thank you all! + + * Merge fixes from 2.1.10-1ubuntu1 (Many thanks!): + * Patches for Malone #5560. + [debian/patches/freetype-2.1.10-cvsfixes.patch]: + - various fixes (mostly embolding which caused characters to + slant upward, most evident for CJK users in KDE and icewm. + (Closes: Bug#356495, Bug#356854) + [debian/patches/freetype-2.1.10-xorgfix.patch]: + - put back internal API used by xorg-x11 + [debian/patches/freetype-2.1.10-fixautofit.patch]: + - fix autofit render setup + [debian/patches/freetype-2.1.10-memleak.patch]: + - fix memleak + [debian/patches/freetype-2.1.10-fixkerning.patch]: + - fix disabled kerning + [debian/patches/freetype-2.1.10-fixaliasing.patch]: + - fix anti-aliasing rendering + * Changes by Jun Kobayashi + -- Jonathan Riddell Mon, 16 Jan 2006 17:45:50 +0900 + + -- Anthony Fok Sat, 25 Mar 2006 13:03:09 +0800 + +freetype (2.1.10-1.2) unstable; urgency=low + + * Non Maintainer Upload (closes: #355939) + * Add support for udeb dependency resolution in shlibs file + * Simplify debian/rules by making use of udeb support in debhelper + * Update debhelper compatibility to level 5 + + -- Frans Pop Sat, 18 Mar 2006 17:07:46 +0100 + +freetype (2.1.10-1.1) unstable; urgency=low + + * NMU + * Patch from Ben Hutchings for xlibs-dev transition. Closes: #346706 + + -- Joey Hess Sun, 5 Mar 2006 20:31:17 -0500 + +freetype (2.1.10-1) unstable; urgency=low + + * New upstream (Closes: #298660, #245532). + * New maintainer, co-maintainer required! + * Disable CJK autohinting patch due to incompatability with this version + of freetype. + * Remove some very old unapplied patches. + * Add freetype-config.1 manpage. + * Add doc-base file for development docs. (Closes: #280827) + * Fix build with non-default umask. (Closes: #307464, #166511) + * Patch merged upstream. (Closes: #252673) + * Acknowledge NMUS. + (Closes: #221597, #225119, #226380, #249443, #251473, #302269, #259875) + + -- Will Newton Mon, 13 Jun 2005 00:44:29 +0100 + +freetype (2.1.9-1) unstable; urgency=low + + * New upstream. + + -- Will Newton Sat, 28 May 2005 14:49:00 +0100 + +freetype (2.1.7-2.4) unstable; urgency=high + + * Non-maintainer upload. + * freetype-2.1.7/src/bdf/bdflib.c: When a glyph has zero width or height, + a bitmap is not actually allocated for it, but the code used to try to + use it anyway. Now it no longer does that. Fix by Steve Langasek, + based on something I did earlier. Added + debian/patches/300-bdflib-zero-width-glyphs.diff. Closes: #302269 + (Segmentation fault with certain bdf fonts). + * freetype-2.1.7/src/bdf/bdflib.c: BDF font files with glyphs with an + encoding value of at least 65536 would overflow the bitmap with + 65536 bits which bdflib.c uses to keep track of whether it has seen + an encoding already. Changed things so that encodings above the + limit cause an error code to be returned instead of a segfault + happening. Ideally, the bitmap should be replaced with a more + compact representation, but that is too big a change for something + this small. I will, however, only lower the severity of the bug + (305413) to normal, instead of marking it fixed. Added + debian/patches/300-bdflib-large-encodings.diff. + + -- Lars Wirzenius Sun, 24 Apr 2005 15:42:00 +0300 + +freetype (2.1.7-2.3) unstable; urgency=low + + * NMU + * debian/patches/090-freetype-2.1.7-normalize-fix.diff: Patch + by David Mossberger. Backport from freetype2 CVS that fixes an + off-by-order-of-magnitude performance issue in the normalization code. + (Closes: #259875) + + -- dann frazier Mon, 08 Nov 2004 19:06:57 -0700 + +freetype (2.1.7-2.2) unstable; urgency=low + + * NMU + * debian/patches/080-freetype-2.1.7-backwards-compat.diff: Patch + by Shaun Jackman, integration by Thom May. Fixes backwards + compatibility (Closes: #251473) + + -- Frank Lichtenheld Fri, 6 Aug 2004 01:03:36 +0200 + +freetype (2.1.7-2.1) unstable; urgency=medium + + * NMU + * [debian/patches/patches/t1load-eexec.diff, debian/rules] Patch from + upstream CVS + (http://cvs.freetype.org/cgi-bin/viewcvs.cgi/freetype2/src/type1/t1load.c.diff?r1=text&tr2=1.89&tr1=1.88&r2=text&diff_format=u) + to fix hanging gpdf processes. (Closes: #249443, #233255) + + -- J.H.M. Dassen (Ray) Fri, 4 Jun 2004 18:56:41 +0200 + +freetype (2.1.7-2) unstable; urgency=low + + * Acknowledging 2.1.7-1.1. Many thanks to David Mosberger-Tang and + fellow Debian developer J.H.M. Dassen (Ray) for fixing the + gnumeric and abiword crashing problem on powerpc and ia64 + by compiling with -fno-strict-aliasing. Will report upstream. + * Applied Akito Hirai's freetype-2.1.7-autohint-cjkfonts-20031130.patch. + Thanks to Firefly's detailed testing and development, and to Shuke + (Fan Xiaoju) and Tetralet for building unofficial debs. :-) + - http://firefly.idv.tw/test/Forum.php?Board=1&Article=72498077a4859413781ed6885760caa7&Func=view&History=0 + - http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=51830 + * Converted changelog.Debian.gz to UTF-8. + * Removed /usr/share/doc/libfreetype6/reference/.cvsignore. + + -- Anthony Fok Sat, 24 Jan 2004 08:00:31 +0800 + +freetype (2.1.7-1.1) unstable; urgency=high + + * NMU + * [debian/control] Applied patch by David Mosberger-Tang + to compile -fno-strict-aliasing. Freetype + is apparently known to be unsafe for strict-aliasing rules defined + by ANSI (and the compiler configuration files in the upstream + source package itself reflect that), which caused crashes on ia64 + and powerpc. This patch has been confirmed to fix the gnumeric and + abiword crashes on powerpc. (Closes: #221597, #225119, #226380). + + -- J.H.M. Dassen (Ray) Tue, 6 Jan 2004 11:35:55 +0100 + +freetype (2.1.7-1) unstable; urgency=low + + * New upstream version. + + -- Anthony Fok Sat, 15 Nov 2003 00:49:55 +0800 + +freetype (2.1.5-3) unstable; urgency=high + + * debian/patches/freetype-2.1.5-type1-crash.diff: prevents + crashes when opening Type1 fonts with PaintType != 0 or + StrokeWidth != 0, exhibited with e.g. Hershey fonts in gsfonts-other. + Many thanks to Josselin Mouette (Debian fontconfig maintainer) for + analysis and patch! (Closes: Bug#216605, #216649, #216761) + * FTC_SBit_Cache_Lookup() exhibits a bug in ah_hinter_load_glyph + where FT_Render_Glyph may be called twice under some circumstances. + Many thanks to Ralf for reporting and upstream author Werner Lemberg + for fixing the bug. (Closes: Bug#213232, #208943, #209715) + * Added Conflicts: xpdf-reader (<< 1.00-4) to avoid problems with users + upgrading from Debian 3.0. Thanks to Adrian Bunk for the bug report. + (Partially fixes Bug#214732) + + -- Anthony Fok Wed, 22 Oct 2003 10:58:14 +0800 + +freetype (2.1.5-2) unstable; urgency=low + + * Added patch by David Bevan ([devel] 2003-09-19) to fix read_pfb_tag() + so it does not fail on end-of-file indicated (0x8003). + * Do not install the irrelevant docs/reference/README. (Closes: Bug#211755) + + -- Anthony Fok Sun, 21 Sep 2003 01:35:44 +0800 + +freetype (2.1.5-1) unstable; urgency=low + + * New upstream official 2.1.5 release. (ftdocs is still 2.1.4.) + * Set libfreetype6-udeb to Priority: extra to fix override disparity. + + -- Anthony Fok Tue, 16 Sep 2003 23:43:48 +0800 + +freetype (2.1.4-5) unstable; urgency=low + + * CVS updates as of 2003-08-18. Upstream has restored binary + compatibility with the FreeType 2.1.4 and previous releases. + * Applied patch by Mike Fabian (2003-08-27): check bdf properties + WEIGHT_NAME and SLANT case insensitively. Many thanks! :-) + * Reversed YAMANO-UCHI Hidetoshi's 2003-06-13 change to ft2demos + graph/x11/rules.mk; Debian shys away from setting rpath. + + -- Anthony Fok Thu, 28 Aug 2003 02:10:29 +0800 + +freetype (2.1.4-4) unstable; urgency=low + + * CVS updates as of 2003-06-07 with many fixes, including: + - Werner Lemberg has fixed the problem FreeType 2 had with + HuaTian multiple-level subglyphs fonts like htst3.ttf. + Many thanks! :-) + * TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING is left undefined for now. + (MS web core fonts like MonoType Arial would become distorted.) + * Disable Firefly's GRAYS_USE_GAMMA patch for now: I have received + several bug reports about "ugly fonts" or jaggies already, and I am + not sure whether it is due to the adjusted gamma values or + the new unpatented hinting in CVS. Let's see what happens. :-) + (Closes: Bug#196029, #196048, #196086) + * Yikes, Werner's number to pointer changes broke binary compatibility + with XFree86 4.3.0. I hope the patch + 100-freetype-2.1.4-CVS-int-fixed_p-incompatibility.diff + correctly reverts the problem. My apologies to the Debian XFree86 + for my oversight. + * FreeType 2.1.4 was unable to read some gzip'ed fonts Many thanks to + "Alexis S. L. Carvalho" for diagnosing and + correcting the problem. (Closes: Bug#184355) + * Note to self: Debian's file/libmagic1 (4.02-4) misdetects + libfreetype.so.6.3.3 as "Linux/i386 core" file on i386 platforms. + + -- Anthony Fok Sun, 8 Jun 2003 13:42:26 +0800 + +freetype (2.1.4-3) unstable; urgency=low + + * CVS updates as of 2003-06-01: + - Removed my 010-ft2demos-2.1.4-ucs4.diff and + Akito's 011-freetype-2.1.4-ttcmap4.diff: already applied upstream. + * [ftoption.h] Enabled Graham Asher's unpatented hinting: + #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER + #define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING + Many thanks to Graham Asher and Artifex for their contribution! + * Temporary disable Akito Hirai's CJK autohinting enhancement: it + currently does not apply cleanly to FreeType CVS. + * [libfreetype6-dev.files]: Added usr/lib/pkgconfig/ for freetype2.pc. + * Added Firefly's patch to #define GRAYS_USE_GAMMA with finetune. + + -- Anthony Fok Tue, 3 Jun 2003 02:54:40 +0800 + +freetype (2.1.4-2) unstable; urgency=low + + * Applied CVS fixes as of 2003-04-09. + * Applied freetype-2.1.3-ttcmap4.patch by Akito Hirai to handle buggy + Unicode CMap (cmap4) in CJK Dyna fonts. + * Applied Akito Hirai's autohinting enhancement for CJK fonts (2003-04-16). + + -- Anthony Fok Mon, 21 Apr 2003 01:48:07 +0800 + +freetype (2.1.4-1) unstable; urgency=low + + * New upstream release. + * The Section for libfreetype6-dev has been changed from devel to libdevel. + + -- Anthony Fok Tue, 8 Apr 2003 23:28:21 +0800 + +freetype (2.1.3+2.1.4rc2-5) unstable; urgency=low + + * FreeType 2.1.4 release candidate as of 2003-03-27. + * The rounding code in FT_Set_Char_Size() has been changed slightly + from 2.1.3+2.1.4rc2-4. Please test to see if native TrueType hinting + (with bytecode interpreter) still looks good. Thanks! + * Fine-tuned font->num_indices in ft2demos/src/ftcommon.i by encoding. + + -- Anthony Fok Mon, 31 Mar 2003 03:47:29 +0800 + +freetype (2.1.3+2.1.4rc2-4) unstable; urgency=low + + * FreeType 2.1.4rc2 with CVS update as of 2003-03-20. + * More rounding fixes from Artur Zaprzala. + * Reverted FT_Set_Char_Size() to forced rounding as before. This is + a temporary measure to get bytecode-interpreter hinted fonts display + properly. + + -- Anthony Fok Tue, 25 Mar 2003 01:34:15 +0800 + +freetype (2.1.3+2.1.4rc2-3) unstable; urgency=medium + + * The "Welcome to the world, Lucie Turner!" release. :-) + * FreeType 2.1.4rc2 with CVS update as of 2003-03-15. + * Upstream author David Turner has fixed src/truetype/ttdriver.c + (Set_Char_Sizes) rounding issues. The fonts on the screen should + look good as before now. (Closes: Bug#181938, #183794, #182674) + + -- Anthony Fok Sun, 16 Mar 2003 00:05:22 +0800 + +freetype (2.1.3+2.1.4rc2-2) unstable; urgency=medium + + * Reversed upstream author's 2003-02-25 patch on ttdriver.c: + - src/truetype/ttdriver.c (Set_Char_Sizes): fixed a rounding bug when + computing the scale factors for a given character size in points with + resolution. + + Not sure what how undoing this would affect autohinting, but at least + rendering with bytecode interpreter is back to normal. :-) + (Follow-up: Bug#181938, #183794, #182674, etc.) + + * Tests with David Chester's suggested patches, e.g. symmetric "m". + + * Added a fix for double free in the embedded bitmap code in freetype. + The bug was crashing OpenOffice.org. Thanks to Mandrake's Gwenole + Beauchesne for his suggested fix! (Follow-up: Bug#183272) + + -- Anthony Fok Thu, 13 Mar 2003 00:51:09 +0800 + +freetype (2.1.3+2.1.4rc2-1) unstable; urgency=low + + * FreeType 2.1.4rc2 with CVS update as of 2003-02-28: + - ft_gzip_file_done memory leak fix. (May fix #175889, #176138) + - scaling round-off error fix. May fix #182674, #181938. + - infinite loop fix in ftgzip.c. (Closes: Bug#177439) + * libfreetype6.postinst: Remove /usr/X11R6/lib/libfreetype.so* leftover + by some old version of XFree86 package. + * Added libfreetype6-udeb for the GTK frontend of the debian-installer. + Many thanks to Sebastian Ley for providing the appropriate patch! + (Closes: Bug#182208) + * freetype2-demos now depends on the exact version of libfreetype6. + (Closes: Bug#151233) + + -- Anthony Fok Wed, 5 Mar 2003 02:21:46 +0800 + +freetype (2.1.3-10) unstable; urgency=low + + * FreeType 2.1.4rc1 with CVS update as of 2003-02-18. (Closes: Bug#179450) + * Made 008-freetype-2.1.4rc1-ftccmap-ucs4.patch: + ftc_cmap_family_init() now, like find_unicode_charmap() in ftobjs.c, + favours UCS-4 charmap if there is one. + * Made 009-freetype-2.1.4rc1-typo.patch: + Minor typographical fixes, e.g. asian -> Asian. + * Made 010-ft2demos-2.1.4rc1-ucs4.patch: + Let ft2demos handle up to U+10FFFF. + + -- Anthony Fok Fri, 21 Feb 2003 02:59:12 +0800 + +freetype (2.1.3-9) unstable; urgency=low + + * Backed out David Turner's modified bluescale implementation (2.1.3-8) + and put back David Chester's original patch (2.1.3-7) until rendering + with bytecode interpreter turned on is improved. (See Bug#179450) + + -- Anthony Fok Mon, 3 Feb 2003 03:44:56 +0800 + +freetype (2.1.3-8) unstable; urgency=low + + * CVS update as of 2003-01-31. David Chester's bluescale patch is now + implemented upstream. Also, the excessive debug messages in 2.1.3-7 + should be gone now. + + -- Anthony Fok Sat, 1 Feb 2003 16:19:44 +0800 + +freetype (2.1.3-7) unstable; urgency=low + + * CVS update as of 2003-01-22. + * Added David Chester's latest bluescale2 patch. (2003-01-23 on the + FreeType devel mailing list.) + + -- Anthony Fok Sat, 25 Jan 2003 02:16:52 +0800 + +freetype (2.1.3-6) unstable; urgency=low + + * Oops, forgot to run aclocal as "aclocal -I ." to search for + ft-munmap.m4. Thanks to Werner Lemberg for the note. + + -- Anthony Fok Sat, 18 Jan 2003 22:45:19 +0800 + +freetype (2.1.3-5) unstable; urgency=low + + * CVS update as of 2003-01-17. + * Added a patch to relax table.Length checking because some buggy software + pads it to a multiple of 4 bytes. + (007-freetype-2.1.3-ttload-table-length.patch) + * Updated to latest libtool and regenerate configure so it builds properly + on mips/mipsel. Thanks to Ryan Murray for reporting the issue. + Also forwarded upstream. (Closes: Bug#176044) + + -- Anthony Fok Fri, 17 Jan 2003 07:52:25 +0800 + +freetype (2.1.3-4) unstable; urgency=high + + * Oops, forgot to add the corresponding Depends: zlib1g-dev | libz-dev + to libfreetype6-dev. Fixed. Thanks to Colin Walters for the reminder! + (Closes: Bug#174019) + + -- Anthony Fok Mon, 23 Dec 2002 12:51:41 +0800 + +freetype (2.1.3-3) unstable; urgency=high + + * With the previous CVS update, configure.ac was revised, but autoconf + was not run, leading to an unsubstituted @LIBZ@ in freetype-config. + My apologies for the problems it caused. (Closes: Bug#173834) + * Patched configure.ac and unix-cc.in to set LDFLAGS=-lz and to ensure + that libfreetype.so.* is explicitly linked with zlib. + * Added Build-Dependency: libz-dev, autoconf. (Note to self: remove + autoconf later.) + + -- Anthony Fok Sun, 22 Dec 2002 06:03:03 +0800 + +freetype (2.1.3-2) unstable; urgency=low + + * CVS updates as of 2002-12-18. + + -- Anthony Fok Sat, 21 Dec 2002 01:28:23 +0800 + +freetype (2.1.3-1) unstable; urgency=low + + * New upstream release. + * Revised my freetype-2.1.3-ttgload-monospace-halfwidth.patch to use + 52% as the threshold. + * New version supports gzipped PCF fonts. (Closes: Bug#163207) + + -- Anthony Fok Mon, 9 Dec 2002 01:36:21 +0800 + +freetype (2.1.2-10) unstable; urgency=low + + * Turning back on the bytecode interpreter. Too tired to care now. + May turn it off again when Xft2 and fontconfig are in Debian. + * Removed libkpathsea-dev build-dependency. It was used for the the + FreeType 1 contributed tools, but those tools were not yet ported + to FreeType 2. Also removed the 'debian/\' file. Thanks to + P. Doblerman for the bug report. (Closes: Bug#166064) + + -- Anthony Fok Thu, 24 Oct 2002 10:17:18 +0800 + +freetype (2.1.2-9) unstable; urgency=medium + + * By popular demand, disabled the ft-slight patch. Let's see what happens. + (Closes: Bug#164477) + + -- Anthony Fok Thu, 17 Oct 2002 23:37:36 +0800 + +freetype (2.1.2-8) unstable; urgency=low + + * CVS updates as of 2002-10-07 + * Applied David Chester's ft-slight patch. Thanks to Roger So for the + suggestion. (Closes: Bug#163900) + * Turned off the bytecode interpreter. + + -- Anthony Fok Fri, 11 Oct 2002 02:00:18 +0800 + +freetype (2.1.2-7) unstable; urgency=medium + + * CVS updates as of 2002-09-25 + * Revised ftbench.c to count by num_charcodes (cmap entries) instead of + face->num_glyphs. + * Oops, I forgot to uncomment dh_strip after a debug session! + Thanks to Daniel Burrows for catching this! (Closes: Bug#162346) + + -- Anthony Fok Thu, 26 Sep 2002 15:46:31 +0800 + +freetype (2.1.2-6) unstable; urgency=medium + + * CVS updates as of 2002-09-21 (after VER-2-1-3-RC2) + * Backported patches that I made for Thiz Linux, as listed below. + * Do not force horizontal.advance_Width_Max even when + postscript.isFixedPitch is true so that the ASCII characters in some + CJK fonts are displayed correctly. + * Revised my CMap4 patch to take care of tt_cmap4_char_index() and + tt_cmap4_char_next() too. (Closes: Bug#161933) + * ftbench allocates face->num_glyphs, but number of codepoints read + from CMap4 may be more, causing it to segfault with opens___.ttf. + Fixed. + + -- Anthony Fok Wed, 25 Sep 2002 09:45:14 +0800 + +freetype (2.1.2-5) unstable; urgency=high + + * CVS updates as of 2002-09-05 + * Fixed some typos in ftimage.h introduced in VER-2-1-3-RC1, + e.g. s/zft_outline_reverse_fill/ft_outline_reverse_fill/ + so that gnome-print may be built properly. Thanks to + Rick Younie, Christian Marillat and Kalle Olavi Niemitalo + for the bug report. (Closes: Bug#159806) + + -- Anthony Fok Sun, 8 Sep 2002 23:18:29 +0800 + +freetype (2.1.2-4) unstable; urgency=high + + * s/FT_ENCODING_SYMBOL/FT_ENCODING_MS_SYMBOL/ (typo) in freetype.h . + Thanks to Branden Robinson for tracking down the error. + (Closes: Bug#159375) + + -- Anthony Fok Tue, 3 Sep 2002 11:35:42 +0800 + +freetype (2.1.2-3) unstable; urgency=low + + * CVS updates as of 2002-08-29 (around VER-2-1-3-RC1) + * Make FreeType less strict when some slightly buggy fonts set + the CMap format 4 last segment idRangeOffset to 0xFFFF. + Thanks to Werner Lemberg and George Williams for pinpointing the bug. + (Fixes: Bug#150678, #155864) + + -- Anthony Fok Mon, 2 Sep 2002 05:53:48 +0800 + +freetype (2.1.2-2) unstable; urgency=low + + * Added CVS updates as of 2002-08-06. + * Werner Lemberg (one of the upstream authors) has fixed TTC reading + problem. Thanks to Kenshi Muto and Ishikawa Mutsumi for the report. + (Closes: Bug#154221) + * An extraneous /usr/X11R6/lib/libfreetype.so (not from this package) + was the culprit to some of the mysterious segmentation faults + that some users were experiencing. Thanks to Akira TAGOH for tracking + down the problem. (Closes: Bug#142674, #149472, #149759, #150596) + + -- Anthony Fok Fri, 9 Aug 2002 02:22:00 +0800 + +freetype (2.1.2-1) unstable; urgency=low + + * New upstream release with CVS updates as of 2002-07-11. + + -- Anthony Fok Mon, 15 Jul 2002 02:24:09 +0800 + +freetype (2.1.1-3) unstable; urgency=medium + + * Sync'ed with CVS as of 2002-06-16. + * "New version breaks Pango" was fixed by the newly recompiled + Pango package. (Thanks, Akira TAGOH! :-) (Closes: Bug#150039) + * Applied patches from Detlef Würkner (003-freetype-type1-cmap.patch, + 004-freetype-select-charmap.patch): the latter one fixes + the icon-text-disappears-in-Nautilus problem. Many thanks! + (Closes: Bug#150084) + * Applied patch from Sven Neumann (005-freetype-pfr-direction.patch). + Many thanks! + + -- Anthony Fok Wed, 19 Jun 2002 01:37:48 +0800 + +freetype (2.1.1-2) unstable; urgency=low + + * Up'ed versioned dependency to libfreetype6 (>= 2.1.1) because 2.1.1 + introduced some changes that is binary incompatible (but source + compatible) with previous versions, and Pango needs to be recompiled. + * Added fixes from CVS as of 2002-06-14. + * TOP became TOP_DIR + + -- Anthony Fok Sun, 16 Jun 2002 13:28:33 +0800 + +freetype (2.1.1-1) unstable; urgency=medium + + * New upstream release. + * Added versioned dependency to libfreetype6 (>= 2.1.0). Thanks to + Akira TAGOH for the suggestion. (Closes: Bug#140772, Bug#140821) + + -- Anthony Fok Fri, 14 Jun 2002 00:51:01 +0800 + +freetype (2.0.9-1) unstable; urgency=high + + * New upstream release. Among other enhancements, it contains this + important fix: + + - Certain fonts, like "foxjump.ttf" contain broken name tables with + invalid entries and wild offsets. This caused FreeType to crash when + trying to load them. + + Kudos to upstream author David Turner for fixing the bug so quickly! + + This bug causes gnome-print to crash for users with certain freeware + or shareware fonts, so please put in woody. Thanks! + (Closes: Bug#135654, Bug#135896) + + -- Anthony Fok Tue, 12 Mar 2002 01:43:14 +0800 + +freetype (2.0.8-1) unstable; urgency=medium + + * New upstream version. Contains a few more important bug fixes. + Please put in woody. Thanks! + * libfreetype6-dev now Depends on libc6-dev | libc-dev + (Closes: Bug#132640) + * Uses new configure script so that it builds on the netbsd-i386 + Debian port too. (Closes: Bug#132693) + + -- Anthony Fok Wed, 13 Feb 2002 03:35:52 +0800 + +freetype (2.0.7-1) unstable; urgency=medium + + * New upstream version. Reportedly fixes a problem that may KDE to + crash upon reading certain fonts. (Yes, please put in Debian 3.0). + * Applied upstream fix to freetype-config. + + -- Anthony Fok Tue, 5 Feb 2002 03:44:27 +0800 + +freetype (2.0.6-1) unstable; urgency=low + + * New upstream release with important bug fixes. + * Removed two Debian small patches as they have been applied upstream. + + -- Anthony Fok Mon, 14 Jan 2002 01:25:06 +0800 + +freetype (2.0.5-2) unstable; urgency=low + + * Oops, README and .cvsignore were erroneously placed in /usr/bin in + freetype2-demos. Thanks to YAMASHITA Junji for the bug report. + (Closes: Bug#119119) + + -- Anthony Fok Sun, 11 Nov 2001 23:55:40 +0800 + +freetype (2.0.5-1) unstable; urgency=low + + * New upstream release. + * Updated libfreetype6.copyright. + * Applied patch to builds/unix/freetype-config.in to prevent + /usr/bin/freetype-config from providing gcc with -L/usr/lib. + Thanks to Gordon Sadler for providing the patch. (Closes: Bug#101391) + * Added /usr/share/aclocal/freetype2.m4 for autoconf and friends. + in libfreetype6-dev. Thanks to Marcelo E. Magallon for contributing + this file. (Closes: Bug#117156) + + -- Anthony Fok Sat, 10 Nov 2001 13:10:25 +0800 + +freetype (2.0.2.20010514-1) unstable; urgency=low + + * New upstream snapshot, post-2.0.2 freetype2-current as of 2001-05-14. + * Silly me! I fixed the `missing "xlibs-dev" in Build-Depends' + in 2.0.2.20010422-2, but closed the wrong bug report!? + Thanks to Martin Schmitz for the bug report. (Closes: Bug#95328) + * libtool-1.4 is not 100% compatible with the libtool-1.3.5 included + in the upstream source. Also, it seems to be unnecessary to + Build-Depends on libtool, therefore removed. + Thanks to Laurent Bonnaud for the bug report. (Closes: Bug#97552) + * [ftoption.h]: #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER + + -- Anthony Fok Tue, 15 May 2001 16:49:26 -0600 + +freetype (2.0.2.20010422-2) unstable; urgency=medium + + * Hehe, silly me, I forgot to add "xlibs-dev" to Build-Depends + when I merged in freetype2-demos. Thanks to Martin Michlmayr + for the notice. Closes: Bug#94569. + + -- Anthony Fok Thu, 26 Apr 2001 21:20:17 -0600 + +freetype (2.0.2.20010422-1) unstable; urgency=low + + * Updated to post-2.0.2 freetype2-current as of 2001-04-22. + * On i386, freetype2-demos is rebuilt with xlibs_4.0.2-13 instead of the + pre-release xlibs_4.0.3. My apologies. + * Replaced "tetex-dev" with "libkpathsea-dev" in Build-Depends. + Thanks to Michael Schmitz for the bug report. Closes: Bug#91897. + * Updated README.Debian to reflect the FreeType 1.x package name + change from freetype2{,-dev} [sic] to libttf{2,-dev}. + + -- Anthony Fok Mon, 23 Apr 2001 23:08:51 -0600 + +freetype (2.0.2.20010412-1) unstable; urgency=low + + * New upstream release, post-2.0.2 freetype2-current as of 2001-04-12. + * Arnd Bergmann, Tom Kacvinsky et al. pinpointed and fixed a bug + in FreeType-2.0.2 which caused KDE and "xterm -fa" to segfault. + Thanks guys! :-) Closes: Bug#89326. + * New binary package: freetype2-demos. + * The source package reorganized to include three upstream tarballs + (freetype, ftdocs, ft2demos) in one *.orig.tar.gz. + + -- Anthony Fok Fri, 13 Apr 2001 02:02:42 -0600 + +freetype (2.0.1.20010317-1) unstable; urgency=low + + * Updated to freetype2-current as of 2001-03-17. + * [builds/unix/install.mk]: + - IMHO, the current upstream source caters too much to broken + compilers that the Unix build suffers somewhat. + - Use sed to replace all instances of + + with FT2_{PUBLIC,CONFIG,INTERNAL}_FILE(*.h), which currently + expands to + in freetype/config/ftheader.h and freetype/internal/internal.h. + - This fix, without sacrificing compatibility on some brain-dead + compilers on other platforms, may mean that + "-I/usr/include/freetype2" is no longer needed on Unix/Linux/Hurd + platforms. + - But it would be very foolish to remove "-I/usr/include/freetype2". + Thou shalt always use $(shell freetype-config --cflags). + - Thanks to Gordon Sadler for the suggestion. :-) + Closes: Bug#79951. + * [builds/unix/ft2unix.h]: + - Removed the FT2_{PUBLIC,CONFIG,INTERNAL}_FILE macros because + they are already defined in freetype/config/ftheader.h. + - Use FT2_ROOT instead. Afterall, cpp on Unix is not broken. ;-) + - Thanks to Takuo Kitame for reporting the conflicting #define's. + Closes: Bug#89363. + * [debian/rules]: Moved out some old cruft to rules.museum. + + -- Anthony Fok Mon, 19 Mar 2001 03:27:14 -0700 + +freetype (2.0.1.20010312-1) unstable; urgency=low + + * Updated to freetype2-current as of 2001-03-12. + * [debian/control]: + - Build-Depends: debhelper (>= 3.0.0), ... + - Standards-Version: 3.5.2 + + -- Anthony Fok Fri, 16 Mar 2001 02:21:31 -0700 + +freetype (2.0.1.20010308-1) unstable; urgency=low + + * Updated to freetype2-current as of 2001-03-08. + * Corrected platform detection on Hurd. Thanks to Jeff Bailey, + Werner and David for the fix. Closes: Bug#87691. + + -- Anthony Fok Fri, 9 Mar 2001 00:50:12 -0700 + +freetype (2.0.1-1) unstable; urgency=low + + * New upstream release. + + -- Anthony Fok Fri, 1 Dec 2000 17:58:32 -0700 + +freetype (2.0-1) unstable; urgency=low + + * New upstream FreeType 2 official release. + - Source package: freetype + - Binary packages: libfreetype6 and libfreetype6-dev. + The source package of FreeType 1.3.1 has been renamed to freetype1. + * [README.Debian]: Documents the source and binary package names, + and recommends users to migrate to FreeType 2. + + -- Anthony Fok Mon, 20 Nov 2000 05:16:13 -0700 + +freetype (1.3.1-1) unstable; urgency=low + + * New official upstream release. + * [contrib/ttf2pfb/ttf2pfb.c]: Applied patch by fellow Debian developer + Daniel Jacobowitz to fix a va_arg problem that prevents it from + building on powerpc. Thanks a million! :-) (closes: Bug#54539) + + -- Anthony Fok Mon, 10 Jan 2000 06:12:51 -0700 + +freetype (1.3.1-0) unstable; urgency=low + + * New upstream release candidate (1999-12-08). + * [debian/rules]: Uses "dh_makeshlibs -V 'freetype2 (>= 1.3.1)'" + because 1.3 have some new APIs not in 1.2. Thanks to suggestion + by ISHIKAWA Mutsumi (closes: Bug#52319). + * Added new entries for Arphic PL fonts in /etc/ttf2pk/ttfonts.map + * Modified UBig5.sfd to suit the Big5 Arphic PL fonts. + + -- Anthony Fok Sun, 12 Dec 1999 11:13:20 -0700 + +freetype (1.3-2) unstable; urgency=low + + * Corrected the symlink + /usr/share/doc/freetype2/changelog.gz -> docs/changes.txt + to -> docs/changes.txt.gz. (Hehe, major oversight. :-) + Thanks to Michael Osamu Shiobara for the bug report. + (closes: Bug#50428) + + -- Anthony Fok Wed, 17 Nov 1999 04:10:41 -0700 + +freetype (1.3-1) unstable; urgency=low + + * New upstream release (libttf.so.2.2.0) with patches as of 1999-10-21. + * Standards-Version: 3.1.0 + * Removed debian/freetype2-dev.compress because debhelper-2.0.69 + no longer compresses *.png. + * Backed out the patch applied by Anthony Wong to + contrib/ttf2pfb/configure in freetype_1.2-6.1 because upstream fixed + ttf2pfb.c to #include "extend/ftxpost.h" rather than "ftxpost.h". + Nonetheless, thanks for the NMU! :-) + * [debian/rules]: FHS-compliancy and general clean-up + - s/pre-binary/install/g; and removed install-stamp. + - s!usr/doc!usr/share/doc!g; + - Referred to the latest /usr/doc/debhelper/examples/rules* + and used DH_OPTIONS to reduce clutter. + - Oops! I used bashism but set "SHELL = /bin/sh". Changed to + "SHELL = /bin/bash". :-) + - Install upstream docs/changes.txt as changelog.gz in the + freetype2 (shared library) package. + + -- Anthony Fok Sun, 14 Nov 1999 01:15:21 -0700 + +freetype (1.2-6.1) unstable; urgency=low + + * Non-maintainer upload (see bug #38813) + * Added 'CPPFLAGS= ... -I$srcdir/../../lib/extend' to + contrib/ttf2pfb/configure, otherwise compile will fail for + ftxpost.h cannot be found. + * license.txt.gz is not shipped (lintian complains) + + -- Anthony Wong Thu, 3 Jun 1999 02:04:44 +0800 + +freetype (1.2-6) unstable; urgency=low + + * Copied debian/postinst to debian/freetype-tools.postinst + so mktexlsr is (only) run for the freetype-tools package. + Thanks to Andrew for reporting this bug. (closes: Bug#36502) + * Added some more font entries to /etc/ttf2pk/ttfonts.map. + + -- Anthony Fok Thu, 22 Apr 1999 17:54:53 -0600 + +freetype (1.2-5) unstable; urgency=low + + * Applied upstream freetype-1.2-current.diff.gz as of 1999-04-09. + * [contrib/ttf2pfb/t1asm.c]: Incorporated patch for glibc 2.1 + donated by Hartmut Koptein . + (Taken from the t1utils package. :-) (closes: Bug#35742) + * [contrib/ttf2pk/filesrch.c]: Changed "DllImport" to "KPSEDLL" + (changes between kpathsea 3.2 and 3.3). Thanks Werner! :-) + * [debian/rules]: + - Replaced the for loop with a more verbose alternative to ensure + make stops when it encounters an error when building one of the + contrib programs. + - Renamed t1asm to t1asm-freetype, and getafm to getafm-freetype, + until they are merged with the ones in t1utils and psutils. + * freetype-tools now also Suggests: psutils (>= 1.17-7) + + -- Anthony Fok Mon, 12 Apr 1999 01:08:23 -0600 + +freetype (1.2-4) unstable; urgency=low + + * Rebuilt with glibc-2.1 and tetex-lib (shared kpathsea library). + * [debian/rules]: Changed usr/share/texmf to usr/lib/texmf + for the new FHS-compliant directory layout in teTeX. + * [debian/control]: freetype-tools now Suggests: tetex-bin + (>= 0.9.990310-1), t1utils (>= 1.2-2) + + -- Anthony Fok Mon, 5 Apr 1999 16:39:08 -0600 + +freetype (1.2-3) frozen unstable; urgency=low + + * Applied the upstream freetype-1.2-current.diff.gz as of 1999-01-18 + which fixes a nasty Raster bug occurs only when clipping very large + outlines to a small target bitmap or pixmap. + + -- Anthony Fok Tue, 19 Jan 1999 22:04:32 -0700 + +freetype (1.2-2) frozen unstable; urgency=low + + * Applied the upstream freetype-1.2-current.diff.gz as of 1998-12-27 + Mostly bug fixes. + * Added configure.in and Makefile.in for contrib/{ttf2pfb,ttfbanner}, + so these tools are now included in the freetype-tools package. + * [debian/control]: + - Removed the "<" and ">", and added a suggestion + to Debian-JP's X server with X-TT support in freetype2's + package description. + - Now freetype-tools also Suggests: t1utils, which contains + /usr/bin/t1asm that helps ttf2pfb create real .pfa and .pfb + files. (Also added a note in README.Debian.) + * Updated the upstream authors' e-mail addresses in "control" and + "copyright." + * [debian/changelog]: Add the changelog of the freetype (1.1-0.1) + non-maintainer release done by Marcelo E. Magallon + in June 1998. I forgot to do so back + then. Sorry! :-) + * Renamed debian/compress to debian/freetype2-dev.compress, so *.png + are no longer compressed to *.png.gz. + + -- Anthony Fok Tue, 29 Dec 1998 02:16:07 -0700 + +freetype (1.2-1) frozen unstable; urgency=low + + * New upstream release. + * Recompiled with libc6 (2.0.7u-7). + * [debian/control]: Updated to standards version 2.5.0.0 (no changes). + * [contrib/ttf2pk/configure.in]: Modified the order of the header + include paths to ensure that "-I./../../lib" is placed before + "-I/usr/include". Thanks to Roman.Hodek@informatik.uni-erlangen.de + for the bug report (forwarded upstream). (Fixes: #27920) + + -- Anthony Fok Sat, 5 Dec 1998 15:13:48 -0700 + +freetype (1.1-1998-09-12-2) unstable; urgency=low + + * [debian/postinst]: Oops, the command "ldconfig" somehow disappeared + in the last upload. Fixed. :-) + + -- Anthony Fok Sun, 11 Oct 1998 19:58:32 -0600 + +freetype (1.1-1998-09-12-1) unstable; urgency=low + + * New upstream development snapshot. + * Added "--with-kpathsea-dir=/usr" to ttf2pk's configure. + * [debian/rules]: + - TTF2PKINPUTS = usr/lib/texmf/ttf2pk + - TTF2TFMINPUTS = usr/lib/texmf/ttf2tfm + - *.sfd are now installed in $(TTF2PKINPUTS) and $(TTF2TFMINPUTS). + - $(TTF2PKINPUTS)/ttfonts.map is a symlink to /etc/ttf2pk/ttfonts.map. + * [debian/freetype-tools.conffiles]: Added /etc/ttf2pk/ttfonts.map. + * [debian/postinst]: Added #DEBHELPER#. + * [debian/freetype-tools.postinst]: Runs /usr/bin/mktexlsr if it exists. + * [debian/control]: freetype-tools now Suggests: tetex-bin (>= 0.9-1). + + -- Anthony Fok Sat, 12 Sep 1998 19:55:17 -0600 + +freetype (1.1-1998-08-29-1) unstable; urgency=low + + * New upstream development snapshot. + * Now installs ttf2bdf and ttf2pk's documentation. + ttf2pk/ttf2tfm's *.sfd files are now placed in /usr/lib/ttf2tfm. + * changelog.gz now points to the re-added commitlog.gz. + * Changed "numGlymphId" to "cmap4->numGlyphId" in lib/extend/ftxcmap.c. + + -- Anthony Fok Mon, 31 Aug 1998 04:37:57 -0600 + +freetype (1.1-1) unstable; urgency=low + + * New upstream release. The old freetype-1.0 source package has been + renamed to "freetype1" and is now obsolete. + * Upgraded to standards version 2.4.1.0 (no changes). + * The package soname has been upgraded from 1 to 2. (libttf.2) + * Updated the package descriptions according to freetype.spec. + * Since teTeX 0.9 and the new is in Debian, + ttf2pk is now compiled and included in freetype-tools. + * Added postinst to run ldconfig as per Debian Policy. (Lintian) + * [debian/control]: Added some package relationships w.r.t. freetype1: + - freetype2 -- Replaces: freetype1 + - freetype2-dev -- Conflicts: freetype1-dev + * [debian/rules]: + - /usr/lib/libttf.la is now installed in the freetype2-dev package. + - Moved the developer's documentation into the freetype2-dev package. + Thanks to "Marcelo E. Magallon" for suggestion. + - Added "--dpkg-shlibdeps-params=-Ldebian/tmp/DEBIAN/shlibs" to + dh_shlibdeps when packaging freetype-tools. + - Added patch from /usr/doc/lintian/libtool-workarounds.txt + to solve the -rpath problem. Debian's libtool-1.2 handles the -lc + problem quite nicely already, so that part of the patch is not used. + - Added a GNU GPL copyright statement at the top. :-) + * Ran libtoolize from the Debian libtool-1.2 package. This solves the + -lc problem. :-) config.guess and config.sub are taken from the ones + in /usr/share/automake/ though because they are newer. (Thanks to + the libtool bug report filed by Jim Pick for hints.) + * Removed debian/README.Debian. + + -- Anthony Fok Fri, 28 Aug 1998 03:49:21 -0600 + +freetype (1.1-0.1) unstable; urgency=low + + * New upstream version. Non-maintainer upload (I need this in order to + build new upstream version of gltt!) + * Applied patches from previous version. + * Applied libtool rpath fix patch and removed rpath from compilation + parameters. Changed ltconfig to provide inter-library dependencies. + * Upgraded to Standards 2.4.1 + * Changed package name to freetype2 and other control fields accordingly + (this could be a problem... what about packages that depend on + freetype1?) + * Added "Conflitcs: freetype1 (<= 1.0.0.1998-03-22-1)" to freetype-tools + because of the mo files freetype1 contains and that are now in + freetype-tools, alogn-side the programs that use the files. + + -- Marcelo E. Magallon Sat, 27 Jun 1998 15:59:36 -0600 + +freetype (1.0.0.1998-03-22-1) frozen unstable; urgency=low + + * New upstream snapshot bugfix release as of 1998-03-22. + - ttobjs.c: The storage area is now freed in Instance_Destroy, + because it's the place it should have been from the very start. + A very sick bug spotted by Ram. Thanks again !! - DavidT + - fixed a nasty allocation bug in ttf2tfm.c + - corrected a spelling error (strcpy->strcmp) in ttf2pk.c + - new email address for Werner Lemberg (wl@gnu.org) + - (again) a stupid error fixed in ttf2pk.c + - Some fixes to make the package compile smoothless with the make + program of Solaris. + - too much fixed in po/Makefile.in.in :-) + * /usr/doc/freetype/README.gz and /usr/lib/libttf.la are now installed. + + -- Anthony Fok Wed, 25 Mar 1998 16:18:50 -0700 + +freetype (1.0.0.1998-03-13-1) unstable; urgency=low + + * New upstream snapshot including upstream patch as of 1998-03-13. + + -- Anthony Fok Sun, 15 Mar 1998 15:04:10 -0700 + +freetype (1.0-1) unstable; urgency=low + + * New upstream release (including upstream patch as of 1998-02-17). + * Updated copyright and README.Debian. + * Upgraded to standards version 2.4.0.0 (no changes). + * Enabled gettext support. + * Added .PHONY targets in Makefile.in's. + * Added -lc for linking libttf.so* (Reported by Lintian). + * Various FreeType test programs now have man pages linked to + /usr/man/man7/undocumented.7.gz (Reported by Lintian). + * debian/control: Revised package description. + * debian/rules: Commented out dh_du. + * Moved /usr/include/freetype/freetype.h to /usr/include/freetype.h. + + -- Anthony Fok Wed, 18 Feb 1998 01:12:03 -0700 + +freetype (0.beta.1998.01.06-1) unstable; urgency=low + + * New upstream snapshot release. + * Thanks to the libtool patch posted by Hirotsugu Kakugawa + on the freetype-devel mailing list + (and some local tweaking), the Debian freetype package finally + provides the library and header files! Hurray! (Fixes Bug#16365) + * Splitted the package into freetype0, freetype0-dev and freetype-tools. + * Added debian/compress to ensure that /usr/doc/freetype0/image/*.png + are not compressed. + * Revised README.Debian. + + -- Anthony Fok Thu, 8 Jan 1998 20:46:14 -0700 + +freetype (0.beta.1997.12.25-1) unstable; urgency=low + + * New upstream snapshot release. + * Modified /usr/doc/freetype/copyright to include the new license.txt. + (Yes, FreeType's license has changed.) + * Have a blessed Merry Christmas! + + -- Anthony Fok Fri, 26 Dec 1997 11:26:25 -0700 + +freetype (0.beta.1997.12.16-1) unstable; urgency=low + + * New upstream release. + * /usr/bin/ttf_{lint,timer,view,zoom} no longer exists. The upstream + authors have renamed them as /usr/bin/{ftlint,fttimer,ftview,ftzoom} + and have also added other nifty test programs! :) + * debian/rules: Switched to debhelper. + * debian/control: Upgraded Standards-Version to 2.3.0.1 and increased + Priority to optional. :) + * Revised /usr/doc/freetype/copyright. FreeType is now truly DFSG-free! + (Fixes Bug#16030) + * Revised README.Debian. + * Changed my maintainer e-mail address to . :) + * Sorry, the library and header files are not yet included. + I have yet to learn how. :) + + -- Anthony Fok Wed, 17 Dec 1997 03:02:49 -0700 + +freetype (0.4-4) unstable; urgency=low + + * Corrected the freetype mailing-list server's address from + "@lists.tu-muenchen.de" to "@lists.lrz-muenchen.de" in the files + /usr/doc/freetype/readme.1st and license.txt. + * Improved the package description and added a URL link to the + FreeType Project Home Page + * Removed "Keywords", "Primary-site" and "Original-site" from the package's + description, but kept "Authors" and "Maintained-by" (Closed bug #12510). + + -- Anthony Fok Sun, 21 Sep 1997 18:24:42 -0600 + +freetype (0.4-3) unstable; urgency=low + + * Rebuilt with both libc6 and xlib6g (Fixes bug #12784). + * Updated to Standards-Version: 2.3.0.0. + + -- Anthony Fok Wed, 10 Sep 1997 21:57:20 -0600 + +freetype (0.4-2) unstable; urgency=low + + * Renamed /usr/bin/{lint,timer,view,zoom} to + /usr/bin/ttf_{lint,timer,view,zoom} to avoid name conflicts with other + programs (Fixes bugs #12096, #12136). + * Closed bug #11193 (freetype AR4 available). + + -- Anthony Fok Tue, 19 Aug 1997 17:53:32 -0600 + +freetype (0.4-1) unstable; urgency=low + + * New maintainer. + * New upstream release. + * Updated to Standards-Version: 2.2.0.0. + + -- Anthony Fok Mon, 11 Aug 1997 08:26:17 -0600 + +freetype (0.3-1) unstable; urgency=low + + * Upstream update. Sadly the envisioned Christmas target of an X truetype + rasterizer has been abandoned. + + -- Christoph Lameter Tue, 24 Dec 1996 12:52:24 -0800 + +freetype (0.1-1) unstable; urgency=low + + * Initial Release. + + -- Christoph Lameter Thu, 7 Nov 1996 11:51:45 -0800 --- freetype-2.4.12.orig/debian/README.source +++ freetype-2.4.12/debian/README.source @@ -0,0 +1,22 @@ +Because FreeType upstream distributes the source as a set of multiple +tarballs, the Debian package currently uses a tar-in-tar format, with +Debian changes managed using quilt and stored in two different +directories corresponding to the respective upstream tarballs: +debian/patches-freetype and debian/patches-ft2demos. + +To unpack the patched sources, run './debian/rules patch'. + +For general information on how to apply patches, modify patches, or +remove a patch, please see: + + /usr/share/doc/quilt/README.source + +To edit patches after unpacking, cd to the subdirectory for the +corresponding upstream tarball and use for QUILT_PATCHES either +QUILT_PATCHES=../debian/patches-freetype or +QUILT_PATCHES=../debian/patches-ft2demos. + +To upgrade to a new upstream version, run +./debian/rules get-orig-source ver=, which will +download the upstream tarballs and pack them into an .orig.tar.gz +according to the scheme used here. --- freetype-2.4.12.orig/debian/libfreetype6.install +++ freetype-2.4.12/debian/libfreetype6.install @@ -0,0 +1 @@ +usr/lib/*/*.so.* --- freetype-2.4.12.orig/debian/libfreetype6-dev.install +++ freetype-2.4.12/debian/libfreetype6-dev.install @@ -0,0 +1,7 @@ +usr/bin/freetype-config +usr/include/ +usr/lib/*/*.so +usr/lib/*/*.la +usr/lib/*/*.a +usr/lib/*/pkgconfig/ +usr/share/aclocal/ --- freetype-2.4.12.orig/debian/libfreetype6-udeb.dirs +++ freetype-2.4.12/debian/libfreetype6-udeb.dirs @@ -0,0 +1 @@ +usr/lib --- freetype-2.4.12.orig/debian/rules +++ freetype-2.4.12/debian/rules @@ -0,0 +1,142 @@ +#!/usr/bin/make -f +# +# This is free software; see the GNU General Public Licence +# version 2 or later for copying conditions. There is NO warranty. + +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) +DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) + +# Workaround for spurious error when building with gcc-4.4 +ifeq (,$(filter m68k alpha,$(DEB_HOST_ARCH))) +endif +export DEB_CFLAGS_MAINT_APPEND += $(shell dpkg-buildflags --get CPPFLAGS) + +# always abort if there are any problems with the symbols file +DPKG_GENSYMBOLS_CHECK_LEVEL = 1 +export DPKG_GENSYMBOLS_CHECK_LEVEL + +VERSION = $(shell dpkg-parsechangelog | sed -n -e's/^Version: //p') +ver := $(shell dpkg-parsechangelog | sed -n -e's/^Version: \(.*\)-[^-]\+/\1/p') + +freetype_ver := $(ver) +ftdocs_ver := $(ver) +ft2demos_ver := $(ver) +dependency = $(libpkg) (>= 2.4.0) + +freetype_u := freetype-$(freetype_ver) +ftdocs_u := freetype-doc-$(ftdocs_ver) +ftdocs_d := $(freetype_u) +ft2demos_u := ft2demos-$(ft2demos_ver) + +libpkg := libfreetype6 +devpkg := $(libpkg)-dev +docpkg := $(libpkg)-doc +demospkg := freetype2-demos +udebpkg := libfreetype6-udeb +docdir := usr/share/doc +freetype_config_man := $(CURDIR)/debian/freetype-config.man +freetype_config_sgml := $(CURDIR)/debian/freetype-config.man.sgml + +libdoc = FTL.TXT CHANGES TODO ft2faq.html + +%: + dh $@ + +unpack:: unpack-stamp +unpack-stamp:: + # Unpack upstream tarballs + @for i in $(freetype_u) $(ftdocs_u) $(ft2demos_u); do \ + if [ -f $$i.tar.bz2 ]; then \ + echo "Unpacking $$i.tar.bz2 ..."; \ + tar -x --bzip2 -f $$i.tar.bz2; \ + elif [ -f $$i.tar.gz ]; then \ + echo "Unpacking $$i.tar.gz ..."; \ + tar -x --gzip -f $$i.tar.gz; \ + else \ + echo "Error! $$i.tar.{bz2,gz} not found!"; \ + exit 1; \ + fi \ + done + ln -s $(ftdocs_d)/docs docs + touch unpack-stamp + +patch: unpack patch-stamp +patch-stamp: + cd $(freetype_u) \ + && QUILT_PATCHES=../debian/patches-freetype quilt --quiltrc /dev/null push -a + cd $(ft2demos_u) \ + && QUILT_PATCHES=../debian/patches-ft2demos quilt --quiltrc /dev/null push -a + touch patch-stamp + +override_dh_auto_configure: patch + dh_auto_configure -D $(freetype_u) -- --without-bzip2 + +override_dh_auto_build: + dh_auto_build -D $(freetype_u) + dh_auto_build -D $(ft2demos_u) -- TOP_DIR=../$(freetype_u) \ + OBJ_DIR=../$(freetype_u)/objs + docbook-to-man $(freetype_config_sgml) > $(freetype_config_man) + +override_dh_auto_clean: + rm -f $(freetype_config_man) + rm -f unpack-stamp patch-stamp + rm -rf $(freetype_u) $(ft2demos_u) docs + +override_dh_auto_install: + dh_auto_install -D $(freetype_u) --destdir=$(CURDIR)/debian/tmp + $(freetype_u)/builds/unix/libtool --mode=install \ + cp -av `find $(ft2demos_u)/bin -type f -perm -u=x -maxdepth 1` \ + $(CURDIR)/debian/$(demospkg)/usr/bin/ + sed -i -e'/dependency_libs/s/'.*'//' debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libfreetype.la + +override_dh_install: + dh_install --fail-missing + +override_dh_installdocs: +ifneq (,$(findstring $(libpkg), $(shell dh_listpackages))) + dh_installdocs -p$(libpkg) $(addprefix $(freetype_u)/docs/,$(libdoc)) + mkdir debian/$(libpkg)/$(docdir)/$(libpkg)/pcf + cp -a $(freetype_u)/src/pcf/README debian/$(libpkg)/$(docdir)/$(libpkg)/pcf/ +endif +ifneq (,$(findstring $(devpkg), $(shell dh_listpackages))) + dh_installdocs --link-doc=$(libpkg) -p$(devpkg) \ + -Xreference/README -Xreference/.gitignore \ + -XLICENSE.TXT -XGPL.TXT -XBUILD -XINSTALL \ + $(addprefix -X,$(libdoc)) \ + $(ftdocs_d)/docs/* +endif + dh_installdocs -N$(devpkg) -N$(libpkg) --link-doc=$(libpkg) + +override_dh_installchangelogs: +ifneq (,$(findstring $(libpkg), $(shell dh_listpackages))) + dh_installchangelogs -p$(libpkg) $(freetype_u)/ChangeLog +endif + +override_dh_makeshlibs: + dh_makeshlibs -V '$(dependency)' --add-udeb '$(udebpkg)' + +# This variable is used only by get-orig-source, which will normally only +# be run by maintainers. +URL = http://savannah.nongnu.org/download/freetype/ + +# Download the various upstream source tarballs and pack them into a +# single orig.tar.gz. Assumes wget and gpg are available. +get-orig-source: + @if [ ! -d "debian" ] ; then \ + echo 'Run this from the top directory of the Debian source' >&2; \ + exit 1; \ + fi + mkdir freetype-$(ver) + set -e; \ + cd freetype-$(ver); \ + for i in freetype freetype-doc ft2demos; do \ + wget $(URL)/$$i-$(ver).tar.bz2; \ + wget $(URL)/$$i-$(ver).tar.bz2.sig; \ + gpg --verify $$i-$(ver).tar.bz2.sig $$i-$(ver).tar.bz2 \ + && rm $$i-$(ver).tar.bz2.sig; \ + done + tar cf freetype_$(ver).orig.tar freetype-$(ver) + rm -rf freetype-$(ver) + gzip -9 freetype_$(ver).orig.tar + +.PHONY: unpack patch get-orig-source --- freetype-2.4.12.orig/debian/freetype2-demos.dirs +++ freetype-2.4.12/debian/freetype2-demos.dirs @@ -0,0 +1 @@ +usr/bin --- freetype-2.4.12.orig/debian/control +++ freetype-2.4.12/debian/control @@ -0,0 +1,85 @@ +Source: freetype +Section: libs +Priority: optional +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Steve Langasek +Uploaders: Anthony Fok , Keith Packard +Build-Depends: bzip2, debhelper (>= 8.9.4), docbook-to-man, gettext (>= 0.10.36-2), libx11-dev, x11proto-core-dev, libz-dev, quilt +Standards-Version: 3.9.2 +Homepage: http://www.freetype.org + +Package: libfreetype6 +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Multi-Arch: same +Description: FreeType 2 font engine, shared library files + The FreeType project is a team of volunteers who develop free, + portable and high-quality software solutions for digital typography. + They specifically target embedded systems and focus on bringing small, + efficient and ubiquitous products. + . + The FreeType 2 library is their new software font engine. It has been + designed to provide the following important features: + * A universal and simple API to manage font files + * Support for several font formats through loadable modules + * High-quality anti-aliasing + * High portability & performance + . + Supported font formats include: + * TrueType files (.ttf) and collections (.ttc) + * Type 1 font files both in ASCII (.pfa) or binary (.pfb) format + * Type 1 Multiple Master fonts. The FreeType 2 API also provides + routines to manage design instances easily + * Type 1 CID-keyed fonts + * OpenType/CFF (.otf) fonts + * CFF/Type 2 fonts + * Adobe CEF fonts (.cef), used to embed fonts in SVG documents with + the Adobe SVG viewer plugin. + * Windows FNT/FON bitmap fonts + . + This package contains the files needed to run programs that use the + FreeType 2 library. + . + Home Page: http://www.freetype.org/ + Authors: David Turner + Robert Wilhelm + Werner Lemberg + +Package: libfreetype6-dev +Architecture: any +Section: libdevel +Depends: libfreetype6 (= ${binary:Version}), libc6-dev | libc-dev, zlib1g-dev | libz-dev, ${misc:Depends} +Description: FreeType 2 font engine, development files + The FreeType project is a team of volunteers who develop free, + portable and high-quality software solutions for digital typography. + They specifically target embedded systems and focus on bringing small, + efficient and ubiquitous products. + . + This package contains all supplementary files (static library, headers + and documentation) you need to develop your own programs using the + FreeType 2 library. + +Package: freetype2-demos +Architecture: any +Section: utils +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: freetype-tools +Description: FreeType 2 demonstration programs + This package contains some demonstration programs and utilities + which showcase the features of the FreeType 2 font engine. + +Package: libfreetype6-udeb +XC-Package-Type: udeb +Priority: extra +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Section: debian-installer +Description: FreeType 2 font engine for the debian-installer + The FreeType project is a team of volunteers who develop free, + portable and high-quality software solutions for digital typography. + They specifically target embedded systems and focus on bringing small, + efficient and ubiquitous products. + . + This is the udeb package for use with the debian-installer. --- freetype-2.4.12.orig/debian/libfreetype6-udeb.install +++ freetype-2.4.12/debian/libfreetype6-udeb.install @@ -0,0 +1 @@ +usr/lib/*/*.so.* usr/lib --- freetype-2.4.12.orig/debian/compat +++ freetype-2.4.12/debian/compat @@ -0,0 +1 @@ +9 --- freetype-2.4.12.orig/debian/libfreetype6-dev.doc-base +++ freetype-2.4.12/debian/libfreetype6-dev.doc-base @@ -0,0 +1,10 @@ +Document: libfreetype6-dev +Title: FreeType 2 Development Documentation +Author: Various +Abstract: Development documentation for FreeType 2. +Section: Programming/C + +Format: HTML +Index: /usr/share/doc/libfreetype6/reference/ft2-index.html +Files: /usr/share/doc/libfreetype6/reference/*.html + --- freetype-2.4.12.orig/debian/freetype-config.man.sgml +++ freetype-2.4.12/debian/freetype-config.man.sgml @@ -0,0 +1,174 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + Will"> + Newton"> + 2005-06-09"> + 1"> + will@debian.org"> + + FREETYPE-CONFIG"> + + + Debian"> + GNU"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2005 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + show information about installed freetype2 libraries + + + + &dhpackage; + + + + + + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; command, + + &dhpackage; is a program that shows information + about the installed freetype2 libraries. + + + + OPTIONS + + The following options are supported: + + + + + + + + Show the prefix freetype2 was built with. The prefix may + be overridden by passing the argument PREFIX. + + + + + + + + Show the executable prefix freetype2 was built with. The + executable prefix may be overridden by passing the argument + EPREFIX. + + + + + + + Show the libtool version of the installed freetype2. + + + + + + + Show the FreeType version of the installed freetype2. + + + + + + + Show the compiler flags for linking to the installed freetype2. + + + + + + + Show the library name for linking with libtool. + + + + + + + Show the compiler flags for compiling against the installed freetype2. + + + + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (but may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the GNU Free Documentation + License, Version 1.1 or any later version published by the Free + Software Foundation; with no Invariant Sections, no Front-Cover + Texts and no Back-Cover Texts. + + +
+ + + + --- freetype-2.4.12.orig/debian/libfreetype6-dev.manpages +++ freetype-2.4.12/debian/libfreetype6-dev.manpages @@ -0,0 +1 @@ +debian/freetype-config.man --- freetype-2.4.12.orig/debian/libfreetype6.symbols +++ freetype-2.4.12/debian/libfreetype6.symbols @@ -0,0 +1,359 @@ +libfreetype.so.6 libfreetype6 #MINVER# + FTC_CMapCache_Lookup@Base 2.2.1 + FTC_CMapCache_New@Base 2.2.1 + FTC_ImageCache_Lookup@Base 2.2.1 + FTC_ImageCache_LookupScaler@Base 2.3.5 + FTC_ImageCache_New@Base 2.2.1 + FTC_Manager_Done@Base 2.2.1 + FTC_Manager_LookupFace@Base 2.2.1 + FTC_Manager_LookupSize@Base 2.2.1 + FTC_Manager_New@Base 2.2.1 + FTC_Manager_RemoveFaceID@Base 2.2.1 + FTC_Manager_Reset@Base 2.2.1 + FTC_Node_Unref@Base 2.2.1 + FTC_SBitCache_Lookup@Base 2.2.1 + FTC_SBitCache_LookupScaler@Base 2.3.5 + FTC_SBitCache_New@Base 2.2.1 + FT_Access_Frame@Base 2.2.1 + FT_Activate_Size@Base 2.2.1 + FT_Add_Default_Modules@Base 2.2.1 + FT_Add_Module@Base 2.2.1 + FT_Angle_Diff@Base 2.2.1 + FT_Atan2@Base 2.2.1 + FT_Attach_File@Base 2.2.1 + FT_Attach_Stream@Base 2.2.1 + FT_Bitmap_Convert@Base 2.2.1 + FT_Bitmap_Copy@Base 2.2.1 + FT_Bitmap_Done@Base 2.2.1 + FT_Bitmap_Embolden@Base 2.2.1 + FT_Bitmap_New@Base 2.2.1 + FT_CMap_Done@Base 2.2.1 + FT_CMap_New@Base 2.2.1 + FT_CeilFix@Base 2.2.1 + FT_ClassicKern_Free@Base 2.2.1 + FT_ClassicKern_Validate@Base 2.2.1 + FT_Cos@Base 2.2.1 + FT_DivFix@Base 2.2.1 + FT_Done_Face@Base 2.2.1 + FT_Done_FreeType@Base 2.2.1 + FT_Done_Glyph@Base 2.2.1 + FT_Done_GlyphSlot@Base 2.2.1 + FT_Done_Library@Base 2.2.1 + FT_Done_Memory@Base 2.2.1 + FT_Done_Size@Base 2.2.1 + FT_Extract_Frame@Base 2.2.1 + FT_Face_CheckTrueTypePatents@Base 2.3.5 + FT_Face_GetCharVariantIndex@Base 2.3.5 + FT_Face_GetCharVariantIsDefault@Base 2.3.5 + FT_Face_GetCharsOfVariant@Base 2.3.5 + FT_Face_GetVariantSelectors@Base 2.3.5 + FT_Face_GetVariantsOfChar@Base 2.3.5 + FT_Face_SetUnpatentedHinting@Base 2.3.5 + FT_FloorFix@Base 2.2.1 + FT_Forget_Frame@Base 2.2.1 + FT_Get_Advance@Base 2.3.9 + FT_Get_Advances@Base 2.3.9 + FT_Get_BDF_Charset_ID@Base 2.2.1 + FT_Get_BDF_Property@Base 2.2.1 + FT_Get_CID_From_Glyph_Index@Base 2.3.9 + FT_Get_CID_Is_Internally_CID_Keyed@Base 2.3.9 + FT_Get_CID_Registry_Ordering_Supplement@Base 2.3.5 + FT_Get_CMap_Format@Base 2.3.5 + FT_Get_CMap_Language_ID@Base 2.2.1 + FT_Get_Char_Index@Base 2.2.1 + FT_Get_Charmap_Index@Base 2.2.1 + FT_Get_FSType_Flags@Base 2.3.9 + FT_Get_First_Char@Base 2.2.1 + FT_Get_Gasp@Base 2.3.5 + FT_Get_Glyph@Base 2.2.1 + FT_Get_Glyph_Name@Base 2.2.1 + FT_Get_Kerning@Base 2.2.1 + FT_Get_Long@Base 2.2.1 + FT_Get_MM_Var@Base 2.2.1 + FT_Get_Module@Base 2.2.1 + FT_Get_Module_Interface@Base 2.2.1 + FT_Get_Multi_Master@Base 2.2.1 + FT_Get_Name_Index@Base 2.2.1 + FT_Get_Next_Char@Base 2.2.1 + FT_Get_PFR_Advance@Base 2.2.1 + FT_Get_PFR_Kerning@Base 2.2.1 + FT_Get_PFR_Metrics@Base 2.2.1 + FT_Get_PS_Font_Info@Base 2.2.1 + FT_Get_PS_Font_Private@Base 2.2.1 + FT_Get_PS_Font_Value@Base 2.4.8 + FT_Get_Postscript_Name@Base 2.2.1 + FT_Get_Renderer@Base 2.2.1 + FT_Get_Sfnt_Name@Base 2.2.1 + FT_Get_Sfnt_Name_Count@Base 2.2.1 + FT_Get_Sfnt_Table@Base 2.2.1 + FT_Get_Short@Base 2.2.1 + FT_Get_SubGlyph_Info@Base 2.2.1 + FT_Get_Track_Kerning@Base 2.2.1 + FT_Get_TrueType_Engine_Type@Base 2.2.1 + FT_Get_WinFNT_Header@Base 2.2.1 + FT_Get_X11_Font_Format@Base 2.2.1 + FT_GlyphLoader_Add@Base 2.2.1 + FT_GlyphLoader_CheckPoints@Base 2.2.1 + FT_GlyphLoader_CheckSubGlyphs@Base 2.2.1 + FT_GlyphLoader_CopyPoints@Base 2.2.1 + FT_GlyphLoader_CreateExtra@Base 2.2.1 + FT_GlyphLoader_Done@Base 2.2.1 + FT_GlyphLoader_New@Base 2.2.1 + FT_GlyphLoader_Prepare@Base 2.2.1 + FT_GlyphLoader_Reset@Base 2.2.1 + FT_GlyphLoader_Rewind@Base 2.2.1 + FT_GlyphSlot_Embolden@Base 2.2.1 + FT_GlyphSlot_Oblique@Base 2.2.1 + FT_GlyphSlot_Own_Bitmap@Base 2.2.1 + FT_Glyph_Copy@Base 2.2.1 + FT_Glyph_Get_CBox@Base 2.2.1 + FT_Glyph_Stroke@Base 2.2.1 + FT_Glyph_StrokeBorder@Base 2.2.1 + FT_Glyph_To_Bitmap@Base 2.2.1 + FT_Glyph_Transform@Base 2.2.1 + FT_Has_PS_Glyph_Names@Base 2.2.1 + FT_Hypot@Base 2.4.12 + FT_Init_FreeType@Base 2.2.1 + FT_Library_SetLcdFilter@Base 2.3.5 + FT_Library_SetLcdFilterWeights@Base 2.4.0 + FT_Library_Version@Base 2.2.1 + FT_List_Add@Base 2.2.1 + FT_List_Finalize@Base 2.2.1 + FT_List_Find@Base 2.2.1 + FT_List_Insert@Base 2.2.1 + FT_List_Iterate@Base 2.2.1 + FT_List_Remove@Base 2.2.1 + FT_List_Up@Base 2.2.1 + FT_Load_Char@Base 2.2.1 + FT_Load_Glyph@Base 2.2.1 + FT_Load_Sfnt_Table@Base 2.2.1 + FT_Lookup_Renderer@Base 2.2.1 + FT_MSB@Base 2.4.12 + FT_Match_Size@Base 2.2.1 + FT_Matrix_Invert@Base 2.2.1 + FT_Matrix_Multiply@Base 2.2.1 + FT_Matrix_Multiply_Scaled@Base 2.3.5 + FT_MulDiv@Base 2.2.1 + FT_MulDiv_No_Round@Base 2.2.1 + FT_MulFix@Base 2.2.1 + FT_New_Face@Base 2.2.1 + FT_New_GlyphSlot@Base 2.2.1 + FT_New_Library@Base 2.2.1 + FT_New_Memory@Base 2.2.1 + FT_New_Memory_Face@Base 2.2.1 + FT_New_Memory_Stream@Base 2.2.1 + FT_New_Size@Base 2.2.1 + FT_OpenType_Free@Base 2.2.1 + FT_OpenType_Validate@Base 2.2.1 + FT_Open_Face@Base 2.2.1 + FT_Outline_Check@Base 2.2.1 + FT_Outline_Copy@Base 2.2.1 + FT_Outline_Decompose@Base 2.2.1 + FT_Outline_Done@Base 2.2.1 + FT_Outline_Done_Internal@Base 2.2.1 + FT_Outline_Embolden@Base 2.2.1 + FT_Outline_EmboldenXY@Base 2.4.10 + FT_Outline_GetInsideBorder@Base 2.2.1 + FT_Outline_GetOutsideBorder@Base 2.2.1 + FT_Outline_Get_BBox@Base 2.2.1 + FT_Outline_Get_Bitmap@Base 2.2.1 + FT_Outline_Get_CBox@Base 2.2.1 + FT_Outline_Get_Orientation@Base 2.2.1 + FT_Outline_New@Base 2.2.1 + FT_Outline_New_Internal@Base 2.2.1 + FT_Outline_Render@Base 2.2.1 + FT_Outline_Reverse@Base 2.2.1 + FT_Outline_Transform@Base 2.2.1 + FT_Outline_Translate@Base 2.2.1 + FT_Property_Get@Base 2.4.11 + FT_Property_Set@Base 2.4.11 + FT_Raccess_Get_DataOffsets@Base 2.2.1 + FT_Raccess_Get_HeaderInfo@Base 2.2.1 + FT_Raccess_Guess@Base 2.2.1 + FT_Read_Stream@Base 2.2.1 + FT_Read_Stream_At@Base 2.2.1 + FT_Reference_Face@Base 2.4.2 + FT_Reference_Library@Base 2.4.2 + FT_Release_Frame@Base 2.2.1 + FT_Remove_Module@Base 2.2.1 + FT_Render_Glyph@Base 2.2.1 + FT_Render_Glyph_Internal@Base 2.2.1 + FT_Request_Metrics@Base 2.2.1 + FT_Request_Size@Base 2.2.1 + FT_RoundFix@Base 2.2.1 + FT_Seek_Stream@Base 2.2.1 + FT_Select_Charmap@Base 2.2.1 + FT_Select_Metrics@Base 2.2.1 + FT_Select_Size@Base 2.2.1 + FT_Set_Char_Size@Base 2.2.1 + FT_Set_Charmap@Base 2.2.1 + FT_Set_Debug_Hook@Base 2.2.1 + FT_Set_MM_Blend_Coordinates@Base 2.2.1 + FT_Set_MM_Design_Coordinates@Base 2.2.1 + FT_Set_Pixel_Sizes@Base 2.2.1 + FT_Set_Renderer@Base 2.2.1 + FT_Set_Transform@Base 2.2.1 + FT_Set_Var_Blend_Coordinates@Base 2.2.1 + FT_Set_Var_Design_Coordinates@Base 2.2.1 + FT_Sfnt_Table_Info@Base 2.2.1 + FT_Sin@Base 2.2.1 + FT_Skip_Stream@Base 2.2.1 + FT_SqrtFixed@Base 2.2.1 + FT_Stream_Close@Base 2.2.1 + FT_Stream_EnterFrame@Base 2.2.1 + FT_Stream_ExitFrame@Base 2.2.1 + FT_Stream_ExtractFrame@Base 2.2.1 + FT_Stream_Free@Base 2.2.1 + FT_Stream_GetChar@Base 2.2.1 + FT_Stream_GetULong@Base 2.4.5 + FT_Stream_GetULongLE@Base 2.4.5 + FT_Stream_GetUOffset@Base 2.4.5 + FT_Stream_GetUShort@Base 2.4.5 + FT_Stream_GetUShortLE@Base 2.4.5 + FT_Stream_New@Base 2.2.1 + FT_Stream_Open@Base 2.2.1 + FT_Stream_OpenBzip2@Base 2.4.5 + FT_Stream_OpenGzip@Base 2.2.1 + FT_Stream_OpenLZW@Base 2.2.1 + FT_Stream_OpenMemory@Base 2.2.1 + FT_Stream_Pos@Base 2.2.1 + FT_Stream_Read@Base 2.2.1 + FT_Stream_ReadAt@Base 2.2.1 + FT_Stream_ReadChar@Base 2.2.1 + FT_Stream_ReadFields@Base 2.2.1 + FT_Stream_ReadULong@Base 2.4.5 + FT_Stream_ReadULongLE@Base 2.4.5 + FT_Stream_ReadUOffset@Base 2.4.5 + FT_Stream_ReadUShort@Base 2.4.5 + FT_Stream_ReadUShortLE@Base 2.4.5 + FT_Stream_ReleaseFrame@Base 2.4.5 + FT_Stream_Seek@Base 2.2.1 + FT_Stream_Skip@Base 2.2.1 + FT_Stream_TryRead@Base 2.2.1 + FT_Stroker_BeginSubPath@Base 2.2.1 + FT_Stroker_ConicTo@Base 2.2.1 + FT_Stroker_CubicTo@Base 2.2.1 + FT_Stroker_Done@Base 2.2.1 + FT_Stroker_EndSubPath@Base 2.2.1 + FT_Stroker_Export@Base 2.2.1 + FT_Stroker_ExportBorder@Base 2.2.1 + FT_Stroker_GetBorderCounts@Base 2.2.1 + FT_Stroker_GetCounts@Base 2.2.1 + FT_Stroker_LineTo@Base 2.2.1 + FT_Stroker_New@Base 2.2.1 + FT_Stroker_ParseOutline@Base 2.2.1 + FT_Stroker_Rewind@Base 2.2.1 + FT_Stroker_Set@Base 2.2.1 + FT_Tan@Base 2.2.1 + FT_Trace_Get_Count@Base 2.2.1 + FT_Trace_Get_Name@Base 2.2.1 + FT_TrueTypeGX_Free@Base 2.2.1 + FT_TrueTypeGX_Validate@Base 2.2.1 + FT_Vector_From_Polar@Base 2.2.1 + FT_Vector_Length@Base 2.2.1 + FT_Vector_Polarize@Base 2.2.1 + FT_Vector_Rotate@Base 2.2.1 + FT_Vector_Transform@Base 2.2.1 + FT_Vector_Transform_Scaled@Base 2.3.5 + FT_Vector_Unit@Base 2.2.1 + TT_New_Context@Base 2.2.1 + TT_RunIns@Base 2.2.1 + af_autofitter_interface@Base 2.4.11 + af_cjk_script_class@Base 2.2.1 + af_dummy_script_class@Base 2.2.1 + af_glyph_hints_dump_edges@Base 2.3.5 + af_glyph_hints_dump_points@Base 2.3.5 + af_glyph_hints_dump_segments@Base 2.3.5 + af_glyph_hints_get_num_segments@Base 2.4.5 + af_glyph_hints_get_segment_offset@Base 2.4.5 + af_indic_script_class@Base 2.3.5 + af_latin_script_class@Base 2.2.1 + af_property_get@Base 2.4.11 + af_property_get_face_globals@Base 2.4.11 + af_property_set@Base 2.4.11 + afm_parser_funcs@Base 2.2.1 + autofit_module_class@Base 2.2.1 + bdf_cmap_class@Base 2.2.1 + bdf_driver_class@Base 2.2.1 + cff_cmap_encoding_class_rec@Base 2.2.1 + cff_cmap_unicode_class_rec@Base 2.2.1 + cff_driver_class@Base 2.2.1 + ft_bitmap_glyph_class@Base 2.2.1 + ft_corner_is_flat@Base 2.3.5 + ft_corner_orientation@Base 2.3.5 + ft_debug_init@Base 2.2.1 + ft_glyphslot_alloc_bitmap@Base 2.2.1 + ft_glyphslot_free_bitmap@Base 2.2.1 + ft_glyphslot_set_bitmap@Base 2.2.1 + ft_grays_raster@Base 2.2.1 + ft_highpow2@Base 2.2.1 + ft_lzwstate_done@Base 2.2.1 + ft_lzwstate_init@Base 2.2.1 + ft_lzwstate_io@Base 2.2.1 + ft_lzwstate_reset@Base 2.2.1 + ft_mem_alloc@Base 2.2.1 + ft_mem_dup@Base 2.3.5 + ft_mem_free@Base 2.2.1 + ft_mem_qalloc@Base 2.2.1 + ft_mem_qrealloc@Base 2.2.1 + ft_mem_realloc@Base 2.2.1 + ft_mem_strcpyn@Base 2.3.5 + ft_mem_strdup@Base 2.3.5 + ft_module_get_service@Base 2.2.1 + ft_outline_glyph_class@Base 2.2.1 + ft_property_do@Base 2.4.11 + ft_raccess_guess_table@Base 2.4.9 + ft_raster1_renderer_class@Base 2.2.1 + ft_raster5_renderer_class@Base 2.2.1 + ft_service_list_lookup@Base 2.2.1 + ft_smooth_lcd_renderer_class@Base 2.2.1 + ft_smooth_lcdv_renderer_class@Base 2.2.1 + ft_smooth_renderer_class@Base 2.2.1 + ft_standard_raster@Base 2.2.1 + ft_synthesize_vertical_metrics@Base 2.2.1 + ft_validator_error@Base 2.2.1 + ft_validator_init@Base 2.2.1 + ft_validator_run@Base 2.2.1 + ftc_basic_image_cache_class@Base 2.2.1 + ftc_basic_image_family_class@Base 2.2.1 + ftc_basic_sbit_cache_class@Base 2.2.1 + ftc_basic_sbit_family_class@Base 2.2.1 + ftc_cmap_cache_class@Base 2.2.1 + ftc_face_list_class@Base 2.2.1 + ftc_size_list_class@Base 2.2.1 + gxv_module_class@Base 2.4.4 + otv_module_class@Base 2.4.4 + pcf_cmap_class@Base 2.2.1 + pcf_driver_class@Base 2.2.1 + pfr_cmap_class_rec@Base 2.2.1 + pfr_driver_class@Base 2.2.1 + pfr_metrics_service_rec@Base 2.2.1 + ps_hints_apply@Base 2.2.1 + ps_parser_funcs@Base 2.2.1 + ps_table_funcs@Base 2.2.1 + psaux_module_class@Base 2.2.1 + pshinter_module_class@Base 2.2.1 + psnames_module_class@Base 2.2.1 + sfnt_module_class@Base 2.2.1 + t1_builder_funcs@Base 2.2.1 + t1_cmap_classes@Base 2.2.1 + t1_cmap_custom_class_rec@Base 2.2.1 + t1_cmap_expert_class_rec@Base 2.2.1 + t1_cmap_standard_class_rec@Base 2.2.1 + t1_cmap_unicode_class_rec@Base 2.2.1 + t1_decoder_funcs@Base 2.2.1 + t1_driver_class@Base 2.2.1 + t1cid_driver_class@Base 2.2.1 + t42_driver_class@Base 2.2.1 + tt_cmap0_class_rec@Base 2.2.1 + tt_cmap10_class_rec@Base 2.2.1 + tt_cmap12_class_rec@Base 2.2.1 + tt_cmap13_class_rec@Base 2.3.11 + tt_cmap14_class_rec@Base 2.3.5 + tt_cmap2_class_rec@Base 2.2.1 + tt_cmap4_class_rec@Base 2.2.1 + tt_cmap6_class_rec@Base 2.2.1 + tt_cmap8_class_rec@Base 2.2.1 + tt_default_graphics_state@Base 2.2.1 + tt_driver_class@Base 2.2.1 + winfnt_driver_class@Base 2.2.1 --- freetype-2.4.12.orig/debian/patches-freetype/series +++ freetype-2.4.12/debian/patches-freetype/series @@ -0,0 +1,7 @@ +freetype-2.1.7-backwards.compat.patch -p0 +enable-gxvalid-otvalid.patch +revert_scalable_fonts_metric.patch +git_unitialized_variable.patch +CVE-2014-2240.patch +CVE-2014-2241.patch +freetype-entire-infinality-patchset-20130514-01.patch --- freetype-2.4.12.orig/debian/patches-freetype/enable-subpixel-rendering.patch +++ freetype-2.4.12/debian/patches-freetype/enable-subpixel-rendering.patch @@ -0,0 +1,13 @@ +Index: freetype-2.4.0/include/freetype/config/ftoption.h +=================================================================== +--- freetype-2.4.0.orig/include/freetype/config/ftoption.h ++++ freetype-2.4.0/include/freetype/config/ftoption.h +@@ -93,7 +93,7 @@ + /* This is done to allow FreeType clients to run unmodified, forcing */ + /* them to display normal gray-level anti-aliased glyphs. */ + /* */ +-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ ++#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + + /*************************************************************************/ --- freetype-2.4.12.orig/debian/patches-freetype/CVE-2014-2241.patch +++ freetype-2.4.12/debian/patches-freetype/CVE-2014-2241.patch @@ -0,0 +1,50 @@ +From 135c3faebb96f8f550bd4f318716f2e1e095a969 Mon Sep 17 00:00:00 2001 +From: Dave Arnold +Date: Fri, 28 Feb 2014 06:42:42 +0000 +Subject: Fix Savannah bug #41697, part 2. + +* src/cff/cf2ft.c (cf2_initLocalRegionBuffer, +cf2_initGlobalRegionBuffer): It is possible for a charstring to call +a subroutine if no subroutines exist. This is an error but should +not trigger an assert. Split the assert to account for this. +--- +Index: freetype-2.4.12/src/cff/cf2ft.c +=================================================================== +--- freetype-2.4.12.orig/src/cff/cf2ft.c 2014-03-13 12:51:28.229643910 -0400 ++++ freetype-2.4.12/src/cff/cf2ft.c 2014-03-13 12:51:28.229643910 -0400 +@@ -497,7 +497,7 @@ + CF2_UInt idx, + CF2_Buffer buf ) + { +- FT_ASSERT( decoder && decoder->globals ); ++ FT_ASSERT( decoder ); + + FT_ZERO( buf ); + +@@ -505,6 +505,8 @@ + if ( idx >= decoder->num_globals ) + return TRUE; /* error */ + ++ FT_ASSERT( decoder->globals ); ++ + buf->start = + buf->ptr = decoder->globals[idx]; + buf->end = decoder->globals[idx + 1]; +@@ -570,7 +572,7 @@ + CF2_UInt idx, + CF2_Buffer buf ) + { +- FT_ASSERT( decoder && decoder->locals ); ++ FT_ASSERT( decoder ); + + FT_ZERO( buf ); + +@@ -578,6 +580,8 @@ + if ( idx >= decoder->num_locals ) + return TRUE; /* error */ + ++ FT_ASSERT( decoder->locals ); ++ + buf->start = + buf->ptr = decoder->locals[idx]; + buf->end = decoder->locals[idx + 1]; --- freetype-2.4.12.orig/debian/patches-freetype/git_unitialized_variable.patch +++ freetype-2.4.12/debian/patches-freetype/git_unitialized_variable.patch @@ -0,0 +1,26 @@ +From 7441dd874dd8e7127fc27125d2442b1b7e57ae88 Mon Sep 17 00:00:00 2001 +From: Werner Lemberg +Date: Mon, 13 May 2013 07:12:46 +0000 +Subject: * src/cff/cf2font.c (cf2_getGlyphWidth): Fix uninitialized variable. + +Fix suggested by Vaibhav Nagarnaik . +--- +diff --git a/src/cff/cf2font.c b/src/cff/cf2font.c +index d8e0619..69642b2 100644 +--- a/src/cff/cf2font.c ++++ b/src/cff/cf2font.c +@@ -387,11 +387,11 @@ + /* finish storing client outline */ + cf2_outline_close( &font->outline ); + ++ exit: + /* FreeType just wants the advance width; there is no translation */ + *glyphWidth = advWidth; + + /* free resources and collect errors from objects we've used */ +- exit: + cf2_setError( &font->error, lastError ); + + return font->error; +-- + --- freetype-2.4.12.orig/debian/patches-freetype/revert_scalable_fonts_metric.patch +++ freetype-2.4.12/debian/patches-freetype/revert_scalable_fonts_metric.patch @@ -0,0 +1,16 @@ +# Description: revert commit which creates regressions in gtk +# Ubuntu: https://bugs.launchpad.net/freetype/+bug/972223 +# Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636776 +--- a/src/truetype/ttdriver.c ++++ b/src/truetype/ttdriver.c +@@ -246,10 +246,7 @@ + FT_Request_Metrics( size->face, req ); + + if ( FT_IS_SCALABLE( size->face ) ) +- { + error = tt_size_reset( ttsize ); +- ttsize->root.metrics = ttsize->metrics; +- } + + return error; + } --- freetype-2.4.12.orig/debian/patches-freetype/freetype-2.1.7-backwards.compat.patch +++ freetype-2.4.12/debian/patches-freetype/freetype-2.1.7-backwards.compat.patch @@ -0,0 +1,35 @@ +Index: src/base/ftapi.c +=================================================================== +--- src/base/ftapi.c.orig ++++ src/base/ftapi.c +@@ -118,4 +118,18 @@ + } + + ++ FT_BASE_DEF( FT_Short ) ++ FT_Get_Short( FT_Stream stream ) ++ { ++ return FT_GET_SHORT(); ++ } ++ ++ ++ FT_BASE_DEF( FT_Long ) ++ FT_Get_Long( FT_Stream stream ) ++ { ++ return FT_GET_LONG(); ++ } ++ ++ + /* END */ +Index: src/base/ftbase.c +=================================================================== +--- src/base/ftbase.c.orig ++++ src/base/ftbase.c +@@ -33,6 +33,7 @@ + #include "ftstream.c" + #include "fttrigon.c" + #include "ftutil.c" ++#include "ftapi.c" + + #if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON ) + #include "ftmac.c" --- freetype-2.4.12.orig/debian/patches-freetype/enable-gxvalid-otvalid.patch +++ freetype-2.4.12/debian/patches-freetype/enable-gxvalid-otvalid.patch @@ -0,0 +1,31 @@ +Description: enable the otvalid and gxvalid table validation modules + The 'ftvalid' demo in the freetype2-demos package is only useful if certain + extra extensions are enabled in freetype. These extensions are not enabled + upstream by default, but there's no reason for us not to enable them. +Author: Paul Wise +Bug-Debian: http://bugs.debian.org/520879 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/239626 +Forwarded: not-needed + +Index: freetype-2.4.4/modules.cfg +=================================================================== +--- freetype-2.4.4.orig/modules.cfg ++++ freetype-2.4.4/modules.cfg +@@ -110,7 +110,7 @@ + AUX_MODULES += cache + + # TrueType GX/AAT table validation. Needs ftgxval.c below. +-# AUX_MODULES += gxvalid ++AUX_MODULES += gxvalid + + # Support for streams compressed with gzip (files with suffix .gz). + # +@@ -124,7 +124,7 @@ + + # OpenType table validation. Needs ftotval.c below. + # +-# AUX_MODULES += otvalid ++AUX_MODULES += otvalid + + # Auxiliary PostScript driver component to share common code. + # --- freetype-2.4.12.orig/debian/patches-freetype/CVE-2014-2240.patch +++ freetype-2.4.12/debian/patches-freetype/CVE-2014-2240.patch @@ -0,0 +1,23 @@ +From 0eae6eb0645264c98812f0095e0f5df4541830e6 Mon Sep 17 00:00:00 2001 +From: Dave Arnold +Date: Fri, 28 Feb 2014 06:40:01 +0000 +Subject: Fix Savannah bug #41697, part 1. + +* src/cff/cf2hints.c (cf2_hintmap_build): Return when `hintMask' is +invalid. In this case, it is not safe to use the length of +`hStemHintArray'; the exception has already been recorded in +`hintMask'. +--- +Index: freetype-2.4.12/src/cff/cf2hints.c +=================================================================== +--- freetype-2.4.12.orig/src/cff/cf2hints.c 2014-03-13 12:51:16.993643728 -0400 ++++ freetype-2.4.12/src/cff/cf2hints.c 2014-03-13 12:51:16.989643728 -0400 +@@ -752,6 +752,8 @@ + cf2_hintmask_setAll( hintMask, + cf2_arrstack_size( hStemHintArray ) + + cf2_arrstack_size( vStemHintArray ) ); ++ if ( !cf2_hintmask_isValid( hintMask ) ) ++ return; /* too many stem hints */ + } + + /* begin by clearing the map */ --- freetype-2.4.12.orig/debian/patches-freetype/freetype-entire-infinality-patchset-20130514-01.patch +++ freetype-2.4.12/debian/patches-freetype/freetype-entire-infinality-patchset-20130514-01.patch @@ -0,0 +1,5510 @@ +After 20130513: + +Fix crash issue with certain fonts + +Fix issue with Courier New rendering + +Disable trace debug messages + + + +After 20130104: + +(ftsmooth.c) Perform additional checks in conditionals to prevent crashing. + +(ttsubpix.c) Remove unnecessary rules. + +(ttinterp.c) Enhance various functions with better default detection. + +(ttsubpix.c) Fix Load performance. + +Compatibility with Freetype 2.4.12 + +Merge the subpixel-enable patch into the main patch + + + + +After 20120616: + +Code simplification: Restore original rounding functions, and instead skip them outside when necessary. + +Fix Verdana/dejavu/verasans 12px 'a' spacing issue. Also make italics appearance consistent with regular. + +Lucida Grande Bold 'y' fixed. + +Substantial code formatting cleanup across all patches. + +Remove floating point arithmetic in subpixel patch. (Autohint patch eventually) + +Standardize the data types used to FT data types in subpixel patch + +Additional fixes with Verdana from Windows 7 SP1. + + + +After 20120615: + +Fix issue with Chrome and Verdana from Windows 7 SP1. + + + + +After 20120403: + +Infinality autohint patches +=========================== +Fix the forced slight hinting logic + +Enhance artificial emboldening at larger ppems + + +Infinality subpixel patches +=========================== +Substantial simplification of the TT rules, which helps with all the rest of the following improvements. + +Preparation for submission into Freetype tree. + +Fix Ubuntu S M N + +Courier fixes + +Make all fonts use standard (non-subpixel) TT hinting for characters '>' and '<'. + +Marked improvement on many non-Latin fonts, including Meiryo. + +Fix Oxygen rendering if usint TT hinting, and other ttfautohinted fonts + +Code cleanup + + +Infinality Fontconfig Package +============================= + +Add more fonts to the TT hinted list + +Fixes for font alias (thanks Yegorius) + + + + +After 20111223: + +Get rid of TT_CONFIG_OPTION_SUBPIXEL_HINTING_ADDITIONAL_TWEAKS and do this by default if TT_CONFIG_OPTION_SUBPIXEL_HINTING is enabled. + +Update to Freetype 2.4.9 + +Fix sdl_ttf + +Code cleanup + +Prevent crashes in OSX mode (thanks Markser) + + + + +After 20111125: + +Courier New Hack for '2'. + +Tweak Arial 16px a bit. + +Various tweaks on Courier New, Times NR, Arial, Verdana and others that create a general improvement in appearance at certain ppems. + +Fixes on some Cyrillic glyphs + +Pragmata Pro and Pragmata added to patches + +Be a little more conservative in the way "known settings" of fonts are done. + +Many small improvements to the subpixel hinting patch. + +Fix a crasher in the Windows sharpening algorithm. + +Noticible improvement on spacing in Tahoma 11px, Arial 11px, and other Arial clones. Me likey. + +Code fixes to prevent some warnings and possible crashes. (Thanks banta) + +Fix Opera and Firefox crashes. slot->face->style_name and slot->face->family_name need to be checked for not NULL before using. + + + + +After 20111117: + +Fix issue that prevented stem alignment on thin autohinted stems + +Fix regression in Arial italics + +Fix problem with bitmap copies in filters. Remove unnecessary processing. + +Added an internal capping filter that helps even out the filtering of very light/thin stems. + +General consistent and smoother appearance on very light/thin stems + +Add TT rules to make Droid fonts render more nicely if using TT hinter for them. + +TT fixes for Bitstream Vera Sans. + +Made the default style less stem-aligned. I may have been a little too gregarious in setting it to 100%. :) + +Fix problems with various autohinted fonts that result in ridiculously small letters. + +Fixed mangled Courier New glyphs. This pointed to a larger bug that is now fixed. + +Fix artifacts on Courier New glyphs 0 Q O k. + +OSX style in infinality settings should actually be UBUNTU style. Fixed. Still need to get a better OSX style going. + +Option to use predefined value on known good fonts (Verdana, Arial, etc.). This gives you the benefit of snapping and other enhancements when its known to work well, without creating misshapen glyphs on other fonts. + +Only do heavy snapping on m in known cases. + +Added LINUX style to infinality-settings.sh + + + + + +After 20110604: + +Features: + +Added a post-render, pre-lcd-filter filter that attempts to duplicate windows sharpness / graininess. Controlled by INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH. + +Added a fringe filter, intended mostly for autohint (but still effective for certain cases of TT hinting). This attempts to remove gray fringes that sometimes occur on horizontal stems and angled serifs and doodads (Times, Segoe '1', etc.) + +Added a grayscale filter. + +Added brightness/contrast filter. + +Substantial improvements in the stem alignment algorithm! Wow! + +Stem alignment now also happens on grayscale antialiased fonts (rgba=none). + + + + +Fixes / Tweaks: + +Changes inside of local.conf, which are documented there. + +Removed an artificial shift of 1/8 pixel to the right on stem aligned glyphs which should result in sharper looking alignment. + +Added XFT_SETTINGS into infinality-settings.sh. This means it will require less configuration on the end-user side. + +Fixed code to not touch bold, thin, narrow or italic faces for scale or alignment (until they can be properly accounted for). + +Added -lm dependency to the code again. (It seems to sneak off now and then) + +Changed autohinter horizontal stem stem snapping from on/off to use a value between 0 and 100. + +Functions getenv() and system() were crashing evince in _lcd_stem_align() at odd times. A workaround has been put in place. + +Moved _lcd_stem_align and all other filters into ftsmooth.c, which is a better place. + +Use malloc() in _lcd_stem_align for allocating structs and arrays of structs instead of what I learned in C++ class 10+ years ago. Should prevent abiword from crashing with large pt sizes like 3000. (A workaround has been put in place to automatically skip alignment on any ppem > 300. This will prevent the crashes until the real solution can be figured out.) + +Fix some compiler warnings. Some are still present. + +Added "m" control to alignment algorithm. This will cause all stems to m (or other 3-pronged glyphs) to get aligned to pixels. It still needs a bit of work, as it makes the best looking glyph size change. This is because the glyph now needs to snap stems to only even or odd pixels, not single ones. + +Added rules to allow "compatible widths" (i.e. widths if the font were being bitmap TT hinted) on a glyph by glyph basis and tweaked certain fonts like arial, verdana, times new roman, segoe ui, and trebuchet to use them. + +Don't stem align anything below 9 ppem because it is not consistently good. + +When doing stem alignment, automatically align stems to center of pixel or start of pixel when necessary. When horizontal stems start snapping to 2 px, so should the vertical ones in order for it to look nice. + +A Verdana 12 hack to make it render more like Windows. This notoriously poor looking ppem now looks as good as Verdana 13 without needing fontconfig replacement. + +Courier New now looks good, and possibly better than Windows rendering, with TT or autohint rendering. By the way, the hinters of Courier New should either be commended or executed. + +Improvements in overshoot artifact and fringe correction- Freesans at large ppem looks nice now. Overshoots on letters like 6, g, s, 3, etc. will now be rounded to integer pixels. + +Wrap all infinality code within a macro that is set in ftoption.h: #ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET. Makes it easier to identify in the code and allows for easy compliation with or without the patches set. + +Variable renaming for more clarity, in code and in environment variables. + +Move stretching code into Freetype instead of relying on programs to handle fontconfig matrix (they SUCK at it... *cough* Chrome *cough*). + +Additional modifications to the TT subpixel rendering rules for corrections to Georgia, DejaVu Sans, Times New Roman, Courier New and a couple others. + +A general improvement in the way autohinted fonts render, particularly on ones that normally look fragile or thin. Examples include Optima, Freemono, Freeserif, Raleway, MgOpen, etc. I'm doing what Windows does, which is brightness/contrast adjustment, except you don't see rainbows. + + + +diff --git a/configure b/configure +index 4d8a945..40eaa1b 100755 +--- a/configure ++++ b/configure +@@ -13,6 +13,8 @@ + # Call the `configure' script located in `builds/unix'. + # + ++export LDFLAGS="$LDFLAGS -lm" ++ + rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk + + # respect GNUMAKE environment variable for backwards compatibility +diff --git a/devel/ftoption.h b/devel/ftoption.h +index 2b370e5..cf18bf6 100644 +--- a/devel/ftoption.h ++++ b/devel/ftoption.h +@@ -582,6 +582,17 @@ FT_BEGIN_HEADER + + /*************************************************************************/ + /* */ ++ /* Define FT_CONFIG_OPTION_INFINALITY_PATCHSET if you want to enable */ ++ /* all additional infinality patches, which are configured via env */ ++ /* variables. */ ++ /* */ ++ /* This option requires TT_CONFIG_OPTION_SUBPIXEL_HINTING to */ ++ /* defined. */ ++ /* */ ++#define FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ ++ /*************************************************************************/ ++ /* */ + /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ + /* of the TrueType bytecode interpreter is used that doesn't implement */ + /* any of the patented opcodes and algorithms. The patents related to */ +diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h +index 84f1695..3c69018 100644 +--- a/include/freetype/config/ftoption.h ++++ b/include/freetype/config/ftoption.h +@@ -92,7 +92,7 @@ FT_BEGIN_HEADER + /* This is done to allow FreeType clients to run unmodified, forcing */ + /* them to display normal gray-level anti-aliased glyphs. */ + /* */ +-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ ++#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + + /*************************************************************************/ +@@ -577,11 +577,22 @@ FT_BEGIN_HEADER + /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ + /* defined. */ + /* */ +-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */ ++#define TT_CONFIG_OPTION_SUBPIXEL_HINTING + + + /*************************************************************************/ + /* */ ++ /* Define FT_CONFIG_OPTION_INFINALITY_PATCHSET if you want to enable */ ++ /* all additional infinality patches, which are configured via env */ ++ /* variables. */ ++ /* */ ++ /* This option requires TT_CONFIG_OPTION_SUBPIXEL_HINTING to */ ++ /* defined. */ ++ /* */ ++#define FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ ++ /*************************************************************************/ ++ /* */ + /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ + /* of the TrueType bytecode interpreter is used that doesn't implement */ + /* any of the patented opcodes and algorithms. The patents related to */ +diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c +index ef0157a..c75247e 100644 +--- a/src/autofit/aflatin.c ++++ b/src/autofit/aflatin.c +@@ -23,6 +23,7 @@ + #include "afglobal.h" + #include "aflatin.h" + #include "aferrors.h" ++#include "strings.h" + + + #ifdef AF_CONFIG_OPTION_USE_WARPER +@@ -577,8 +578,33 @@ + FT_Pos delta; + AF_LatinAxis axis; + FT_UInt nn; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ int checked_adjust_heights_env = 0; ++ FT_Bool adjust_heights = FALSE; + + ++ if ( checked_adjust_heights_env == 0 ) ++ { ++ char *adjust_heights_env = ++ getenv( "INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS" ); ++ if ( adjust_heights_env != NULL ) ++ { ++ if ( strcasecmp(adjust_heights_env, "default" ) != 0 ) ++ { ++ if ( strcasecmp(adjust_heights_env, "true") == 0 ) ++ adjust_heights = TRUE; ++ else if ( strcasecmp(adjust_heights_env, "1") == 0 ) ++ adjust_heights = TRUE; ++ else if ( strcasecmp(adjust_heights_env, "on") == 0 ) ++ adjust_heights = TRUE; ++ else if ( strcasecmp(adjust_heights_env, "yes") == 0 ) ++ adjust_heights = TRUE; ++ } ++ } ++ checked_adjust_heights_env = 1; ++ } ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ ++ + if ( dim == AF_DIMENSION_HORZ ) + { + scale = scaler->x_scale; +@@ -605,7 +631,7 @@ + { + AF_LatinAxis Axis = &metrics->axis[AF_DIMENSION_VERT]; + AF_LatinBlue blue = NULL; +- ++ int threshold = 40; + + for ( nn = 0; nn < Axis->blue_count; nn++ ) + { +@@ -615,7 +641,12 @@ + break; + } + } +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( adjust_heights && ++ metrics->root.scaler.face->size->metrics.x_ppem < 15 && ++ metrics->root.scaler.face->size->metrics.x_ppem > 5 ) ++ threshold = 52; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + if ( blue ) + { + FT_Pos scaled; +@@ -701,7 +732,13 @@ + + /* a blue zone is only active if it is less than 3/4 pixels tall */ + dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale ); ++ ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* Do at low ppems ( ~< 200 ), in order to prevent fringes */ ++ if ( dist <= 256 && dist >= -256 ) ++#else + if ( dist <= 48 && dist >= -48 ) ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + { + #if 0 + FT_Pos delta1; +@@ -752,7 +789,12 @@ + delta2 = -delta2; + + blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* Round to prevent fringes */ ++ blue->shoot.fit = FT_PIX_ROUND( blue->ref.fit - delta2 ); ++#else + blue->shoot.fit = blue->ref.fit - delta2; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + + #endif + +@@ -1498,7 +1540,10 @@ + dist = edge->fpos - blue->shoot.org; + if ( dist < 0 ) + dist = -dist; +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* round down to pixels */ ++ /*dist = FT_MulFix( dist, scale ) & ~63;*/ ++#endif + dist = FT_MulFix( dist, scale ); + if ( dist < best_dist ) + { +@@ -1659,8 +1704,31 @@ + FT_Pos dist = width; + FT_Int sign = 0; + FT_Int vertical = ( dim == AF_DIMENSION_VERT ); ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Int infinality_dist = 0; ++ FT_UInt autohint_snap_stem_height = 0; ++ FT_UInt checked_autohint_snap_stem_height = 0; + + ++ if ( checked_autohint_snap_stem_height == 0 ) ++ { ++ char *autohint_snap_stem_height_env = ++ getenv( "INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT" ); ++ if ( autohint_snap_stem_height_env != NULL ) ++ { ++ sscanf ( autohint_snap_stem_height_env, "%u", ++ &autohint_snap_stem_height ); ++ ++ if ( autohint_snap_stem_height > 100 ) ++ autohint_snap_stem_height = 100; ++ else if ( autohint_snap_stem_height < 0 ) ++ autohint_snap_stem_height = 0; ++ } ++ checked_autohint_snap_stem_height = 1; ++ } ++ ++ if ( autohint_snap_stem_height == 0 ) ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || + axis->extra_light ) + return width; +@@ -1670,9 +1738,73 @@ + dist = -width; + sign = 1; + } ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* Calculate snap value differently than standard freetype */ ++ if ( autohint_snap_stem_height > 0 && ++ ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || ++ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) ) ++ { ++ infinality_dist = af_latin_snap_width( axis->widths, ++ axis->width_count, dist ); + +- if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || ++ if ( metrics->root.scaler.face->size->metrics.x_ppem > 9 && ++ axis->width_count > 0 && ++ abs( axis->widths[0].cur - infinality_dist ) < 32 && ++ axis->widths[0].cur > 52 ) ++ { ++ if ( strstr( metrics->root.scaler.face->style_name, "Regular" ) || ++ strstr( metrics->root.scaler.face->style_name, "Book" ) || ++ strstr( metrics->root.scaler.face->style_name, "Medium" ) || ++ strcmp( metrics->root.scaler.face->style_name, "Italic" ) == 0 || ++ strcmp( metrics->root.scaler.face->style_name, "Oblique" ) == 0 ) ++ { ++ /* regular weight */ ++ if ( axis->widths[0].cur < 64 ) ++ infinality_dist = 64; ++ else if ( axis->widths[0].cur < 88 ) ++ infinality_dist = 64; ++ else if ( axis->widths[0].cur < 160 ) ++ infinality_dist = 128; ++ else if ( axis->widths[0].cur < 240 ) ++ infinality_dist = 190; ++ else infinality_dist = ( infinality_dist ) & ~63; ++ } ++ else ++ { ++ /* bold gets a different threshold */ ++ if ( axis->widths[0].cur < 64 ) ++ infinality_dist = 64 ; ++ else if ( axis->widths[0].cur < 108 ) ++ infinality_dist = 64; ++ else if ( axis->widths[0].cur < 160 ) ++ infinality_dist = 128; ++ else if ( axis->widths[0].cur < 222 ) ++ infinality_dist = 190; ++ else if ( axis->widths[0].cur < 288 ) ++ infinality_dist = 254; ++ else infinality_dist = ( infinality_dist + 16 ) & ~63; ++ } ++ ++ } ++ if ( infinality_dist < 52 ) ++ { ++ if ( metrics->root.scaler.face->size->metrics.x_ppem < 9 ) ++ { ++ if ( infinality_dist < 32 ) ++ infinality_dist = 32; ++ } ++ else ++ infinality_dist = 64; ++ } ++ } ++ else if ( autohint_snap_stem_height < 100 && ++ ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || ++ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) ) ++#else ++ ++ if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || + ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + { + /* smooth hinting process: very lightly quantize the stem width */ + +@@ -1732,6 +1864,9 @@ + } + } + else ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( autohint_snap_stem_height < 100 ) ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + { + /* strong hinting process: snap the stem width to integer pixels */ + +@@ -1739,7 +1874,10 @@ + + + dist = af_latin_snap_width( axis->widths, axis->width_count, dist ); +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( autohint_snap_stem_height > 0 ) ++ goto Done_Width; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + if ( vertical ) + { + /* in the case of vertical hinting, always round */ +@@ -1802,6 +1940,32 @@ + } + + Done_Width: ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( axis->widths[0].cur > 42 ) ++ /* weighted average */ ++ dist = (dist * ( 100 - autohint_snap_stem_height ) ++ + infinality_dist * autohint_snap_stem_height ) / 100; ++ ++ { ++ int factor = 100; ++ if ( axis->standard_width < 100 ) ++ factor = axis->standard_width; ++ ++ if ( metrics->root.scaler.face->size->metrics.x_ppem >= 9 && dist < 52 ) ++ dist += ( (52 - dist) * factor ) / 100; ++ if ( metrics->root.scaler.face->size->metrics.x_ppem < 9 && dist < 32 ) ++ dist += ( (32 - dist) * factor ) / 100; ++ ++ if ( axis->standard_width > 100 && ++ metrics->root.scaler.face->size->metrics.x_ppem >= 11 && ++ dist < 64 ) ++ dist = 64; ++ if ( axis->standard_width > 100 && ++ metrics->root.scaler.face->size->metrics.x_ppem >= 9 && ++ dist < 52 ) ++ dist = 52; ++ } ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + if ( sign ) + dist = -dist; + +@@ -1824,6 +1988,8 @@ + (AF_Edge_Flags)base_edge->flags, + (AF_Edge_Flags)stem_edge->flags ); + ++/* if fitted_width causes stem_edge->pos to land basically on top of an existing ++ * stem_edge->pos, then add or remove 64. Need to figure out a way to do this */ + + stem_edge->pos = base_edge->pos + fitted_width; + +@@ -2357,8 +2523,32 @@ + { + FT_Error error; + int dim; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Int emboldening_strength = 0; ++ FT_Bool checked_use_various_tweaks_env = FALSE; ++ FT_Bool use_various_tweaks = FALSE; + +- ++ if ( !checked_use_various_tweaks_env ) ++ { ++ char *use_various_tweaks_env = ++ getenv( "INFINALITY_FT_USE_VARIOUS_TWEAKS" ); ++ if ( use_various_tweaks_env != NULL ) ++ { ++ if ( strcasecmp(use_various_tweaks_env, "default" ) != 0 ) ++ { ++ if ( strcasecmp(use_various_tweaks_env, "true") == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "1") == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "on") == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "yes") == 0 ) ++ use_various_tweaks = TRUE; ++ } ++ } ++ checked_use_various_tweaks_env = TRUE; ++ } ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + error = af_glyph_hints_reload( hints, outline ); + if ( error ) + goto Exit; +@@ -2415,7 +2605,17 @@ + } + } + af_glyph_hints_save( hints, outline ); ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ { ++ /* Save this width for use in ftsmooth.c. This is a shameful hack */ ++ const char* c1 = "CUR_WIDTH"; ++ char c2[8]; ++ + ++ snprintf( c2, 8, "%ld", metrics->axis->widths[0].cur ); ++ setenv( c1, c2, 1 ); ++ } ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + Exit: + return error; + } +diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c +index 852fb32..4c2d548 100644 +--- a/src/base/ftlcdfil.c ++++ b/src/base/ftlcdfil.c +@@ -23,6 +23,9 @@ + #include FT_IMAGE_H + #include FT_INTERNAL_OBJECTS_H + ++#include ++#include ++#include + + #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + +@@ -289,10 +292,53 @@ + { 0x00, 0x55, 0x56, 0x55, 0x00 }; + /* the values here sum up to a value larger than 256, */ + /* providing a cheap gamma correction */ +- static const FT_Byte default_filter[5] = ++ static FT_Byte default_filter[5] = + { 0x10, 0x40, 0x70, 0x40, 0x10 }; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ int checked_filter_params_env = 0; + ++ if ( checked_filter_params_env == 0 ) ++ { ++ char *filter_params = getenv( "INFINALITY_FT_FILTER_PARAMS" ); ++ if ( filter_params != NULL && strcmp( filter_params, "" ) != 0 ) ++ { ++ float f1, f2, f3, f4, f5; + ++ if ( strcasecmp( filter_params, "default" ) != 0 ) ++ { ++ int args_assigned = 0; ++ args_assigned = sscanf ( filter_params, ++ "%f %f %f %f %f", ++ &f1, &f2, &f3, &f4, &f5 ); ++ ++ if ( args_assigned == 5 ) ++ { ++ if ( f1 + f2 + f3 + f4 + f5 > 5 ) ++ { ++ /* Assume we were given integers instead of floats */ ++ /* 0 to 100 */ ++ default_filter[0] = (FT_Byte) ( f1 * 2.55f + 0.5f ); ++ default_filter[1] = (FT_Byte) ( f2 * 2.55f + 0.5f ); ++ default_filter[2] = (FT_Byte) ( f3 * 2.55f + 0.5f ); ++ default_filter[3] = (FT_Byte) ( f4 * 2.55f + 0.5f ); ++ default_filter[4] = (FT_Byte) ( f5 * 2.55f + 0.5f ); ++ } ++ else ++ { ++ /* Assume we were given floating point values */ ++ /* 0 to 1.0 */ ++ default_filter[0] = (FT_Byte) ( f1 * 255.0f + 0.5f ); ++ default_filter[1] = (FT_Byte) ( f2 * 255.0f + 0.5f ); ++ default_filter[2] = (FT_Byte) ( f3 * 255.0f + 0.5f ); ++ default_filter[3] = (FT_Byte) ( f4 * 255.0f + 0.5f ); ++ default_filter[4] = (FT_Byte) ( f5 * 255.0f + 0.5f ); ++ } ++ } ++ } ++ } ++ checked_filter_params_env = 1; ++ } ++#endif + if ( !library ) + return FT_THROW( Invalid_Argument ); + +diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c +index 26118ed..d87be53 100644 +--- a/src/base/ftobjs.c ++++ b/src/base/ftobjs.c +@@ -53,6 +53,10 @@ + + #define GRID_FIT_METRICS + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include ++#include ++#endif + + FT_BASE_DEF( FT_Pointer ) + ft_service_list_lookup( FT_ServiceDesc service_descriptors, +@@ -524,6 +528,25 @@ + ft_lookup_glyph_renderer( FT_GlyphSlot slot ); + + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ static void ++ ft_glyphslot_enlarge_metrics( FT_GlyphSlot slot, ++ FT_Render_Mode mode ) ++ { ++ FT_Glyph_Metrics* metrics = &slot->metrics; ++ FT_Pos enlarge_cbox = 0; ++ ++ ++ /* enlarge for grayscale rendering */ ++ if ( mode == FT_RENDER_MODE_NORMAL ) ++ enlarge_cbox = 64; ++ ++ metrics->horiBearingX -= enlarge_cbox; ++ metrics->width += 2 * enlarge_cbox; ++ } ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ ++ ++ + #ifdef GRID_FIT_METRICS + static void + ft_glyphslot_grid_fit_metrics( FT_GlyphSlot slot, +@@ -582,8 +605,40 @@ + FT_Bool autohint = FALSE; + FT_Module hinter; + TT_Face ttface = (TT_Face)face; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET + ++ int checked_use_various_tweaks_env = FALSE; ++ FT_Bool use_various_tweaks = FALSE; ++ ++ if ( !checked_use_various_tweaks_env ) ++ { ++ char *use_various_tweaks_env = ++ getenv( "INFINALITY_FT_USE_VARIOUS_TWEAKS" ); + ++ if ( use_various_tweaks_env != NULL ) ++ { ++ if ( strcasecmp(use_various_tweaks_env, "default" ) != 0 ) ++ { ++ if ( strcasecmp(use_various_tweaks_env, "true") == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "1") == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "on") == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "yes") == 0 ) ++ use_various_tweaks = TRUE; ++ } ++ } ++ checked_use_various_tweaks_env = 1; ++ } ++ ++ /* Force autohint if no tt instructions */ ++ /* NOTE: NEEDS TO BE RUN LATER IN CODE???? */ ++ /*if ( use_various_tweaks && ++ ttface->num_locations && ++ ttface->max_profile.maxSizeOfInstructions == 0 ) ++ load_flags |= FT_LOAD_FORCE_AUTOHINT;*/ ++#endif + if ( !face || !face->size || !face->glyph ) + return FT_THROW( Invalid_Face_Handle ); + +@@ -664,6 +719,18 @@ + { + FT_AutoHinter_Interface hinting; + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( use_various_tweaks ) ++ { ++ /* Force slight hinting over full hinting always */ ++ load_flags &= ~FT_LOAD_TARGET_LCD; ++ load_flags &= ~FT_LOAD_TARGET_LCD_V; ++ load_flags &= ~FT_LOAD_TARGET_MONO; ++ load_flags &= ~FT_LOAD_TARGET_NORMAL; ++ load_flags |= FT_LOAD_TARGET_LIGHT; ++ /*printf("%d ", load_flags);*/ ++ } ++#endif + + /* try to load embedded bitmaps first if available */ + /* */ +@@ -702,6 +769,10 @@ + } + else + { ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ char* c1 = "CUR_WIDTH"; ++ char* c2 = "0"; ++#endif + error = driver->clazz->load_glyph( slot, + face->size, + glyph_index, +@@ -709,6 +780,18 @@ + if ( error ) + goto Exit; + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ setenv ( c1, c2, 1 ); ++ ++ { ++ /* fix for sdl_ttf */ ++ FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); ++ ++ if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) ++ ft_glyphslot_enlarge_metrics( slot, mode ); ++ } ++#endif ++ + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { + /* check that the loaded outline is correct */ +diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c +index 54ca5cd..bf34c9f 100644 +--- a/src/base/ftoutln.c ++++ b/src/base/ftoutln.c +@@ -905,7 +905,34 @@ + FT_Vector v_prev, v_first, v_next, v_cur; + FT_Int c, n, first; + FT_Int orientation; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ int checked_use_various_tweaks_env = 0; ++ FT_Bool use_various_tweaks = FALSE; + ++ if ( checked_use_various_tweaks_env == 0 ) ++ { ++ char *use_various_tweaks_env ++ = getenv( "INFINALITY_FT_USE_VARIOUS_TWEAKS" ); ++ if ( use_various_tweaks_env != NULL ) ++ { ++ if ( strcasecmp(use_various_tweaks_env, "default" ) != 0 ) ++ { ++ if ( strcasecmp(use_various_tweaks_env, "true" ) == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "1" ) == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "on" ) == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "yes" ) == 0 ) ++ use_various_tweaks = TRUE; ++ } ++ } ++ checked_use_various_tweaks_env = 1; ++ } ++ ++ if ( use_various_tweaks ) ++ ystrength = FT_PIX_FLOOR ( ystrength ); ++#endif + + if ( !outline ) + return FT_THROW( Invalid_Argument ); +diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c +index 241d37f..3d5a593 100644 +--- a/src/base/ftsynth.c ++++ b/src/base/ftsynth.c +@@ -88,7 +88,32 @@ + FT_Face face = slot->face; + FT_Error error; + FT_Pos xstr, ystr; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ int checked_use_various_tweaks_env = 0; ++ FT_Bool use_various_tweaks = FALSE; + ++ if ( checked_use_various_tweaks_env == 0 ) ++ { ++ char *use_various_tweaks_env ++ = getenv( "INFINALITY_FT_USE_VARIOUS_TWEAKS" ); ++ if ( use_various_tweaks_env != NULL ) ++ { ++ if ( strcasecmp(use_various_tweaks_env, "default" ) != 0 ) ++ { ++ if ( strcasecmp(use_various_tweaks_env, "true" ) == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "1" ) == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "on" ) == 0 ) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp(use_various_tweaks_env, "yes" ) == 0 ) ++ use_various_tweaks = TRUE; ++ } ++ ++ } ++ checked_use_various_tweaks_env = 1; ++ } ++#endif + + if ( slot->format != FT_GLYPH_FORMAT_OUTLINE && + slot->format != FT_GLYPH_FORMAT_BITMAP ) +@@ -101,6 +126,13 @@ + + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( use_various_tweaks ) ++ (void)FT_Outline_EmboldenXY( &slot->outline, ++ xstr, ++ FT_PIX_FLOOR( ystr ) ); ++ else ++#endif + /* ignore error */ + (void)FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); + } +@@ -141,6 +173,9 @@ + + slot->metrics.width += xstr; + slot->metrics.height += ystr; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( !use_various_tweaks ) ++#endif + slot->metrics.horiAdvance += xstr; + slot->metrics.vertAdvance += ystr; + +diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c +index 2735eaf..382f1f3 100644 +--- a/src/smooth/ftsmooth.c ++++ b/src/smooth/ftsmooth.c +@@ -26,6 +26,17 @@ + + #include "ftsmerrs.h" + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include ++#include "../../include/freetype/ftbitmap.h" ++#include ++#include "../autofit/aflatin.h" ++#include "../../include/freetype/ftoutln.h" ++ ++#define verbose FALSE ++#define STVALUES if (verbose) \ ++ printf ( "scale:%f translate:%ld ", *scale_value, *translate_value ); ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + + /* initialize renderer -- init its raster */ + static FT_Error +@@ -70,29 +81,3017 @@ + goto Exit; + } + +- if ( matrix ) +- FT_Outline_Transform( &slot->outline, matrix ); ++ if ( matrix ) ++ FT_Outline_Transform( &slot->outline, matrix ); ++ ++ if ( delta ) ++ FT_Outline_Translate( &slot->outline, delta->x, delta->y ); ++ ++ Exit: ++ return error; ++ } ++ ++ ++ /* return the glyph's control box */ ++ static void ++ ft_smooth_get_cbox( FT_Renderer render, ++ FT_GlyphSlot slot, ++ FT_BBox* cbox ) ++ { ++ FT_MEM_ZERO( cbox, sizeof ( *cbox ) ); ++ ++ if ( slot->format == render->glyph_format ) ++ FT_Outline_Get_CBox( &slot->outline, cbox ); ++ } ++ ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ static FT_Fixed FT_FixedFromFloat(float f) ++ { ++ short value = f; ++ unsigned short fract = (f - value) * 0xFFFF; ++ ++ ++ return (FT_Fixed)((long)value << 16 | (unsigned long)fract ); ++ } ++ ++ ++ /* ChromeOS sharpening algorithm */ ++ /* soften the sub-pixel anti-aliasing and sharpen */ ++ static void ++ _ft_lcd_chromeos_sharpen( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_Byte cutoff, ++ double gamma_value ) ++ { ++ static FT_Bool initialized_gamma = FALSE; ++ static unsigned short gamma_ramp[256]; ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ int ii; ++ ++ if ( !initialized_gamma ) ++ { ++ initialized_gamma = TRUE; ++ /* linear to voltage */ ++ for ( ii = 0; ii < 256; ii++ ) ++ { ++ gamma_ramp[ii] = (unsigned char) ++ ( pow( (double)ii / 255.0, gamma_value ) * 255.0f ); ++ if ( gamma_ramp[ii] < cutoff ) ++ gamma_ramp[ii] = 0; ++ } ++ } ++ ++ /* horizontal in-place sub-pixel sharpening filter */ ++ if ( mode == FT_RENDER_MODE_LCD ) ++ { ++ FT_Byte* line = bitmap->buffer; ++ ++ ++ for ( ; height > 0; height--, line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 0; xx < width; xx++ ) ++ line[xx] = gamma_ramp[line[xx]]; ++ } ++ } ++ } ++ ++ /* simple linear scale to handle various sliding values */ ++ float ++ sliding_scale ( int min_value, ++ int max_value, ++ float min_amount, ++ float max_amount, ++ int cur_value ) ++ { ++ ++ float m = ( min_amount - max_amount ) / (float)( min_value - max_value ); ++ float result = ( ( (float)cur_value * m) + ( max_amount - max_value * m ) ) ; ++ ++ if ( min_amount < max_amount ) ++ { ++ if ( result < min_amount ) ++ return min_amount; ++ if ( result > max_amount ) ++ return max_amount; ++ } ++ else ++ { ++ if ( result < max_amount ) ++ return max_amount; ++ if ( result > min_amount ) ++ return min_amount; ++ } ++ ++ return result; ++ } ++ ++ ++ /* brightness and contrast adjustment on the bitmap */ ++ static FT_Bool ++ _ft_bitmap_bc ( FT_Bitmap* bitmap, ++ float brightness, ++ float contrast ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* line = bitmap->buffer; ++ FT_UInt xx; ++ ++ ++ if ( brightness == 0 && contrast == 0 ) ++ return FALSE; ++ ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch ) ++ { ++ for ( xx = 0; xx < width - 1; xx += 1 ) ++ { ++ if ( line[xx] > 0) ++ { ++ float value = (float)( 255 - line[xx] ) / 256.0; ++ FT_Int result = 0; ++ ++ if ( brightness < 0.0 ) ++ value = value * ( 1.0 + brightness ); ++ else ++ value = value + ( ( 1.0 - value ) * brightness ); ++ ++ value = ( value - 0.5 ) * ++ ( tan ( ( contrast + 1.0 ) * 3.141592/4.0 ) ) + 0.5; ++ ++ result = (FT_Int)( 255.0 - value * 256.0 ); ++ ++ if ( result < 0 ) ++ result = 0; ++ if ( result > 255 ) ++ result = 255; ++ ++ line[xx] = result; ++ } ++ } ++ } ++ return TRUE; ++ } ++ ++ ++ /* Filter to mimic Windows-style sharpening */ ++ /* Determined via 100% experimentation. */ ++ static void ++ _ft_lcd_windows_sharpen( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ ++ ++ FT_Bitmap_New( &new_bitmap ); ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ if (strength > 0) ++ for (height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ FT_UInt xx, threshold = 128; ++ FT_Byte* prevline = line - bitmap->pitch; ++ FT_Byte* nextline = line + bitmap->pitch; ++ FT_Byte* new_prevline = new_line - bitmap->pitch; ++ FT_Byte* new_nextline = new_line + bitmap->pitch; ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ /* subpixel grid sp11 sp21 sp31 */ ++ /* where sp22 is sp12 sp22 sp32 */ ++ /* current subpixel. sp13 sp23 sp33 */ ++ ++ FT_Int prevtotal, nexttotal, lefttotal, righttotal, sidesdiff, ++ prevdiff, nextdiff, sp11, sp21, sp31, sp12, sp22, sp32, ++ sp13, sp23, sp33; ++ ++ sp12 = line [xx-1]; ++ sp22 = line [xx]; ++ sp32 = line [xx+1]; ++ ++ if ( height == bitmap->rows ) ++ { ++ prevtotal = sp11 = sp21 = sp31 = 0; ++ prevdiff = sp22; ++ lefttotal = sp12 + sp13; ++ righttotal = sp32 + sp33; ++ } ++ else ++ { ++ prevtotal = prevline[xx-1] + prevline[xx] + prevline[xx+1]; ++ sp11 = prevline [xx-1]; ++ sp21 = prevline [xx]; ++ sp31 = prevline [xx+1]; ++ prevdiff = sp22 - sp21; ++ lefttotal = sp11 + sp12 + sp13; ++ righttotal = sp31 + sp32 + sp33; ++ } ++ ++ if ( height == 1 ) ++ { ++ nexttotal = sp13 = sp23 = sp33 = 0; ++ nextdiff = sp22; ++ lefttotal = sp11 + sp12; ++ righttotal = sp31 + sp32; ++ } ++ else ++ { ++ nexttotal = nextline[xx-1] + nextline[xx] + nextline[xx+1]; ++ sp13 = nextline [xx-1]; ++ sp23 = nextline [xx]; ++ sp33 = nextline [xx+1]; ++ nextdiff = sp23 - sp22; ++ lefttotal = sp11 + sp12 + sp13; ++ righttotal = sp31 + sp32 + sp33; ++ } ++ ++ sidesdiff = lefttotal - righttotal; ++ ++ if ( sidesdiff < 0 ) ++ sidesdiff *= -1; ++ ++ if ( prevdiff < 0 ) ++ prevdiff *= -1; ++ ++ if ( nextdiff < 0 ) ++ nextdiff *= -1; ++ ++ /* if the current pixel is less than threshold, and greater than 0 */ ++ if ( sp22 <= threshold && sp22 > 0 ) ++ { ++ /* A pixel is horizontally isolated if: */ ++ /* 1: All upper adjecent pixels are >= threshold */ ++ if ( prevtotal >= nexttotal && ++ abs( sp11 - sp12 ) > 5 && ++ abs( sp21 - sp22 ) > 5 && ++ abs( sp31 - sp32 ) > 5 && /* not a vert stem end */ ++ sp11 >= threshold && ++ sp21 >= threshold && ++ sp31 >= threshold && ++ abs( sp23 - sp22 ) > 15 ) /* not on a vert stem */ ++ { ++ /* darken upper adjacent subpixel; lighten current */ ++ if ( height != (FT_UInt)bitmap->rows ) ++ new_prevline[xx] += ( ( 255 - new_prevline[xx] ) ++ * strength ) / 100 ; ++ ++ new_line[xx] -= ( new_line[xx] * strength ) / 100; ++ ++ if ( height != 1 && height != (FT_UInt)bitmap->rows ) ++ if ( new_nextline[xx] > 155 + ( 100 - strength ) ) ++ new_prevline[xx] = 255; ++ ++ } ++ else if ( nexttotal > prevtotal && ++ abs( sp13 - sp12 ) > 5 && ++ abs( sp23 - sp22 ) > 5 && ++ abs( sp33 - sp32 ) > 5 && ++ /* 2: All lower adjecent pixels are >= threshold */ ++ sp13 >= threshold && ++ sp23 >= threshold && ++ sp33 >= threshold && ++ abs( sp22 - sp21 ) > 15 ) ++ { ++ /* darken lower adjacent subpixel; lighten current */ ++ if ( height != 1 ) ++ new_nextline[xx] += ( 255 - new_nextline[xx] ) * strength / 100; ++ ++ new_line[xx] -= ( new_line[xx] * strength ) / 100; ++ ++ if ( height != 1 ) ++ if ( new_nextline[xx] > 155 + ( 100 - strength ) ) ++ new_nextline[xx] = 255; ++ ++ } ++ } ++ else if ( sp22 > threshold && sp22 < 255 ) ++ { ++ if ( sp11 <= threshold && ++ abs( sp13 - sp12 ) > 5 && ++ abs( sp23 - sp22 ) > 5 && ++ abs( sp33 - sp32 ) > 5 && ++ sp21 <= threshold && ++ sp31 <= threshold && ++ prevtotal <= nexttotal && ++ abs( sp22 - sp21 ) > 15 ) ++ { ++ /* bring this subpixel 1/3 of the way to 255 at 100% strength */ ++ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; ++ ++ if ( height != (FT_UInt)bitmap->rows ) ++ new_prevline[xx] -= ( new_prevline[xx] * strength ) / 300; ++ } ++ else if ( sp13 <= threshold && ++ abs( sp11 - sp12 ) > 5 && ++ abs( sp21 - sp22 ) > 5 && ++ abs( sp31 - sp32 ) > 5 && ++ sp23 <= threshold && ++ sp33 <= threshold && ++ nexttotal < prevtotal && ++ abs( sp23 - sp22 ) > 15 ) ++ { ++ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; ++ ++ if ( height != 1 ) ++ new_nextline[xx] -= ( new_nextline[xx] * strength ) / 300; ++ } ++ } ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ static void ++ _ft_lcd_darken_x ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ int factor1, factor2; ++ int bias = 0; ++ ++ FT_Bitmap_New( &new_bitmap ); ++ ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ FT_Byte* prevline = line - bitmap->pitch; ++ FT_Byte* nextline = line + bitmap->pitch; ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ /* subpixel grid sp11 sp21 sp31 */ ++ /* where sp22 is sp12 sp22 sp32 */ ++ /* current subpixel. sp13 sp23 sp33 */ ++ ++ FT_Int sp21, sp12, sp22, sp32, sp23; ++ ++ sp12 = line [xx-1]; ++ sp22 = line [xx]; ++ sp32 = line [xx+1]; ++ ++ if ( height == bitmap->rows ) ++ sp21 = 0; ++ else ++ sp21 = prevline [xx]; ++ ++ if ( height == 1 ) ++ sp23 = 0; ++ else ++ sp23 = nextline [xx]; ++ ++ /* darken subpixel if neighbor above and below are much less than */ ++ /* safer but less effective */ ++ factor1 = 5; ++ factor2 = 5; ++ ++ /* make matches in the middle of glyph slightly darker */ ++ /*if (height > 1 && height < (FT_UInt)bitmap->rows) bias = 1;*/ ++ ++ if ( sp22 > factor1 * sp21 && ++ sp22 > factor1 * sp23 && ++ sp22 > factor2 && ++ sp12 > 16 && ++ sp32 > 16 ) ++ if ( new_line[xx] < ( strength * 255 ) / 100 ) ++ new_line[xx] = (strength * 255 ) / 100 ++ + bias * ( 255 - ( strength * 255 ) / 100 ) / 3; ++ ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ static void ++ _ft_lcd_darken_y ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ ++ ++ FT_Bitmap_New( &new_bitmap ); ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ if ( line[xx] > line[xx-1] && line[xx] > line[xx+1] ) ++ { ++ if (new_line[xx] > 0) ++ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; ++ new_line[xx-1] += ( strength * ( 255 - line[xx-1] ) ) / 100; ++ new_line[xx+1] += ( strength * ( 255 - line[xx+1] ) ) / 100; ++ } ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ static void ++ _ft_bitmap_cap ( FT_Bitmap* bitmap, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_UInt cur_value = 0; ++ FT_Bitmap new_bitmap; ++ ++ ++ FT_Bitmap_New( &new_bitmap ); ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ cur_value = ( new_line[xx-1] + new_line[xx] + new_line[xx+1] ) / 3; ++ if ( cur_value > ( strength * 255 ) / 100 ) ++ { ++ FT_UInt new_factor = ( strength * 255 ) / 100; ++ new_line[xx] = ( new_line[xx] * new_factor ) / cur_value; ++ new_line[xx+1] = ( new_line[xx+1] * new_factor ) / cur_value; ++ new_line[xx-1] = ( new_line[xx-1] * new_factor ) / cur_value; ++ } ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ int ++ pseudo_gamma ( int val, float value ) ++ { ++ return 256 * ( 1.0 - pow( ( 1.0 - (float)val / 256.0 ), 1.0 / value ) ); ++ } ++ ++ ++ ++ static void ++ _ft_bitmap_embolden ( FT_Bitmap* bitmap, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ FT_UInt xx; ++ ++ ++ FT_Bitmap_New(&new_bitmap); ++ FT_Bitmap_Copy(library, bitmap, &new_bitmap); ++ new_line = (&new_bitmap)->buffer; ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ FT_Int new_value = 0; ++ ++ ++ new_value = ( strength * line [xx-1] ) / 100 ++ + pseudo_gamma( line [xx], .75 ) ++ + (strength * line [xx+1] ) / 100; ++ if ( new_value > 255 ) ++ new_value = 255; ++ ++ new_line[xx] = new_value; ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ ++ static void ++ _ft_bitmap_gamma ( FT_Bitmap* bitmap, ++ float strength ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* line = bitmap->buffer; ++ FT_UInt xx; ++ ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch ) ++ { ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ if ( abs( line[xx-1] - line[xx] ) < 20 || ++ abs( line[xx+1] - line[xx] ) < 20 ) ++ line [xx] = pseudo_gamma( line [xx], strength ) ; ++ } ++ } ++ } ++ ++ ++ /* Fringe filter */ ++ static void ++ _ft_lcd_fringe_filter ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ ++ ++ FT_Bitmap_New(&new_bitmap); ++ ++ line = bitmap->buffer; ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ /* Threshold set to 1/2 pixel intensity */ ++ FT_UInt xx, threshold = 128; ++ ++ /* Hack to make this work when bitmap is at first or last line */ ++ FT_Int fudge = bitmap->pitch * (height == (FT_UInt)bitmap->rows); ++ ++ FT_Byte* prevline = line - bitmap->pitch + fudge; ++ FT_Byte* nextline = line + bitmap->pitch; ++ ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ /* subpixel grid sp11 sp21 sp31 */ ++ /* where sp22 is sp12 sp22 sp32 */ ++ /* current subpixel. sp13 sp23 sp33 */ ++ ++ FT_Int prevtotal, nexttotal, lefttotal, righttotal, sidesdiff, ++ leftdiff, rightdiff, prevdiff, nextdiff, sp11, sp21, sp31, ++ sp12, sp22, sp32, sp13, sp23, sp33; ++ ++ sp12 = line [xx-1]; ++ sp22 = line [xx]; ++ sp32 = line [xx+1]; ++ ++ /* if at max height fake out some values */ ++ if ( height == (FT_UInt)bitmap->rows ) ++ { ++ prevtotal = sp11 = sp21 = sp31 = 0; ++ prevdiff = sp22; ++ lefttotal = sp12 + sp13; ++ righttotal = sp32 + sp33; ++ } ++ else ++ { ++ prevtotal = prevline[xx-1] + prevline[xx] + prevline[xx+1]; ++ sp11 = prevline [xx-1]; ++ sp21 = prevline [xx]; ++ sp31 = prevline [xx+1]; ++ prevdiff = sp22 - sp21; ++ lefttotal = sp11 + sp12 + sp13; ++ righttotal = sp31 + sp32 + sp33; ++ } ++ ++ /* if at min height fake out some values */ ++ if ( height == 1 ) ++ { ++ nexttotal = sp13 = sp23 = sp33 = 0; ++ nextdiff = sp22; ++ lefttotal = sp11 + sp12; ++ righttotal = sp31 + sp32; ++ } ++ else ++ { ++ nexttotal = nextline[xx-1] + nextline[xx] + nextline[xx+1]; ++ sp13 = nextline [xx-1]; ++ sp23 = nextline [xx]; ++ sp33 = nextline [xx+1]; ++ nextdiff = sp23 - sp22; ++ lefttotal = sp11 + sp12 + sp13; ++ righttotal = sp31 + sp32 + sp33; ++ } ++ ++ sidesdiff = lefttotal - righttotal; ++ leftdiff = sp22 - sp12; ++ rightdiff = sp32 - sp22; ++ ++ if ( sidesdiff < 0 ) ++ sidesdiff *= -1; ++ ++ if ( prevdiff < 0 ) ++ prevdiff *= -1; ++ ++ if ( nextdiff < 0 ) ++ nextdiff *= -1; ++ ++ if ( leftdiff < 0 ) ++ leftdiff *= -1; ++ ++ if ( rightdiff < 0 ) ++ rightdiff *= -1; ++ ++ /* if the current subpixel is less than threshold, and varies only ++ slightly to left or right, lighten it */ ++ if ( sp22 <= threshold && sp22 > 0 && ++ ( leftdiff < 10 || rightdiff < 10 ) ) ++ { ++ /* A pixel is horizontally isolated if: */ ++ /* 1: All upper adjecent subpixels are >= threshold and all lower ++ adjacent ones are essentially white */ ++ if ( prevtotal >= nexttotal && ++ sp11 >= threshold && ++ sp21 >= threshold && ++ sp31 >= threshold && ++ sp13 < 2 && ++ sp23 < 2 && ++ sp33 < 2 ) ++ ++ { ++ new_line[xx] -= ( new_line[xx] * strength ) / 100; ++ ++ if ( leftdiff < 10 ) ++ /* OPPORTUNITY FOR IMPROVEMENT - keep going left until 255? */ ++ new_line[xx-1] -= ( new_line[xx-1] * strength ) / 200; ++ ++ if ( rightdiff < 10 ) ++ /* OPPORTUNITY FOR IMPROVEMENT */ ++ new_line[xx+1] -= ( new_line[xx+1] * strength ) / 200; ++ } ++ else if ( nexttotal > prevtotal && ++ /* 2: the inverse of above */ ++ sp13 >= threshold && ++ sp23 >= threshold && ++ sp33 >= threshold && ++ sp11 < 2 && ++ sp21 < 2 && ++ sp31 < 2 ) ++ { ++ new_line[xx] -= ( new_line[xx] * strength ) / 100; ++ ++ if ( leftdiff < 10 ) ++ /* OPPORTUNITY FOR IMPROVEMENT - keep going left until 255? */ ++ new_line[xx-1] -= ( new_line[xx-1] * strength ) / 200; ++ ++ if ( rightdiff < 10 ) ++ /* OPPORTUNITY FOR IMPROVEMENT */ ++ new_line[xx+1] -= ( new_line[xx+1] * strength ) / 200; ++ } ++ } ++ /* otherwise if the current subpixel is more than threshold, and varies ++ slightly to left or right, darken it */ ++ else if ( sp22 > threshold && ++ sp22 < 255 && ++ ( leftdiff < 10 || ++ rightdiff < 10 ) ) ++ { ++ if ( sp11 <= 2 && ++ sp21 <= 2 && ++ sp31 <= 2 && ++ sp13 >= threshold && ++ sp23 >= threshold && ++ sp33 >= threshold && ++ prevtotal < nexttotal ) ++ new_line[xx] += ( ( 255 - new_line[xx] ) * strength ) / 100; ++ ++ else if ( sp13 <= 2 && ++ sp23 <= 2 && ++ sp33 <= 2 && ++ nexttotal < prevtotal && ++ sp11 >= threshold && ++ sp21 >= threshold && ++ sp31 >= threshold ) ++ new_line[xx] += ( ( 255 - new_line[xx] ) * strength ) / 100; ++ ++ } ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ /* Grayscale filter */ ++ static void ++ _ft_lcd_grayscale_filter ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* line = bitmap->buffer; ++ ++ ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 0; xx < width - 1; xx += 3 ) ++ { ++ FT_UInt total = line [xx] + line [xx + 1] + line [xx + 2]; ++ line[xx] = ( ( 100 - strength ) * line[xx] ++ + strength * ( total / 3 ) ) / 100; ++ line[xx+1] = ( ( 100 - strength ) * line[xx+1] ++ + strength * ( total / 3 ) ) / 100; ++ line[xx+2] = ( ( 100 - strength ) * line[xx+2] ++ + strength * ( total / 3 ) ) / 100; ++ } ++ } ++ } ++ ++ ++ ++ /*************************************************************************/ ++ /* */ ++ /* */ ++ /* */ ++ /* */ ++ /* */ ++ /* */ ++ ++ ++ typedef struct SA_Rule_ ++ { ++ const char family[32]; ++ const int ppem[5]; ++ ++ } SA_Rule; ++ ++#define STEM_WIDTH_2_PPEM 18 ++#define MAX_PPEM 100 ++ ++ ++ ++/* "Font name", {ppem where stem width becomes 1, ++ * ppem where stem width becomes 2... etc.} */ ++/* 100 means auto-calculate */ ++#define SNAPPING_STEM_WIDTHS_RULES_SIZE 21 ++ SA_Rule SNAPPING_STEM_WIDTHS_Rules ++ [SNAPPING_STEM_WIDTHS_RULES_SIZE] = ++ { ++ { "Andale Mono", {10, 21, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Arial Narrow", {10, 21, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Calibri", {10, 19, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Cantarell", {10, 22, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Century Gothic", {10, 22, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Comfortaa", {10, 19, 22, MAX_PPEM, MAX_PPEM} }, ++ { "Consolas", {10, 20, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Corbel", {10, 21, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Futura", {10, 14, STEM_WIDTH_2_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Gill Sans", {10, 17, STEM_WIDTH_2_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Helvetica CY", {10, 23, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Inconsolata", {10, 23, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Liberation Sans Narrow", {10, 22, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Liberation Sans", {10, 19, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Lucida Grande", {10, 16, STEM_WIDTH_2_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Lucida Sans Unicode", {10, 16, STEM_WIDTH_2_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Luxi Sans", {10, 17, STEM_WIDTH_2_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Open Sans", {10, 20, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Rokkitt", {10, 21, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Segoe UI", {10, 23, MAX_PPEM, MAX_PPEM, MAX_PPEM} }, ++ { "Trebuchet MS", {10, 17, STEM_WIDTH_2_PPEM, MAX_PPEM, MAX_PPEM} }, ++ }; ++ ++ ++/* "Font name", {ppem, scale_up=1|scale_down=0} */ ++#define SNAPPING_STEM_SCALING_RULES_SIZE 31 ++ SA_Rule SNAPPING_STEM_SCALING_Rules ++ [SNAPPING_STEM_SCALING_RULES_SIZE] = ++ { ++ { "Andale Mono", {11, 1,} }, ++ { "Bitstream Vera Sans", {12, 1,} }, ++ { "Calibri", {15, 1,} }, ++ { "Calibri", {17, 1,} }, ++ { "Calibri", {18, 1,} }, ++ { "Candara", {14, 1,} }, ++ { "Candara", {17, 1,} }, ++ { "Canwell", {13, 0,} }, ++ { "Comfortaa", {11, 0,} }, ++ { "Consolas", {11, 1,} }, ++ { "DejaVu Sans", {12, 1,} }, ++ { "Freesans", {16, 0,} }, ++ { "Freeserif", {13, 1,} }, ++ { "Freeserif", {17, 1,} }, ++ { "Inconsolata", {12, 1,} }, ++ { "Inconsolata", {15, 1,} }, ++ { "Lucida Grande", {13, 1,} }, ++ { "Myriad Pro", {14, 1,} }, ++ { "Myriad Pro", {17, 1,} }, ++ { "Nina", {11, 0,} }, ++ { "Nina", {12, 0,} }, ++ { "Nina", {13, 0,} }, ++ { "Optima", {17, 1,} }, ++ { "Raleway", {15, 0,} }, ++ { "Samba", {11, 0,} }, ++ { "Times New Roman", {17, 1,} }, ++ { "Trebuchet MS", {17, 0,} }, ++ { "Trebuchet MS", {13, 0,} }, ++ { "Trebuchet MS", {20, 1,} }, ++ { "Verdana", {12, 1,} }, ++ { "Verdana", {15, 1,} }, ++ }; ++ ++ ++/* "Font name", {ppem, scale_up=1|scale_down=0} */ ++#define SNAPPING_M_RULES_SIZE 9 ++ SA_Rule SNAPPING_M_Rules ++ [SNAPPING_M_RULES_SIZE] = ++ { ++ { "Courier New", {13, 1,} }, ++ { "Courier New", {14, 1,} }, ++ { "Courier", {13, 1,} }, ++ { "Courier", {14, 1,} }, ++ { "Droid Sans Mono", {12, 0,} }, ++ { "Bitstream Vera Sans", {12, 0,} }, ++ { "DejaVu Sans", {12, 0,} }, ++ { "Essential PragmataPro", {13, 0,} }, ++ { "Essential PragmataPro", {14, 0,} }, ++ }; ++ ++ ++/* "Font name", {ppem, ppem} */ ++#define SNAPPING_SYNTHESIZE_STEMS_RULES_SIZE 1 ++ SA_Rule SNAPPING_SYNTHESIZE_STEMS_Rules ++ [SNAPPING_SYNTHESIZE_STEMS_RULES_SIZE] = ++ { ++ { "---", {13, 13,} }, ++ }; ++ ++ ++/* "Font name", {ppem, ppem} */ ++#define SNAPPING_NO_BEARING_CORRECTION_RULES_SIZE 1 ++ SA_Rule SNAPPING_NO_BEARING_CORRECTION_Rules ++ [SNAPPING_NO_BEARING_CORRECTION_RULES_SIZE] = ++ { ++ { "Times New Roman", {0, 100,} }, ++ }; ++ ++ ++/* "Font name", {ppem, ppem} */ ++#define SNAPPING_EDGE_DETECTION_RULES_SIZE 8 ++ SA_Rule SNAPPING_EDGE_DETECTION_Rules ++ [SNAPPING_EDGE_DETECTION_RULES_SIZE] = ++ { ++ { "Tahoma", {11, 11,} }, ++ { "Courier New", {10, 12,} }, ++ { "Arial", {11, 11,} }, ++ { "Arial", {13, 13,} }, ++ { "Liberation Sans", {11, 11,} }, ++ { "FreeSans", {11, 11,} }, ++ { "FreeSans", {13, 13,} }, ++ { "Palatino Linotype", {0, 100,} }, ++ }; ++ ++/* "Font name", {ppem, translate_value} */ ++#define SNAPPING_STEM_TRANSLATING_RULES_SIZE 6 ++ SA_Rule SNAPPING_STEM_TRANSLATING_Rules ++ [SNAPPING_STEM_TRANSLATING_RULES_SIZE] = ++ { ++ { "Arial", {11, 32,} }, ++ { "Arial Unicode MS", {11, 32,} }, ++ { "FreeSans", {11, 32,} }, ++ { "Arimo", {11, 32,} }, ++ { "Liberation Sans", {11, 32,} }, ++ { "Tahoma", {11, 32,} }, ++ }; ++ ++/* "Font name", {ppem, translate_value} */ ++#define SNAPPING_STEM_TRANSLATING_ONLY_RULES_SIZE 74 ++ SA_Rule SNAPPING_STEM_TRANSLATING_ONLY_Rules ++ [SNAPPING_STEM_TRANSLATING_ONLY_RULES_SIZE] = ++ { ++ { "Arial Unicode MS", {10, 16,} }, ++ { "Arial Unicode MS", {8, 32,} }, ++ { "Arial Unicode MS", {9, 32,} }, ++ { "Arial", {10, 16,} }, ++ { "Arial", {8, 32,} }, ++ { "Arial", {9, 32,} }, ++ { "Arial", {16, -24,} }, ++ { "Arimo", {10, 8,} }, ++ { "Arimo", {8, 32,} }, ++ { "Arimo", {9, 32,} }, ++ { "Bitstream Vera Sans", {8, 16,} }, ++ { "Calibri", {10, 16,} }, ++ { "Calibri", {15, 0,} }, ++ { "Candara", {10, 16,} }, ++ { "Cantarell", {11, 0} }, ++ { "Cantarell", {12, 0} }, ++ { "Consolas", {8, 32,} }, ++ { "Consolas", {9, 32,} }, ++ { "Corbel", {10, 16,} }, ++ { "Courier", {13, 16,} }, ++ { "Courier", {15, 0,} }, ++ { "Dejavu Sans Mono", {7, 16,} }, ++ { "Dejavu Sans Mono", {8, 32,} }, ++ { "Dejavu Sans Mono", {9, 16,} }, ++ { "Dejavu Sans", {8, 16,} }, ++ { "Dejavu Sans", {15, -20,} }, ++ { "Droid Sans", {8, 16,} }, ++ { "Droid Sans", {9, 16,} }, ++ { "Freesans", {10, 16,} }, ++ { "Freesans", {9, 8,} }, ++ { "Georgia", {13, 16,} }, ++ { "Georgia", {14, 16,} }, ++ { "Georgia", {15, 0,} }, ++ { "Inconsolata", {10, 24,} }, ++ { "Inconsolata", {9, 32,} }, ++ { "Liberation Sans", {10, 8,} }, ++ { "Liberation Sans", {8, 32,} }, ++ { "Liberation Sans", {9, 32,} }, ++ { "Lucida Grande", {13, 24,} }, ++ { "Lucida Grande", {14, 24,} }, ++ { "Lucida Grande", {8, 16,} }, ++ { "Lucida Grande", {9, 16,} }, ++ { "Lucida Sans Unicode", {13, 24,} }, ++ { "Lucida Sans Unicode", {14, 24,} }, ++ { "Lucida Sans Unicode", {8, 16,} }, ++ { "Lucida Sans Unicode", {9, 16,} }, ++ { "Microsoft Sans Serif", {10, 16,} }, ++ { "Microsoft Sans Serif", {8, 32,} }, ++ { "Microsoft Sans Serif", {9, 32,} }, ++ { "Myriad Pro", {10, 16,} }, ++ { "Myriad Pro", {11, 0,} }, ++ { "Myriad Pro", {9, 16,} }, ++ { "Open Sans", {10, 16,} }, ++ { "Open Sans", {9, 16,} }, ++ { "Optima", {10, 0} }, ++ { "Optima", {11, 0} }, ++ { "Optima", {12, 0} }, ++ { "Segoe UI", {10, 0,} }, ++ { "Segoe UI", {7, 32,} }, ++ { "Segoe UI", {8, 16,} }, ++ { "Segoe UI", {9, 24,} }, ++ { "Tahoma", {7, 32,} }, ++ { "Tahoma", {8, 32,} }, ++ { "Tahoma", {9, 32,} }, ++ { "Times New Roman", {17, 8,} }, ++ { "Trebuchet MS", {10, 16,} }, ++ { "Trebuchet MS", {11, 0,} }, ++ { "Trebuchet MS", {8, 32,} }, ++ { "Trebuchet MS", {9, 32,} }, ++ { "Verdana", {8, 16,} }, ++ { "Verdana", {15, 16,} }, ++ { "Verdana", {14, 32,} }, ++ { "Verdana", {18, 32,} }, ++ { "Verdana", {19, 24,} }, ++ }; ++ ++ ++/* "Font name", {start ppem, end ppem} */ ++#define ALWAYS_USE_100_RULES_SIZE 46 ++ SA_Rule ALWAYS_USE_100_Rules ++ [ALWAYS_USE_100_RULES_SIZE] = ++ { ++ { "Andale Mono", {0, MAX_PPEM,} }, ++ { "Arial Unicode MS", {0, MAX_PPEM,} }, ++ { "Arial", {0, MAX_PPEM,} }, ++ { "Arimo", {0, MAX_PPEM,} }, ++ { "Bitstream Vera Sans Mono", {0, MAX_PPEM,} }, ++ { "Bitstream Vera Sans", {10, 14,} }, ++ { "Bitstream Vera Sans", {16, 17,} }, ++ { "Calibri", {23, MAX_PPEM,} }, ++ { "Consolas", {0, MAX_PPEM,} }, ++ { "Courier New", {12, 12,} }, ++ { "Courier", {0, MAX_PPEM,} }, ++ { "Cousine", {0, MAX_PPEM,} }, ++ { "DejaVu Sans Mono", {0, MAX_PPEM,} }, ++ { "DejaVu Sans", {10, 14,} }, ++ { "DejaVu Sans", {16, 17,} }, ++ { "Droid Sans", {12, 12,} }, ++ { "Droid Sans", {15, 15,} }, ++ { "FreeMono", {0, MAX_PPEM,} }, ++ { "FreeSans", {0, MAX_PPEM,} }, ++ { "Liberation Mono", {0, MAX_PPEM,} }, ++ { "Lucida Console", {0, MAX_PPEM,} }, ++ { "Luxi Sans", {13, 13,} }, ++ { "Microsoft Sans Serif", {0, MAX_PPEM,} }, ++ { "Monaco", {0, MAX_PPEM,} }, ++ { "Segoe UI", {11, 12,} }, ++ { "Segoe UI", {14, 14,} }, ++ { "Tahoma", {11, 11,} }, ++ { "Tahoma", {14, MAX_PPEM,} }, ++ { "Times New Roman", {14, 14,} }, ++ { "Times New Roman", {16, 16,} }, ++ { "Trebuchet MS", {13, 13,} }, ++ { "Ubuntu", {12, 13,} }, ++ { "Ubuntu", {15, 15,} }, ++ { "Verdana", {0, 14,} }, ++ { "Verdana", {16, MAX_PPEM,} }, ++ { "Pragmata", {0, MAX_PPEM,} }, ++ { "Essential PragmataPro", {0, MAX_PPEM,} }, ++ }; ++ ++ ++ ++ ++#define AUTOHINT_BRIGHTNESS_RULES_SIZE 3 ++ SA_Rule BRIGHTNESS_Rules ++ [AUTOHINT_BRIGHTNESS_RULES_SIZE] = ++ { ++ { "Baskerville", {0, -20,} }, ++ { "Garamond", {0, -20,} }, ++ { "Optima", {0, -20,} }, ++ }; ++ ++#define AUTOHINT_CONTRAST_RULES_SIZE 3 ++ SA_Rule CONTRAST_Rules ++ [AUTOHINT_CONTRAST_RULES_SIZE] = ++ { ++ { "Baskerville", {0, 25,} }, ++ { "Garamond", {0, 25,} }, ++ { "Optima", {0, 25,} }, ++ }; ++ ++#if 0 ++#define STEM_SPACING_RULES_SIZE 3 ++ SA_Rule STEM_SPACING_Rules ++ [STEM_SPACING_RULES_SIZE] = ++ { ++ { "Tahoma", {10, 12, 18, 18, 30} }, ++ { "Arial", {10, 11, 23, 25, 30} }, ++ { "Freesans", {10, 12, 18, 18, 30} }, ++ }; ++ ++#define STEM_START_RULES_SIZE 3 ++ SA_Rule STEM_START_Rules ++ [STEM_START_RULES_SIZE] = ++ { ++ { "Tahoma", {14, 17, 30, 100, 100} }, ++ { "Arial", {11, 18, 23, 30, 30} }, ++ { "Freesans", {10, 18, 18, 25, 30} }, ++ }; ++#endif ++ ++ typedef struct Stem_Data_ ++ { ++ FT_Int stem_width; ++ FT_Int stem_spacing; ++ FT_Int stem_start; ++ FT_Int stem_scaling; ++ FT_Int stem_translating_only; ++ FT_Int stem_translating; ++ FT_Int brightness; ++ FT_Int contrast; ++ FT_Bool use_100; ++ FT_Bool synth_stems; ++ FT_Bool edge_detection; ++ FT_Bool bearing_correction; ++ FT_Int m; ++ } Stem_Data; ++ ++ ++ typedef struct Stem_Segment_ ++ { ++ FT_Long x1; ++ FT_Long x2; ++ FT_Int y; ++ } Stem_Segment; ++ ++ typedef struct Stem_Center_ ++ { ++ FT_Long x; ++ FT_Long y; ++ FT_Long w; ++ FT_Long x1; ++ FT_Long x2; ++ } Stem_Center; ++ ++ typedef struct Stem_ ++ { ++ FT_Long center; ++ FT_Long count; ++ FT_Long rcount; /* used to count within a range in possible stems */ ++ FT_Long width; ++ FT_Long height; ++ FT_Short zone; /* 1 2 or 3 */ ++ FT_Bool generated; ++ } Stem; ++ ++ ++ static void ++ swap_stem ( Stem* s1, Stem* s2 ) ++ { ++ Stem s; ++ s.center = s1->center; ++ s.count = s1->count; ++ s.rcount = s1->rcount; ++ s.width = s1->width; ++ s.zone = s1->zone; ++ s.generated = s1->generated; ++ ++ s1->center = s2->center; ++ s1->count = s2->count; ++ s1->rcount = s2->rcount; ++ s1->width = s2->width; ++ s1->zone = s2->zone; ++ s1->generated = s2->generated; ++ ++ s2->center = s.center; ++ s2->count = s.count; ++ s2->rcount = s.rcount; ++ s2->width = s.width; ++ s2->zone = s.zone; ++ s2->generated = s.generated; ++ } ++ ++ ++ FT_LOCAL_DEF( void ) ++ sa_fill_known_stem_values ( ++ FT_String* family, ++ int ppem, ++ FT_String* style, ++ FT_UInt num_stems, ++ Stem_Data* known_stem_values ) ++ { ++ FT_Int i, j; ++ if (verbose) printf("%s ", family); ++ ++ i = 0; ++ while ( i < SNAPPING_STEM_WIDTHS_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( SNAPPING_STEM_WIDTHS_Rules[i].family, ++ family ) == 0 ) ) ++ { ++ j = 0; ++ known_stem_values->stem_width = 1; ++ ++ while (j < 4) ++ { ++ if ( SNAPPING_STEM_WIDTHS_Rules[i].ppem[j] == MAX_PPEM ) ++ { ++ known_stem_values->stem_width = -1; /* use default */ ++ j = 5; ++ i = SNAPPING_STEM_WIDTHS_RULES_SIZE; ++ } ++ else if ( ppem < SNAPPING_STEM_WIDTHS_Rules[i].ppem[j] ) ++ { ++ known_stem_values->stem_width = j; ++ j = 5; ++ i = SNAPPING_STEM_WIDTHS_RULES_SIZE; ++ } ++ j++; ++ } ++ } ++ i++; ++ } ++ ++ i = 0; ++ while ( i < SNAPPING_STEM_SCALING_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( SNAPPING_STEM_SCALING_Rules[i].family, ++ family ) == 0 ) ) ++ { ++ known_stem_values->stem_scaling = -1; /* default */ ++ ++ if ( ppem == SNAPPING_STEM_SCALING_Rules[i].ppem[0] ) ++ { ++ known_stem_values->stem_scaling ++ = SNAPPING_STEM_SCALING_Rules[i].ppem[1]; ++ i = SNAPPING_STEM_SCALING_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ ++ i = 0; ++ while ( i < SNAPPING_M_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( SNAPPING_M_Rules[i].family, family ) == 0 ) ) ++ { ++ known_stem_values->m = -1; /* default */ ++ ++ if ( ppem == SNAPPING_M_Rules[i].ppem[0] ) ++ { ++ known_stem_values->m = SNAPPING_M_Rules[i].ppem[1]; ++ i = SNAPPING_M_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ i = 0; ++ while ( i < SNAPPING_STEM_TRANSLATING_ONLY_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( SNAPPING_STEM_TRANSLATING_ONLY_Rules[i].family, ++ family ) == 0 ) ) ++ { ++ known_stem_values->stem_translating_only = -1024; /* default */ ++ ++ if ( ppem == SNAPPING_STEM_TRANSLATING_ONLY_Rules[i].ppem[0] || ++ SNAPPING_STEM_TRANSLATING_ONLY_Rules[i].ppem[0] == 0 ) ++ { ++ known_stem_values->stem_translating_only ++ = SNAPPING_STEM_TRANSLATING_ONLY_Rules[i].ppem[1]; ++ i = SNAPPING_STEM_TRANSLATING_ONLY_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ i = 0; ++ while ( i < SNAPPING_STEM_TRANSLATING_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( SNAPPING_STEM_TRANSLATING_Rules[i].family, ++ family ) == 0 ) ) ++ { ++ known_stem_values->stem_translating = 0; /* default */ ++ ++ if ( ppem == SNAPPING_STEM_TRANSLATING_Rules[i].ppem[0] || ++ SNAPPING_STEM_TRANSLATING_Rules[i].ppem[0] == 0 ) ++ { ++ known_stem_values->stem_translating ++ = SNAPPING_STEM_TRANSLATING_Rules[i].ppem[1]; ++ i = SNAPPING_STEM_TRANSLATING_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ ++ i = 0; ++ while ( i < ALWAYS_USE_100_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( ALWAYS_USE_100_Rules[i].family, family ) == 0 ) ) ++ { ++ known_stem_values->use_100 = FALSE; /* default */ ++ ++ if ( ppem >= ALWAYS_USE_100_Rules[i].ppem[0] && ++ ppem <= ALWAYS_USE_100_Rules[i].ppem[1] ) ++ { ++ known_stem_values->use_100 = TRUE; ++ i = ALWAYS_USE_100_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ ++ i = 0; ++ while ( i < SNAPPING_SYNTHESIZE_STEMS_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( SNAPPING_SYNTHESIZE_STEMS_Rules[i].family, ++ family ) == 0 ) ) ++ { ++ known_stem_values->synth_stems = FALSE; /* default */ ++ ++ if ( ppem >= SNAPPING_SYNTHESIZE_STEMS_Rules[i].ppem[0] && ++ ppem <= SNAPPING_SYNTHESIZE_STEMS_Rules[i].ppem[1] ) ++ { ++ known_stem_values->synth_stems = TRUE; ++ i = SNAPPING_SYNTHESIZE_STEMS_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ ++ i = 0; ++ while ( i < SNAPPING_EDGE_DETECTION_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( SNAPPING_EDGE_DETECTION_Rules[i].family, ++ family ) == 0 ) ) ++ { ++ known_stem_values->edge_detection = FALSE; /* default */ ++ ++ if ( ppem >= SNAPPING_EDGE_DETECTION_Rules[i].ppem[0] && ++ ppem <= SNAPPING_EDGE_DETECTION_Rules[i].ppem[1] ) ++ { ++ known_stem_values->edge_detection = TRUE; ++ i = SNAPPING_EDGE_DETECTION_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ ++ i = 0; ++ while ( i < SNAPPING_NO_BEARING_CORRECTION_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( SNAPPING_NO_BEARING_CORRECTION_Rules[i].family, ++ family ) == 0 ) ) ++ { ++ known_stem_values->bearing_correction = TRUE; /* default */ ++ ++ if ( ppem >= SNAPPING_NO_BEARING_CORRECTION_Rules[i].ppem[0] && ++ ppem <= SNAPPING_NO_BEARING_CORRECTION_Rules[i].ppem[1] ) ++ { ++ known_stem_values->bearing_correction = FALSE; ++ i = SNAPPING_NO_BEARING_CORRECTION_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ ++#if 0 ++ i = 0; ++ while ( i < AUTOHINT_BRIGHTNESS_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( BRIGHTNESS_Rules[i].family, family ) == 0 ) ) ++ { ++ known_stem_values->brightness = 0.0; ++ ++ if ( ppem == BRIGHTNESS_Rules[i].ppem[0] || ++ BRIGHTNESS_Rules[i].ppem[0] == 0 ) ++ { ++ known_stem_values->brightness = BRIGHTNESS_Rules[i].ppem[1]; ++ i = AUTOHINT_BRIGHTNESS_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ i = 0; ++ while ( i < AUTOHINT_CONTRAST_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( CONTRAST_Rules[i].family, family ) == 0 ) ) ++ { ++ known_stem_values->contrast = 0.0; ++ ++ if ( ppem == CONTRAST_Rules[i].ppem[0] || ++ CONTRAST_Rules[i].ppem[0] == 0 ) ++ { ++ known_stem_values->contrast = CONTRAST_Rules[i].ppem[1]; ++ i = AUTOHINT_CONTRAST_RULES_SIZE; ++ } ++ } ++ i++; ++ } ++ ++ for ( i = 0; i <= STEM_SPACING_RULES_SIZE; i++ ) ++ { ++ if ( family && ++ ( strcasecmp( STEM_SPACING_Rules[i].family, family ) == 0 ) ) ++ { ++ j = 0; ++ known_stem_values->stem_spacing = 2; /* default */ ++ ++ while (j < 4) ++ { ++ if ( ppem < STEM_SPACING_Rules[i].ppem[j] ) ++ { ++ known_stem_values->stem_spacing = j; ++ j = 5; ++ } ++ j++; ++ } ++ } ++ } ++ ++ ++ for ( i = 0; i <= STEM_START_RULES_SIZE; i++ ) ++ { ++ if ( family && ++ ( strcasecmp( STEM_START_Rules[i].family, family ) == 0 ) ) ++ { ++ j = 0; ++ known_stem_values->stem_start = 1; /* default */ ++ ++ while (j < 4) ++ { ++ if ( ppem < STEM_START_Rules[i].ppem[j] ) ++ { ++ known_stem_values->stem_start = j; ++ j = 5; ++ } ++ j++; ++ } ++ } ++ } ++#endif ++ } ++ ++ ++ FT_LOCAL_DEF( FT_Int ) ++ get_contrast ( FT_String* family, ++ int ppem ) ++ { ++ FT_Int i; ++ ++ ++ if ( verbose ) ++ printf( "%s ", family ); ++ ++ i = 0; ++ while ( i < AUTOHINT_CONTRAST_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( CONTRAST_Rules[i].family, family ) == 0 ) ) ++ { ++ if ( ppem == CONTRAST_Rules[i].ppem[0] || ++ CONTRAST_Rules[i].ppem[0] == 0 ) ++ return CONTRAST_Rules[i].ppem[1]; ++ } ++ i++; ++ } ++ return 0; ++ } ++ ++ ++ FT_LOCAL_DEF( FT_Int ) ++ get_brightness ( FT_String* family, ++ int ppem ) ++ { ++ FT_Int i; ++ ++ ++ if ( verbose ) ++ printf("%s ", family); ++ ++ i = 0; ++ while ( i < AUTOHINT_BRIGHTNESS_RULES_SIZE ) ++ { ++ if ( family && ++ ( strcasecmp( BRIGHTNESS_Rules[i].family, family ) == 0 ) ) ++ { ++ if ( ppem == BRIGHTNESS_Rules[i].ppem[0] || ++ BRIGHTNESS_Rules[i].ppem[0] == 0 ) ++ return BRIGHTNESS_Rules[i].ppem[1]; ++ } ++ i++; ++ } ++ return 0; ++ } ++ ++ ++ /* Stem alignment for bitmaps; A hack with very nice results */ ++ /* Ideally this could be implemented on the outline, prior to ++ * rasterization. Possible future enhancement is to use the ++ * warper code to achieve this */ ++ static void ++ _lcd_stem_align ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_GlyphSlot slot, ++ FT_Long* translate_value, ++ float* scale_value, ++ FT_UInt alignment_strength, ++ FT_UInt fitting_strength, ++ float* embolden_value ++ ) ++ { ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ ++ Stem_Segment* segments; ++ Stem_Segment* leftmost_segment; ++ Stem_Segment* rightmost_segment; ++ Stem_Segment* leftmost_segment_not_extrema; ++ Stem_Segment* rightmost_segment_not_extrema; ++ Stem* stems; ++ Stem* possible_stems; ++ Stem* leftmost_stem; ++ Stem* rightmost_stem; ++ Stem_Data* known_stem_values; ++ Stem_Center* centers; ++ FT_Long leftmost_point = width * 256; ++ FT_Long rightmost_point = 0; ++ FT_Long leftmost_point_not_extrema = width * 256; ++ FT_Long rightmost_point_not_extrema = 0; ++ FT_Long num_segments = 0; ++ FT_Long num_centers = 0; ++ FT_Long stem_centers[width * 256]; ++ FT_UInt h; ++ FT_ULong valid_stems = 0, valid_possible_stems = 0; ++ FT_Long center, stem_matches, stem_matches_ledge; ++ FT_Long stem_matches_redge, next_center, last_matching_center; ++ FT_Long last_matching_ledge, last_matching_redge, this_center; ++ FT_Int max_strength; ++ FT_Byte* line = bitmap->buffer; ++ FT_UInt current_value = 0; ++ FT_UInt xx; ++ FT_Long linearHoriAdvance = slot->linearHoriAdvance >> 10; ++ ++ FT_Int m_horiBearingX = slot->metrics.horiBearingX; ++ FT_Int m_horiAdvance = slot->metrics.horiAdvance; ++ FT_Int m_width = slot->metrics.width; ++ FT_Pos one_pixel = 768; ++ FT_Pos one_third_pixel = 256; ++ FT_Int columns_per_pixel = 3; ++ /*FT_Int extra_columns = 6;*/ ++ ++ /* on / off flags for testing different features */ ++ FT_Bool strategy_translate_using_closest_stem = TRUE; ++ FT_Bool strategy_scale_to_closest_centers = FALSE; ++ FT_Bool strategy_scale_to_closest_centers_up_only = FALSE; ++ FT_Bool strategy_always_use_distance_ceiling = FALSE; ++ FT_Bool strategy_auto_change_center_offset = TRUE; ++ FT_Bool strategy_use_m_control = FALSE; ++ FT_Bool strategy_correct_out_of_bounds_outlines = FALSE; ++ FT_Bool strategy_also_use_edge_detection_for_stems = FALSE; ++ FT_Bool strategy_use_strengths = TRUE; ++ FT_Bool strategy_synthesize_stems = FALSE; ++ FT_Bool strategy_bearing_correction = TRUE; ++ FT_Bool strategy_use_d_correction = TRUE; ++ FT_Bool strategy_fit_to_width = FALSE; ++ /*FT_Bool strategy_center_glyph = FALSE;*/ ++ ++ FT_Bool has_serifs = FALSE; ++ FT_Bool autohinted = FALSE; ++ ++ const FT_Int MIN_PPEM = 7; ++ /*const FT_Int MAX_PPEM = 100;*/ ++ const FT_Int MAX_STEMS = 3; ++ FT_Int ppem = 0; ++ ++ FT_Bool checked_use_known_settings_on_selected_fonts_env = FALSE; ++ FT_Bool use_known_settings_on_selected_fonts = FALSE; ++ ++ int cur_width; ++ char *cur_width_env = getenv( "CUR_WIDTH" ); ++ ++ ++ ++ if ( cur_width_env != NULL ) ++ { ++ sscanf ( cur_width_env, "%d", &cur_width ); ++ if ( cur_width != 0 ) ++ autohinted = TRUE; ++ } ++ ++ /* reset to default */ ++ *scale_value = 1.0; ++ ++ if ( !checked_use_known_settings_on_selected_fonts_env ) ++ { ++ char *use_known_settings_on_selected_fonts_env = ++ getenv( "INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS" ); ++ if ( use_known_settings_on_selected_fonts_env != NULL ) ++ { ++ if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "default" ) != 0 ) ++ { ++ if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "true") == 0 ) ++ use_known_settings_on_selected_fonts = TRUE; ++ else if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "1") == 0 ) ++ use_known_settings_on_selected_fonts = TRUE; ++ else if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "on") == 0 ) ++ use_known_settings_on_selected_fonts = TRUE; ++ else if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "yes") == 0 ) ++ use_known_settings_on_selected_fonts = TRUE; ++ } ++ } ++ checked_use_known_settings_on_selected_fonts_env = TRUE; ++ } ++ ++ ++ /* Simply return in odd cases where these don't seem to be set */ ++ /* Flash and some pdf viewers will crash otherwise */ ++ if ( !slot->face || ++ !slot->face->size || ++ !slot->face->size->metrics.x_ppem ) ++ return; ++ ++ if ( slot->face->size->metrics.x_ppem > MAX_PPEM ) ++ return; ++ ++ if ( slot->face->size->metrics.x_ppem < MIN_PPEM ) ++ return; ++ ++ if ( !FT_IS_SCALABLE( slot->face ) ) ++ return; ++ ++ ppem = slot->face->size->metrics.x_ppem; ++ ++ ++ /* only perform alignment on styles we know, that aren't bold or italic */ ++ /* perhaps detection could be added on those that are not set? */ ++ /* Require certain ppems for narrow and light fonts */ ++ if( slot->face->style_name ) ++ { ++ if ( strcasestr( slot->face->style_name, "Italic" ) || ++ strcasestr( slot->face->style_name, "Oblique" ) || ++ strcasestr( slot->face->style_name, "Script" ) || ++ strcasestr( slot->face->style_name, "Handwriting" ) || ++ strcasestr( slot->face->style_name, "Bold" ) || ++ strcasestr( slot->face->style_name, "Black" ) || ++ ( ( strcasestr( slot->face->style_name, "Extra Thin" ) || ++ strcasestr( slot->face->style_name, "Extra Light" ) ) && ++ ppem < 10 ) || ++ ( strcasestr( slot->face->style_name, "Thin" ) ++ && ppem < 10 ) || ++ ( strcasestr( slot->face->style_name, "Light" ) ++ && ppem < 10 ) || ++ ( strcasestr( slot->face->style_name, "Narrow" ) ++ && ppem < 15 ) || ++ ( strcasestr( slot->face->style_name, "Condensed" ) ++ && ppem < 20 ) ) ++ return; ++ } ++ ++ if( slot->face->family_name ) ++ { ++ if ( strcasestr( slot->face->family_name, "Italic" ) || ++ strcasestr( slot->face->family_name, "Oblique" ) || ++ strcasestr( slot->face->family_name, "Script" ) || ++ strcasestr( slot->face->family_name, "Handwriting" ) || ++ strcasestr( slot->face->family_name, "Bold" ) || ++ strcasestr( slot->face->family_name, "Black" ) || ++ ( ( strcasestr( slot->face->family_name, "Extra Thin" ) || ++ strcasestr( slot->face->family_name, "Extra Light" ) ) && ++ ppem < 10 ) || ++ ( strcasestr( slot->face->family_name, "Thin" ) ++ && ppem < 10 ) || ++ ( strcasestr( slot->face->family_name, "Light" ) ++ && ppem < 10 ) || ++ ( strcasestr( slot->face->family_name, "Narrow" ) ++ && ppem < 15 ) || ++ ( strcasestr( slot->face->family_name, "Condensed" ) ++ && ppem < 20 ) ) ++ return; ++ } ++ else if ( slot->face->style_flags ) ++ { ++ if ( slot->face->style_flags & FT_STYLE_FLAG_ITALIC || ++ slot->face->style_flags & FT_STYLE_FLAG_BOLD || ++ FT_IS_TRICKY( slot->face ) ) ++ return; ++ } ++ else return; ++ ++ if ( slot->face->family_name ) ++ { ++ if ( strcasestr(slot->face->family_name, "Courier" ) || ++ strcasestr(slot->face->family_name, "Serif" ) || ++ strcasestr(slot->face->family_name, "Times" ) ) ++ has_serifs = TRUE; ++ } ++ ++ if ( mode != FT_RENDER_MODE_LCD ) ++ { ++ columns_per_pixel = 1; ++ one_pixel = 256; ++ one_third_pixel = 85; ++ /*extra_columns = 0;*/ ++ /* until this can be figured out just return */ ++ /* There are issues with missing glyphs */ ++ return; ++ } ++ /* only look at top 3 for now */ ++ known_stem_values ++ = (Stem_Data*) malloc ( columns_per_pixel * sizeof ( Stem_Data ) ); ++ known_stem_values->stem_spacing = -1; ++ known_stem_values->stem_width = -1; ++ known_stem_values->stem_start = -1; ++ known_stem_values->stem_scaling = -1; ++ known_stem_values->stem_translating_only = -1024; ++ known_stem_values->stem_translating = 0; ++ known_stem_values->brightness = 0; ++ known_stem_values->contrast = 0; ++ known_stem_values->use_100 = FALSE; ++ known_stem_values->m = -1; ++ known_stem_values->synth_stems = FALSE; ++ known_stem_values->bearing_correction = TRUE; ++ ++ if ( use_known_settings_on_selected_fonts ) ++ { ++ sa_fill_known_stem_values ( slot->face->family_name, ++ ppem, slot->face->style_name, ++ valid_stems, known_stem_values ); ++ if ( verbose ) ++ printf ( "width:%d,spacing:%d,start:%d,scaling:%d,translate:%d ", ++ known_stem_values->stem_width, ++ known_stem_values->stem_spacing, ++ known_stem_values->stem_start, ++ known_stem_values->stem_scaling, ++ known_stem_values->stem_translating_only ); ++ } ++ ++ /* translate value may be set for < 10 */ ++ if ( use_known_settings_on_selected_fonts && ++ known_stem_values->stem_translating_only > -1024 ) ++ { ++ *translate_value = known_stem_values->stem_translating_only; ++ return; ++ } ++ ++ if ( use_known_settings_on_selected_fonts && ++ known_stem_values->bearing_correction == FALSE ) ++ strategy_bearing_correction = FALSE; ++ ++ ++ if ( known_stem_values->use_100 || ++ known_stem_values->m >= 0 ) ++ { ++ alignment_strength = fitting_strength = 100; ++ strategy_use_m_control = TRUE; ++ } ++ ++ if ( known_stem_values->edge_detection ) ++ strategy_also_use_edge_detection_for_stems = TRUE; ++ ++ if ( ppem < 9 ) ++ return; ++ if ( ppem > 20 ) ++ strategy_use_m_control = TRUE; ++ ++ /* Allocate */ ++ segments ++ = (Stem_Segment*) malloc( (1) * sizeof ( Stem_Segment ) ); ++ leftmost_segment ++ = (Stem_Segment*) malloc( sizeof ( Stem_Segment ) ); ++ leftmost_segment_not_extrema ++ = (Stem_Segment*) malloc( sizeof ( Stem_Segment ) ); ++ rightmost_segment ++ = (Stem_Segment*) malloc( sizeof ( Stem_Segment ) ); ++ rightmost_segment_not_extrema ++ = (Stem_Segment*) malloc( sizeof ( Stem_Segment ) ); ++ ++ stems = (Stem*) malloc ( MAX_STEMS * sizeof ( Stem ) ); ++ possible_stems = (Stem*) malloc ( MAX_STEMS * sizeof ( Stem ) ); ++ leftmost_stem = (Stem*) malloc ( sizeof (Stem)); ++ rightmost_stem = (Stem*) malloc ( sizeof(Stem)); ++ centers = (Stem_Center*) malloc ( (1) * sizeof ( Stem_Center ) ); ++ ++ if ( verbose ) ++ printf("\n"); ++ ++ /* Initialize */ ++ for ( xx = 0; xx < width * 256; xx += 1 ) ++ stem_centers[xx] = 0; ++ ++ for ( xx = 0; xx < num_segments; xx += 1 ) ++ { ++ segments[xx].x1 = 0; ++ segments[xx].x2 = 0; ++ segments[xx].y = 0; ++ } ++ ++ rightmost_segment->x1 = 0; ++ rightmost_segment->x2 = 0; ++ rightmost_segment->y = 0; ++ leftmost_segment->x1 = 99999999; ++ leftmost_segment->x2 = 0; ++ leftmost_segment->y = 0; ++ ++ rightmost_segment_not_extrema->x1 = 0; ++ rightmost_segment_not_extrema->x2 = 0; ++ rightmost_segment_not_extrema->y = 0; ++ leftmost_segment_not_extrema->x1 = 99999999; ++ leftmost_segment_not_extrema->x2 = 0; ++ leftmost_segment_not_extrema->y = 0; ++ ++ /* Locate stem centers for later processing */ ++ for ( h = (FT_UInt)bitmap->rows; h > 0; h--, line += bitmap->pitch ) ++ { ++ current_value = 0; ++ /* Calculate various sums and stem widths of glyph */ ++ for ( xx = 0; xx < width; xx += 1 ) ++ { ++ /* Reallocate */ ++ segments = (Stem_Segment*) realloc ++ ( segments, ( num_segments + 1 ) * sizeof ( Stem_Segment ) ); ++ ++ /* if line is white, and now has color, it's the start of a stem */ ++ if ( current_value == 0 && line[xx] > 0 ) ++ { ++ /* start of stem */ ++ segments[num_segments].x1 = 256 * xx + ( 255 - line[xx] ); ++ segments[num_segments].y = h; ++ } ++ ++ /* otherwise, if it's currently black and the new value is 0, ++ it's the end of a stem */ ++ else if ( ( current_value > 0 && line[xx] == 0 ) || ++ ( current_value > 0 && xx == width - 1 ) ) ++ { ++ FT_Long stem_center_x; ++ segments[num_segments].x2 = 256 * ( xx - 1 ) + line[xx-1]; ++ ++ if ( xx == width - 1 ) ++ segments[num_segments].x2 += line[xx]; ++ ++ /*stem center is average of start and end of stem */ ++ stem_center_x = ( segments[num_segments].x2 ++ + segments[num_segments].x1 ) / 2; ++ ++ /* Reallocate */ ++ centers = (Stem_Center*) realloc ++ ( centers, ( num_centers + 1 ) * sizeof ( Stem_Center ) ); ++ centers[num_centers].x = stem_center_x; ++ centers[num_centers].y = h; ++ centers[num_centers].x1 = segments[num_segments].x1; ++ centers[num_centers].x2 = segments[num_segments].x2; ++ ++ num_centers++; ++ ++ stem_centers[stem_center_x] += 1; ++ ++ /* Find left and rightmost points for later calculations */ ++ /* OR - Favor ones that aren't on the top or bottom if */ ++ /* possible to prevent v and w from getting caught later */ ++ if ( segments[num_segments].x1 < leftmost_segment->x1 || ++ ( segments[num_segments].y > 1 && ++ segments[num_segments].y < height && ++ segments[num_segments].x1 == leftmost_segment->x1 ) ) ++ { ++ leftmost_segment->x1 = segments[num_segments].x1; ++ leftmost_segment->x2 = segments[num_segments].x2; ++ leftmost_segment->y = h; ++ } ++ if ( segments[num_segments].x2 > rightmost_segment->x2 || ++ ( segments[num_segments].y > 1 && ++ segments[num_segments].y < height && ++ segments[num_segments].x1 == rightmost_segment->x1 ) ) ++ { ++ rightmost_segment->x1 = segments[num_segments].x1; ++ rightmost_segment->x2 = segments[num_segments].x2; ++ rightmost_segment->y = h; ++ } ++ ++ if ( segments[num_segments].x1 ++ < leftmost_segment_not_extrema->x1 || ++ ( segments[num_segments].y > 1 && ++ segments[num_segments].y < height && ++ segments[num_segments].x1 ++ == leftmost_segment_not_extrema->x1 && ++ h < (FT_UInt)bitmap->rows && h > 0 ) ) ++ { ++ leftmost_segment_not_extrema->x1 = segments[num_segments].x1; ++ leftmost_segment_not_extrema->x2 = segments[num_segments].x2; ++ leftmost_segment_not_extrema->y = h; ++ } ++ if ( segments[num_segments].x2 ++ > rightmost_segment_not_extrema->x2 || ++ ( segments[num_segments].y > 1 && ++ segments[num_segments].y < height && ++ segments[num_segments].x1 ++ == rightmost_segment_not_extrema->x1 && ++ h < (FT_UInt)bitmap->rows && h > 0 ) ) ++ { ++ rightmost_segment_not_extrema->x1 = segments[num_segments].x1; ++ rightmost_segment_not_extrema->x2 = segments[num_segments].x2; ++ rightmost_segment_not_extrema->y = h; ++ } ++ ++ if ( segments[num_segments].x1 < leftmost_point ) ++ leftmost_point = segments[num_segments].x1; ++ ++ if ( segments[num_segments].x2 > rightmost_point ) ++ rightmost_point = segments[num_segments].x2; ++ ++ if ( segments[num_segments].x1 < leftmost_point_not_extrema && ++ h < (FT_UInt)bitmap->rows && h > 0 ) ++ leftmost_point_not_extrema = segments[num_segments].x1; ++ ++ if ( segments[num_segments].x2 > rightmost_point_not_extrema && ++ h < (FT_UInt)bitmap->rows && h > 0 ) ++ rightmost_point_not_extrema = segments[num_segments].x2; ++ ++ num_segments++; ++ } ++ /* else - other conditions - need some error checking here */ ++ current_value = line[xx]; ++ } ++ } ++ ++ /* initialize */ ++ for ( xx = 0; xx < MAX_STEMS; xx +=1 ) ++ { ++ stems[xx].center = 0; ++ stems[xx].count = 0; ++ stems[xx].width = 0; ++ stems[xx].height = 0; ++ possible_stems[xx].center = 0; ++ possible_stems[xx].count = 0; ++ possible_stems[xx].width = 0; ++ possible_stems[xx].height = 0; ++ } ++ ++ valid_stems = 0; ++ valid_possible_stems = 0; ++ ++ /* Determine which centers belong to stems */ ++ center = 0; ++ ++ while ( center < num_centers ) ++ { ++ /* slope at within which to consider a point part of a stem */ ++ /*const FT_UInt slope = 1; ++ const FT_UInt topslope = (256 * 3) / 10; */ ++ ++ /* 10 to 20 with 4 matches seems good, */ ++ /* but 1 or 2 with 3 stems needs to somehow get included */ ++ FT_Int deviation1 = 5; ++ FT_Int deviation2=-1, requirement1 = 4, stem_match_requirement = 3; ++ FT_Int best_height = 0, center_difference_in_height; ++ FT_Int center_difference_in_width, valid_center_average; ++ FT_Int smallest_width_ledge, smallest_width_redge; ++ FT_Int x1_difference_in_width, x2_difference_in_width; ++ FT_Bool large_gap_found = FALSE, no_gap_found = FALSE; ++ FT_Bool large_gap_found_ledge = FALSE, no_gap_found_ledge = FALSE; ++ FT_Bool large_gap_found_redge = FALSE, no_gap_found_redge = FALSE; ++ FT_Bool stem_detected = FALSE; ++ FT_Int set_width_to, set_center_to; ++ ++ /* seems to not do damage */ ++ /* May not be effective */ ++ requirement1 = height / 4; ++ if ( requirement1 < 5 ) ++ requirement1 = 5; ++ deviation1 = 20; ++ deviation2 = 20; ++ ++ if ( columns_per_pixel == 1 ) ++ deviation1 = deviation2 = 10; ++ ++ if ( (FT_Int)bitmap->rows <= 6 ) ++ deviation1 = 25; ++ ++ if ( (FT_Int)bitmap->rows <= 6 ) ++ deviation2 = 25; ++ ++ if ( columns_per_pixel == 1 && ++ (FT_Int)bitmap->rows <= 6 ) ++ deviation1 = deviation2 = 12; ++ ++ valid_center_average = 0; ++ ++ large_gap_found = large_gap_found_ledge = large_gap_found_redge = FALSE; ++ no_gap_found = no_gap_found_ledge = no_gap_found_redge = FALSE; ++ stem_detected = FALSE; ++ ++ if ( ppem < 11 ) ++ requirement1 = 4; ++ ++ if ( ppem > 18 ) ++ { ++ stem_match_requirement = height / 4; ++ if ( stem_match_requirement < 3 ) ++ stem_match_requirement = 3; ++ } ++ ++ smallest_width_ledge = smallest_width_redge = width * 256; ++ stem_matches = 0; ++ stem_matches_ledge = 0; ++ stem_matches_redge = 0; ++ last_matching_center = -1; ++ last_matching_ledge = -1; ++ last_matching_redge = -1; ++ ++ /* set currently looked at center to center value */ ++ this_center = center; ++ next_center = 0; ++ ++ /* For each center, compare with all other centers to see if others */ ++ /* match the properties of this one */ ++ while ( next_center < num_centers ) ++ { ++ ++ /* calculate differences */ ++ center_difference_in_width = abs ( centers[this_center].x ++ - centers[next_center].x ); ++ center_difference_in_height = abs ( centers[this_center].y ++ - centers[next_center].y ); ++ x1_difference_in_width = abs ( centers[this_center].x1 ++ - centers[next_center].x1 ); ++ x2_difference_in_width = abs ( centers[this_center].x2 ++ - centers[next_center].x2 ); ++ ++ ++ /* property - stem center points that align */ ++ /* if the center is within range, the center is less than */ ++ /* 1/2 the height away, and at least one edge is also within range */ ++ if ( center_difference_in_width ++ < center_difference_in_height * deviation1 && ++ center_difference_in_height ++ <= (FT_Int)bitmap->rows / 2 && ++ /* prevents w from getting caught ---- but also kills m */ ++ ( x1_difference_in_width ++ < center_difference_in_height * deviation2 || ++ x2_difference_in_width ++ < center_difference_in_height * deviation2 ) ) ++ { ++ stem_matches += 1; ++ valid_center_average += centers[next_center].x; ++ ++ /* try to find where the matching centers are far apart */ ++ if ( last_matching_center >= 0 && ++ abs( centers[last_matching_center].y ++ - centers[next_center].y ) >= (FT_Int)bitmap->rows / 2 ) ++ large_gap_found = TRUE; ++ ++ /* try to find where matching centers are next to each other */ ++ if ( last_matching_center >= 0 && ++ abs( centers[last_matching_center].y ++ - centers[next_center].y ) == 1 ) ++ no_gap_found = TRUE; ++ ++ last_matching_center = next_center; ++ } ++ ++ if ( strategy_also_use_edge_detection_for_stems ) ++ { ++ /* property - stem left edge points that align */ ++ /* if the center is within range, */ ++ /* the center is less than 1/2 the height away */ ++ if ( x1_difference_in_width ++ < center_difference_in_height * deviation1 && ++ center_difference_in_height <= (FT_Int)bitmap->rows / 2 ) ++ { ++ stem_matches_ledge += 1; ++ /* may not need for edges */ ++ /*valid_center_average += centers[next_center].x; */ ++ ++ if ( centers[next_center].x2 - centers[next_center].x1 ++ < smallest_width_ledge ) ++ smallest_width_ledge = centers[next_center].x2 ++ - centers[next_center].x1; ++ ++ /* try to find where the matching centers are far apart */ ++ if ( last_matching_ledge >= 0 && ++ abs( centers[last_matching_ledge].y ++ - centers[next_center].y) ++ >= (FT_Int)bitmap->rows / 2 ) ++ large_gap_found_ledge = TRUE; ++ ++ /* try to find where matching centers are next to each other */ ++ if ( last_matching_ledge >= 0 && ++ abs( centers[last_matching_ledge].y ++ - centers[next_center].y ) == 1 ) ++ no_gap_found_ledge = TRUE; ++ last_matching_ledge = next_center; ++ } ++ } ++ ++ if ( strategy_also_use_edge_detection_for_stems ) ++ { ++ /* property - stem right edge points that align */ ++ /* if the center is within range, the center is less than 1/2 */ ++ /* the height away */ ++ if ( x2_difference_in_width ++ < center_difference_in_height * deviation1 && ++ center_difference_in_height ++ <= (FT_Int)bitmap->rows / 2 ) ++ { ++ stem_matches_redge += 1; ++ /* may not need for edges */ ++ /*valid_center_average += centers[next_center].x; */ ++ ++ if ( centers[next_center].x2 - centers[next_center].x1 ++ < smallest_width_redge ) ++ smallest_width_redge = centers[next_center].x2 ++ - centers[next_center].x1; ++ ++ /* try to find where the matching centers are far apart */ ++ if ( last_matching_redge >= 0 && ++ abs( centers[last_matching_redge].y ++ - centers[next_center].y ) >= (FT_Int)bitmap->rows / 2 ) ++ large_gap_found_redge = TRUE; ++ ++ /* try to find where matching centers are next to each other */ ++ if ( last_matching_redge >= 0 && ++ abs( centers[last_matching_redge].y ++ - centers[next_center].y ) == 1 ) ++ no_gap_found_redge = TRUE; ++ ++ last_matching_redge = next_center; ++ } ++ } ++ ++ next_center++; ++ } ++ ++ if ( stem_matches > 0 ) ++ valid_center_average /= stem_matches; ++ ++ best_height = stem_matches; ++ ++ ++ if ( ( stem_matches >= stem_match_requirement || ++ ( ( (FT_Int)bitmap->rows <= 6 || ppem < 11 ) && ++ stem_matches >= 2 && ++ abs ( valid_center_average ++ - centers[center].x) < deviation1 /2 ) || ++ /* try to catch tightly aligned stuff where the matching centers */ ++ /* are next to each other only */ ++ ( stem_matches == 2 && ++ abs( valid_center_average ++ - centers[center].x) <= deviation1 /2 && ++ no_gap_found && ++ ppem < 18 ) ) && ++ /* catches things like times 16 u but gets a lot of w's too */ ++ /* stem width is less than 1/3 of the bitmap width, */ ++ /* or bitmap_width is small */ ++ ( centers[center].x2 - centers[center].x1 ++ < (m_horiAdvance * 12) / 2 || ++ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) ) ++ { ++ stem_detected = TRUE; ++ set_width_to = centers[center].x2 - centers[center].x1; ++ best_height = stem_matches; ++ set_center_to = centers[center].x; ++ } ++ ++ /* see if edges found anything */ ++ if ( strategy_also_use_edge_detection_for_stems && !stem_detected ) ++ { ++ /* Require no gap for edges */ ++ /* stem width less than 1/3 bitmap width, or bitmap_width is small */ ++ /* The stem occurs on the left side of glyph only */ ++ if ( ( stem_matches_ledge >= stem_match_requirement && ++ no_gap_found_ledge ) && ++ ( centers[center].x2 - centers[center].x1 ++ < ( m_horiAdvance * 12 ) / 2 || ++ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) && ++ centers[center].x < ( m_horiAdvance * 12 ) / 2 ) ++ { ++ stem_detected = TRUE; ++ set_width_to = smallest_width_ledge; ++ best_height = stem_matches_ledge; ++ set_center_to = centers[center].x1 + set_width_to / 2; ++ stem_matches = stem_matches_ledge; ++ } ++ /* Require no gap for edges */ ++ /* stem width is less than 1/3 bitmap width, or bitmap_width is small */ ++ /* The stem occurs on the right side of glyph only */ ++ else if ( ( stem_matches_redge >= stem_match_requirement && ++ no_gap_found_redge ) && ++ ( centers[center].x2 - centers[center].x1 ++ < ( m_horiAdvance * 12 ) / 2 || ++ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) && ++ centers[center].x > (m_horiAdvance * 12) / 2 ) ++ { ++ stem_detected = TRUE; ++ set_width_to = smallest_width_redge; ++ best_height = stem_matches_redge; ++ set_center_to = centers[center].x2 - set_width_to / 2; ++ stem_matches = stem_matches_redge; ++ } ++ } ++ ++ ++ /*store and/or replace highest occurrences with 3 or more centers */ ++ /* because this matched, it will become the top dog regardless */ ++ if ( stem_detected ) ++ if ( stem_matches > possible_stems[0].height ) ++ { ++ /* if this is the first stem just go ahead */ ++ if ( valid_possible_stems == 0 ) ++ { ++ valid_possible_stems = 1; ++ possible_stems[0].center = set_center_to; ++ possible_stems[0].count = stem_matches; ++ possible_stems[0].width = set_width_to; ++ possible_stems[0].height = stem_matches; ++ } ++ ++ /* otherwise, if there is already a stem */ ++ else if ( valid_possible_stems == 1 ) ++ { ++ /* if stem is within range of existing one, replace existing one */ ++ ++ /* if the stem isn't within the range of this one swap it with */ ++ /* next one first */ ++ if ( abs ( set_center_to - possible_stems[0].center ) ++ >= one_pixel * 2 ) ++ { ++ swap_stem ( &possible_stems[0], &possible_stems[1] ); ++ valid_possible_stems = 2; ++ } ++ possible_stems[0].center = set_center_to; ++ possible_stems[0].count = stem_matches; ++ possible_stems[0].width = set_width_to; ++ possible_stems[0].height = stem_matches; ++ } ++ ++ /* otherwise if there are already 2 stems */ ++ else if ( valid_possible_stems >= 2 ) ++ { ++ /* if the stem is within the range of existing one, replace */ ++ /* existing one */ ++ if ( abs ( set_center_to - possible_stems[0].center ) ++ <= one_pixel * 2 ) ++ { ++ possible_stems[0].center = set_center_to; ++ possible_stems[0].count = stem_matches; ++ possible_stems[0].width = set_width_to; ++ possible_stems[0].height = stem_matches; ++ } ++ /* if the stem isn't within the range of this one */ ++ else ++ { ++ /* see if within range of next one and swap if so and proceed */ ++ /* overwriting it */ ++ if ( abs ( set_center_to - possible_stems[1].center ) ++ <= one_pixel * 2 ) ++ swap_stem ( &possible_stems[0], &possible_stems[1] ); ++ ++ /* otherwise see if in range of third one */ ++ else if ( abs ( set_center_to - possible_stems[2].center ) ++ <= one_pixel * 2 ) ++ swap_stem ( &possible_stems[0], &possible_stems[2] ); ++ ++ /* otherwise this is the new top dog, so demote everything */ ++ else ++ { ++ swap_stem ( &possible_stems[1], &possible_stems[2] ); ++ swap_stem ( &possible_stems[0], &possible_stems[1] ); ++ valid_possible_stems += 1; ++ } ++ possible_stems[0].center = set_center_to; ++ possible_stems[0].count = stem_matches; ++ possible_stems[0].width = set_width_to; ++ possible_stems[0].height = stem_matches; ++ } ++ } ++ } ++ ++ else if ( stem_matches > possible_stems[1].height && ++ set_center_to != 0 ) ++ { ++ ++ /* make sure it doesn't match the first stem */ ++ if ( abs ( set_center_to - possible_stems[0].center ) >= one_pixel * 2 ) ++ { ++ ++ /* if this is the second stem */ ++ if ( valid_possible_stems == 1 ) ++ valid_possible_stems = 2; ++ ++ /* otherwise if there is already a stem here */ ++ else if ( valid_possible_stems >= 2 ) ++ { ++ /* if it doesn't match the second stem, proceed to swap out */ ++ /* with the third. if it does, replace it */ ++ if ( abs ( set_center_to - possible_stems[1].center ) ++ >= one_pixel * 2 ) ++ { ++ swap_stem ( &possible_stems[1], &possible_stems[2] ); ++ valid_possible_stems +=1; ++ } ++ } ++ possible_stems[1].center = set_center_to; ++ possible_stems[1].count = stem_matches; ++ possible_stems[1].width = set_width_to; ++ possible_stems[1].height = stem_matches; ++ } ++ } ++ ++ else if ( stem_matches > possible_stems[2].height && ++ set_center_to != 0 ) ++ { ++ /* if it doesn't match the first or second one */ ++ if ( abs( set_center_to - possible_stems[0].center) >= one_pixel * 2 && ++ abs( set_center_to - possible_stems[1].center) >= one_pixel * 2 ) ++ { ++ if ( valid_possible_stems == 2 ) ++ valid_possible_stems += 1; ++ ++ possible_stems[2].center = set_center_to; ++ possible_stems[2].count = stem_matches; ++ possible_stems[2].width = set_width_to; ++ possible_stems[1].height = stem_matches; ++ } ++ } ++ ++ if ( valid_possible_stems > 3 ) ++ valid_possible_stems = 3; ++ ++ center++; ++ } ++ ++ /* promote to stem */ ++ if ( valid_possible_stems > 0 ) ++ { ++ stems[0].center = possible_stems[0].center; ++ stems[0].count = possible_stems[0].count; ++ stems[0].width = possible_stems[0].width; ++ stems[0].height = possible_stems[0].height; ++ stems[0].generated = FALSE; ++ valid_stems++; ++ } ++ ++ if ( valid_stems == 1 && ++ valid_possible_stems > 1 ) ++ { ++ stems[1].center = possible_stems[1].center; ++ stems[1].count = possible_stems[1].count; ++ stems[1].width = possible_stems[1].width; ++ stems[1].height = possible_stems[1].height; ++ stems[1].generated = FALSE; ++ valid_stems++; ++ } ++ ++ if ( valid_stems == 2 && ++ valid_possible_stems > 2 && ++ possible_stems[2].center != 0 ) ++ { ++ stems[2].center = possible_stems[2].center; ++ stems[2].count = possible_stems[2].count; ++ stems[2].width = possible_stems[2].width; ++ stems[2].height = possible_stems[2].height; ++ stems[2].generated = FALSE; ++ valid_stems++; ++ } ++ ++ /* sort stems in x direction */ ++ if ( valid_stems == 3 ) ++ { ++ if ( stems[0].center > stems[1].center ) ++ swap_stem ( &stems[0], &stems[1] ); ++ ++ if ( stems[0].center > stems[2].center ) ++ swap_stem ( &stems[1], &stems[2] ); ++ ++ if ( stems[1].center > stems[2].center ) ++ swap_stem ( &stems[1], &stems[2] ); ++ ++ if ( stems[0].center > stems[1].center ) ++ swap_stem ( &stems[0], &stems[1] ); ++ ++ /* only look at first and last stem for now */ ++ swap_stem ( &stems[1], &stems[2] ); ++ } ++ ++ /* synthesize stems - Works, but needs work */ ++ if ( ( strategy_synthesize_stems || ++ known_stem_values->synth_stems ) && ++ valid_stems == 0 && ++ ppem > 10 ) ++ { ++ /* if the leftmost segment's leftmost point is the same as the glyph's */ ++ /* leftmost point, and it is of reasonable width, and is not on the */ ++ /* top or bottom of the bitmap */ ++ if ( leftmost_segment_not_extrema->x1 ++ == leftmost_point_not_extrema && ++ abs ( leftmost_segment_not_extrema->x2 ++ - leftmost_segment_not_extrema->x1 ) ++ < ( rightmost_point_not_extrema ++ - leftmost_point_not_extrema ) / 3 && ++ leftmost_segment_not_extrema->y < height && ++ leftmost_segment_not_extrema->y > 1 ) ++ { ++ stems[valid_stems].center = ( leftmost_segment_not_extrema->x2 ++ + leftmost_segment_not_extrema->x1 ) / 2; ++ stems[valid_stems].width = leftmost_segment_not_extrema->x2 ++ - leftmost_segment_not_extrema->x1; ++ stems[valid_stems].generated = TRUE; ++ valid_stems += 1; ++ } ++ ++ ++ if ( rightmost_segment_not_extrema->x2 ++ == rightmost_point_not_extrema && ++ abs ( rightmost_segment_not_extrema->x2 ++ - rightmost_segment_not_extrema->x1 ) ++ < ( rightmost_point_not_extrema ++ - leftmost_point_not_extrema ) / 3 && ++ rightmost_segment_not_extrema->y < height && ++ rightmost_segment_not_extrema->y > 1 ) ++ { ++ stems[valid_stems].center = ( rightmost_segment_not_extrema->x2 ++ + rightmost_segment_not_extrema->x1 ) / 2; ++ stems[valid_stems].width = rightmost_segment_not_extrema->x2 ++ - rightmost_segment_not_extrema->x1; ++ stems[valid_stems].generated = TRUE; ++ valid_stems += 1; ++ } ++ ++ } ++ ++ /* sort stems in x direction */ ++ if ( valid_stems > 1 && stems[0].center > stems[1].center ) ++ swap_stem ( &stems[0], &stems[1] ); ++ ++ if ( valid_stems == 0 && known_stem_values->stem_translating != 0 ) ++ { ++ *translate_value += known_stem_values->stem_translating; ++ ++ if ( strategy_use_strengths ) ++ { ++ /* consider 1/2 pixel the max when strength is at 100%, ++ unless translate is already greater than that */ ++ FT_Int strength_cutoff = 32; ++ ++ ++ if ( abs ( *translate_value ) > strength_cutoff) ++ strength_cutoff = *translate_value; ++ ++ max_strength = ( strength_cutoff * alignment_strength ) / 100; ++ ++ if ( *translate_value < -max_strength ) ++ *translate_value = -max_strength; ++ else if ( *translate_value > max_strength ) ++ *translate_value = max_strength; ++ } ++ } ++ else ++ /* Start snapping */ ++ { ++ FT_Int center_offset; ++ FT_Int modulus; ++ FT_Int delta, delta2; ++ FT_Long stem_distance = 1, new_distance = 1; ++ FT_Int distance_floor, distance_ceiling; ++ FT_Int translate_value2 = 0; ++ FT_Int main_stem = 0; ++ FT_Int lbearing = m_horiBearingX * 12; ++ FT_Int bitmap_stem_location = stems[0].center; ++ FT_Int advance_stem_location = bitmap_stem_location ++ + lbearing - one_pixel; ++ FT_Int advance_width = m_horiAdvance * 12; ++ FT_Int original_advance_width = 12 * ( slot->linearHoriAdvance >> 10 ); ++ FT_Int glyph_width = rightmost_point - leftmost_point; ++ FT_Int stem_width = stems[0].width; ++ FT_Int advance_leftmost_location = leftmost_point ++ + lbearing - one_pixel; ++ FT_Int advance_rightmost_location = rightmost_point ++ + lbearing - one_pixel; ++ ++#define proposed_transformed_point(point) \ ++ point * (float)(new_distance) / (float)(stem_distance) \ ++ + *translate_value * 12 - ( stems[main_stem].center * (float)(new_distance) \ ++ / (float)(stem_distance) - stems[main_stem].center) ++ ++#define proposed_translated_point(point) point + *translate_value * 12 ++ ++ center_offset = one_pixel / 2; /* half pixel */ ++ modulus = one_pixel; /* whole pixel */ ++ ++ /* Determine center_offset via known values */ ++ if ( known_stem_values->stem_width >= 0 ) ++ { ++ if ( known_stem_values->stem_width % 2 == 0 ) ++ center_offset = 0; ++ else ++ center_offset = one_pixel / 2; ++ } ++ /* otherwise do intelligent guessing, if set */ ++ else if ( strategy_auto_change_center_offset && ++ ppem >= STEM_WIDTH_2_PPEM && ++ stems[0].width < one_pixel * 1.45 ) ++ center_offset = one_pixel / 2; ++ else if ( strategy_auto_change_center_offset && ++ ppem >= STEM_WIDTH_2_PPEM && ++ stems[0].width >= one_pixel * 1.45 && ++ stems[0].width < one_pixel * 2.6 ) ++ center_offset = 0; ++ else if ( strategy_auto_change_center_offset && ++ ppem >= STEM_WIDTH_2_PPEM && ++ stems[0].width >= one_pixel * 2.6 && ++ stems[0].width < one_pixel * 3.6 ) ++ center_offset = one_pixel / 2; ++ else if ( strategy_auto_change_center_offset && ++ ppem >= STEM_WIDTH_2_PPEM ) ++ center_offset = ++ ( one_pixel ++ * ( ( ( (int)( stems[0].width + one_pixel / 2 ) ) ++ / one_pixel ) % 2 ) ) / 2; ++ ++ /* Snap to closest translate and scale values by default */ ++ if ( valid_stems >= 1 ) ++ { ++ /* closest snapping point for stem 0 */ ++ delta = ( stems[0].center + center_offset ) % modulus; ++ ++ if ( delta < modulus / 2 ) ++ /* snap left */ ++ *translate_value = -delta / ( columns_per_pixel * 4 ); ++ else ++ /* snap right */ ++ *translate_value = ( modulus - delta ) / ( columns_per_pixel * 4 ); ++ } ++ ++ if ( strategy_use_d_correction ) ++ { ++ /* if the only stem is in the last 1/3 of glyph width, the advance */ ++ /* is 6 pixels, the ppem 11, and doing so doesn't violate bitmap , */ ++ /* boundaries force it to snap right */ ++ if ( valid_stems == 1 && ++ advance_stem_location > (advance_width * 2) / 3 && ++ advance_width == 6 * one_pixel && ++ rightmost_point + modulus - delta ++ <= ( width - (columns_per_pixel * 2) / 3) * 256 && ++ ppem == 11 ) ++ *translate_value = ( modulus - delta ) / ( columns_per_pixel * 4 ); ++ } ++ ++ if ( strategy_use_strengths ) ++ { ++ /* consider 1/2 pixel the max when strength is at 100%, ++ unless translate is already greater than that */ ++ FT_Int strength_cutoff = 32; ++ if ( abs ( *translate_value ) > strength_cutoff ) ++ strength_cutoff = *translate_value; ++ ++ max_strength = ( strength_cutoff * alignment_strength ) / 100; ++ ++ if ( *translate_value < -max_strength ) ++ *translate_value = -max_strength; ++ else if ( *translate_value > max_strength ) ++ *translate_value = max_strength; ++ } ++ ++ /* If 2 stems is detected, scale distance ++ between in order to land on pixels */ ++ if ( valid_stems >= 2 ) ++ { ++ stem_distance = abs ( stems[1].center - stems[0].center ); ++ ++ delta = stem_distance % modulus; ++ new_distance = stem_distance - delta; ++ ++ distance_floor = stem_distance - delta; ++ distance_ceiling = stem_distance + ( modulus - delta ); ++ ++ if ( delta < modulus / 2 ) ++ new_distance = distance_floor; ++ else ++ new_distance = distance_ceiling; ++ ++ if ( columns_per_pixel == 3 && ++ valid_stems == 3 && ++ strategy_use_m_control && ++ ( width - 2 * columns_per_pixel ) > 6 * columns_per_pixel && ++ ppem > 8 && ++ ( advance_stem_location - advance_leftmost_location ) ++ < stems[main_stem].width * 2 ) ++ { ++ /* Possibly use 2 only when compatible widths is on? */ ++ FT_Int mod_factor = 2; ++ ++ if ( verbose ) ++ printf ( "USING M CONTROL "); ++ ++ distance_floor = stem_distance ++ - stem_distance % ( modulus * mod_factor ) ; ++ distance_ceiling = distance_floor + modulus * mod_factor; ++ ++ new_distance = distance_ceiling; ++ ++ /* force certain ideal situations */ ++ /* these 2 are mostly safe to do */ ++ if ( distance_ceiling ++ + one_pixel * columns_per_pixel == advance_width && ++ stem_width < one_pixel * 1.25 ) ++ new_distance = distance_ceiling; ++ /* NEED TO FIGURE OUT A WAY TO DETERMINE WHETHER ++ THAT NUDGE IS UP OR DOWN */ ++ else if ( stem_distance + one_pixel * 2.6 >= advance_width && ++ stem_width < one_pixel * 1.25 ) ++ new_distance = distance_ceiling; ++ ++ if ( proposed_transformed_point ( leftmost_point ) ++ < one_third_pixel * 2 || ++ proposed_transformed_point ( rightmost_point ) ++ > ( width -2 ) * one_third_pixel ) ++ new_distance = distance_floor; ++ ++ /* NEED TO IGNORE SERIF Ms HERE */ ++ /* perhaps check bitmap boundaries instead??? */ ++ if ( strategy_bearing_correction && new_distance == distance_ceiling ) ++ { ++ /* Correct if bearings are made substantially worse ++ (more than 1/3 a pixel beyond advance) */ ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ > advance_width + one_third_pixel && ++ proposed_transformed_point( advance_rightmost_location ) ++ > advance_rightmost_location && ++ -proposed_transformed_point( advance_leftmost_location ) ++ < advance_rightmost_location - advance_width ) ++ new_distance = distance_floor; ++ } ++ ++ if ( known_stem_values->m >= 0 ) ++ { ++ if ( known_stem_values->m == 0 ) ++ new_distance = distance_floor; ++ else ++ new_distance = distance_ceiling; ++ } ++ ++ if ( ( rightmost_point - leftmost_point) - ++ ( ( rightmost_point * *scale_value) ++ - ( leftmost_point * *scale_value ) ) >= one_pixel * 1.5 ) ++ { ++ *scale_value = 1.0; ++ *translate_value = 0; ++ goto Exit; ++ } ++ ++ } ++ else if ( columns_per_pixel == 1 && ++ valid_stems == 3 && ++ strategy_use_m_control && valid_stems == 3 && ++ width >= 6 * columns_per_pixel && ++ ppem > 8 && ++ ( advance_stem_location - advance_leftmost_location ) ++ < stems[main_stem].width * 2 ) ++ { ++ /* Possibly use 2 only when compatible widths is on? */ ++ FT_Int mod_factor = 2; ++ ++ if ( verbose ) ++ printf ("USING M CONTROL "); ++ distance_floor = stem_distance - stem_distance ++ % ( modulus * mod_factor) ; ++ distance_ceiling = distance_floor + modulus * mod_factor; ++ ++ new_distance = distance_ceiling; ++ ++ /* force certain ideal situations */ ++ /* these 2 are mostly safe to do */ ++ if ( distance_ceiling ++ + one_pixel * columns_per_pixel == advance_width && ++ stem_width < one_pixel * 1.25 ) ++ new_distance = distance_ceiling; ++ /* NEED TO FIGURE OUT A WAY TO DETERMINE WHETHER ++ THAT NUDGE IS UP OR DOWN */ ++ else if ( stem_distance + one_pixel * 2.6 >= advance_width && ++ stem_width < one_pixel * 1.25 ) ++ new_distance = distance_ceiling; ++ ++ if ( proposed_transformed_point( leftmost_point ) < 0 || ++ proposed_transformed_point( rightmost_point ) ++ > width * one_pixel - 2 * one_third_pixel ) ++ new_distance = distance_floor; ++ ++ /* NEED TO IGNORE SERIF Ms HERE */ ++ /* perhaps check bitmap boundaries instead??? */ ++ if ( strategy_bearing_correction && new_distance == distance_ceiling ) ++ { ++ /* Correct if bearings are made substantially worse ++ (more than 1/3 a pixel beyond advance) */ ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ > advance_width + one_third_pixel && ++ proposed_transformed_point( advance_rightmost_location ) ++ > advance_rightmost_location && ++ -proposed_transformed_point( advance_leftmost_location ) ++ < advance_rightmost_location - advance_width ) ++ new_distance = distance_floor; ++ } ++ ++ if ( known_stem_values->m >= 0 ) ++ { ++ if ( known_stem_values->m == 0 ) ++ new_distance = distance_floor; ++ else ++ new_distance = distance_ceiling; ++ } ++ ++ ++ if ( ( rightmost_point - leftmost_point ) ++ - ( ( rightmost_point * *scale_value ) ++ - ( leftmost_point * *scale_value ) ) >= one_pixel * 1.5 ) ++ { ++ *scale_value = 1.0; ++ *translate_value = 0; ++ goto Exit; ++ } ++ ++ } ++ else ++ { ++ if ( strategy_fit_to_width ) ++ new_distance = advance_width - 3 * one_pixel; ++ else if ( known_stem_values->stem_scaling >= 0 ) ++ { ++ if ( known_stem_values->stem_scaling > 0 ) ++ new_distance = distance_ceiling; ++ else ++ new_distance = distance_floor; ++ ++ /* enforce advance width boundaries */ ++ /* TOO RESTRICTIVE ON SERIF FONTS */ ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ >= advance_width || ++ proposed_transformed_point( advance_leftmost_location ) ++ <= 0 ) ++ new_distance = distance_floor; ++ ++ /* enforce literal bitmap boundaries if no translate room */ ++ if ( ( proposed_transformed_point(rightmost_point) >= width * 256 ++ || proposed_transformed_point(leftmost_point ) <= one_pixel ) ++ && new_distance + one_pixel * 3 > advance_width ) ++ new_distance = distance_floor; ++ ++ } ++ else if ( strategy_translate_using_closest_stem ) ++ { ++ /* closest snapping point for stem 1 */ ++ delta2 = ( stems[1].center + center_offset ) % modulus; ++ ++ if ( delta2 < modulus / 2 ) ++ /* snap left */ ++ translate_value2 = -delta2 / ( columns_per_pixel * 4 ); ++ else ++ /* snap right */ ++ translate_value2 = ( modulus - delta2 ) ++ / ( columns_per_pixel * 4 ); ++ ++ if ( abs ( translate_value2 ) < abs ( *translate_value ) ) ++ { ++ *translate_value = translate_value2; ++ main_stem = 1; ++ } ++ ++ } ++ else if ( strategy_scale_to_closest_centers ) ++ { ++ /* closest snapping point for stem 0 */ ++ delta = ( stems[0].center + center_offset ) % modulus; ++ delta2 = ( stems[1].center + center_offset ) % modulus; ++ ++ if ( delta < modulus / 2 ) ++ /* stretch left */ ++ new_distance = delta + stem_distance; ++ else ++ /* stretch right */ ++ new_distance = delta - modulus + stem_distance; ++ ++ if ( delta2 < modulus / 2 ) ++ new_distance -= delta2; /* stretch left */ ++ else ++ new_distance += modulus - delta2; /* stretch right */ ++ ++ } ++ else if ( strategy_scale_to_closest_centers_up_only ) ++ { ++ FT_Int net_change = 0; ++ ++ /* closest snapping point for stem 0 */ ++ delta = ( stems[0].center + center_offset ) % modulus; ++ delta2 = ( stems[1].center + center_offset ) % modulus; ++ ++ if ( delta < modulus / 2 ) ++ net_change = delta; /* stretch left */ ++ else ++ net_change = -( modulus - delta ); /* stretch right */ ++ ++ if ( delta2 < modulus / 2 ) ++ net_change -= delta2; /* stretch left */ ++ else ++ net_change += modulus - delta2; /* stretch right */ ++ ++ if ( net_change > 0 && ++ proposed_transformed_point( advance_rightmost_location ) ++ < advance_width && ++ proposed_transformed_point( advance_leftmost_location ) > 0 ) ++ new_distance = distance_ceiling; ++ } ++ ++ else if ( strategy_always_use_distance_ceiling ) ++ { ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ < advance_width && ++ proposed_transformed_point( advance_leftmost_location ) > 0 ) ++ new_distance = distance_ceiling; ++ } ++ } ++ ++ if ( strategy_use_strengths ) ++ { ++ FT_Int strength_cutoff = center_offset; ++ ++ ++ delta2 = new_distance - stem_distance; ++ ++ if ( abs ( delta2 ) > strength_cutoff ) ++ strength_cutoff = delta2; ++ ++ max_strength = ( strength_cutoff * fitting_strength ) / 100; ++ ++ if ( delta2 < -max_strength ) ++ new_distance = stem_distance - max_strength; ++ else if ( delta2 > max_strength ) ++ new_distance = stem_distance + max_strength; ++ } ++ ++ *scale_value = (float)( new_distance ) / (float)( stem_distance ); ++ *translate_value = *translate_value ++ - ( (float)( stems[main_stem].center * (float)new_distance ) ++ / (float)stem_distance - stems[main_stem].center ) / 12; ++ ++ if ( valid_stems == 2 ) ++ *embolden_value = ( 64.0 / *scale_value - 64.0 ); ++ ++ if ( valid_stems == 3 ) ++ *embolden_value = ( 64.0 / *scale_value - 64.0 ) / 1.5; ++ } ++ ++ if ( verbose ) ++ printf ( "%lu stems:", valid_stems ); ++ ++ if ( valid_stems == 1 && verbose ) ++ printf ( "1 stem: bitmapwidth:%d glyphwidth:%f glyph_width:%f center:%f bearing:%f advance:%f lhadvance:%f stemwidth:%f %d %d", ++ (width - 6) / columns_per_pixel, ++ (float)m_width / 64.0, ++ (float)glyph_width / (float)one_pixel, ++ (float)( (float)advance_stem_location ) / (float)one_pixel, ++ (float)m_horiBearingX / 64.0, ++ (float)m_horiAdvance / 64.0, ++ (float)linearHoriAdvance / 64.0, ++ (float)stems[0].width / (float)one_pixel, ++ advance_width, original_advance_width ); ++ else if ( valid_stems >= 2 && verbose ) ++ printf ( "%lu stems: bitmapwidth:%d center1:%f center2:%f difference:%f bearing:%f advance:%f advstemloc:%f ", ++ valid_stems, ++ (width - 6) / columns_per_pixel, ++ ( (float)advance_stem_location ) / (float)one_pixel, ++ ( (float)advance_stem_location ++ + (float)abs ( stems[1].center ++ - stems[0].center) ) / (float)one_pixel, ++ ( (float)abs ( stems[1].center ++ - stems[0].center ) ) / (float)one_pixel, ++ (float)m_horiBearingX / 64.0, ++ (float)m_horiAdvance / 64.0, ++ (float)advance_stem_location / (float)one_pixel ); ++ ++ if ( strategy_bearing_correction ) ++ { ++ /* Correct if negative bearings are made substantially worse */ ++ /* (more than 1/3 a pixel) */ ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ > advance_width && ++ proposed_transformed_point( advance_rightmost_location ) ++ > advance_rightmost_location && ++ -proposed_transformed_point( advance_leftmost_location ) ++ < advance_rightmost_location - advance_width && ++ *translate_value ++ > one_third_pixel / ( columns_per_pixel * 4 ) ) ++ { ++ *translate_value -=64 ; ++ if ( verbose ) ++ printf ( "TRANSLATING -64 " ); ++ } ++ } ++ goto Exit; ++ } ++ ++ Exit: ++ ++#define transformed_point( point ) point * *scale_value + *translate_value * 12 ++ ++ if ( strategy_correct_out_of_bounds_outlines ) ++ { ++ /* Correct if outside bitmap */ ++ if ( transformed_point( rightmost_point ) ++ >= width * 256 - 2 * one_third_pixel && ++ transformed_point( leftmost_point ) ++ > one_pixel + 2 * one_third_pixel ) ++ *translate_value -=64 ; ++ else if ( transformed_point( leftmost_point ) ++ <= one_pixel / 2 && ++ transformed_point( rightmost_point ) ++ <= width * 256 - ( one_pixel + one_pixel / 2 ) ) ++ *translate_value += 64; ++ } + +- if ( delta ) +- FT_Outline_Translate( &slot->outline, delta->x, delta->y ); ++ STVALUES + +- Exit: +- return error; ++ free ( segments ); ++ free ( leftmost_segment ); ++ free ( rightmost_segment ); ++ free ( known_stem_values ); ++ free ( stems ); ++ free ( possible_stems ); ++ free ( leftmost_stem ); ++ free ( rightmost_stem ); ++ free ( centers ); + } + + +- /* return the glyph's control box */ ++ /* Gamma correction */ + static void +- ft_smooth_get_cbox( FT_Renderer render, +- FT_GlyphSlot slot, +- FT_BBox* cbox ) ++ _ft_lcd_gamma_correction_correction ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_GlyphSlot slot, ++ float gamma_correction_lt, ++ float gamma_correction_value ) + { +- FT_MEM_ZERO( cbox, sizeof ( *cbox ) ); ++ if ( gamma_correction_value != 1.0 ) ++ { ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* line = bitmap->buffer; ++ float ppem = (float)slot->face->size->metrics.x_ppem; + +- if ( slot->format == render->glyph_format ) +- FT_Outline_Get_CBox( &slot->outline, cbox ); ++ ++ if ( !slot->face || !slot->face->size ) return; ++ ++ if ( ppem >= 5 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 0; xx < width; xx += 1 ) ++ { ++ /*normal*/ ++ /*line[xx] = pseudo_gamma ( line[xx], gamma_correction_value );*/ ++ ++ /* sloped */ ++ /*line[xx] = pseudo_gamma ( line[xx], gamma_correction_value - 5 ++ * (1-gamma_correction_value)/(gamma_correction_lt -5) ++ + ((1-gamma_correction_value)/(gamma_correction_lt -5)) * ppem );*/ ++ ++ /* 1/3-sloped */ ++ line[xx] = pseudo_gamma ( line[xx], gamma_correction_value - 5 ++ * ( ( 1 - gamma_correction_value ) ++ / ( 3 * ( gamma_correction_lt -5 ) ) ) ++ + ( ( 1 - gamma_correction_value ) ++ / ( 3 * ( gamma_correction_lt -5) ) ) * ppem ); ++ } ++ } ++ } + } + ++#endif + + /* convert a slot's glyph image into a bitmap */ + static FT_Error +@@ -104,8 +3103,9 @@ + { + FT_Error error; + FT_Outline* outline = NULL; ++ FT_Outline* outline_orig = NULL; + FT_BBox cbox; +- FT_Pos width, height, pitch; ++ FT_Pos width, height, pitch, ppem; + #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + FT_Pos height_org, width_org; + #endif +@@ -121,6 +3121,483 @@ + FT_Bool have_outline_shifted = FALSE; + FT_Bool have_buffer = FALSE; + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Matrix scaleMat; ++ FT_Long translate_value = 0; ++ float scale_value = 1.0; ++ FT_Int align_called = 0; ++ ++ ++ int chromeos_style_sharpening_strength = 0; ++ int checked_chromeos_style_sharpening_strength = 0; ++ int alignment_strength = 0; ++ int fitting_strength = 0; ++ FT_UInt checked_alignment_strength = 0; ++ FT_UInt checked_fitting_strength = 0; ++ FT_UInt checked_fringe_filter_strength = 0; ++ int fringe_filter_strength = 0; ++ FT_UInt checked_grayscale_filter_strength = 0; ++ int grayscale_filter_strength = 0; ++ ++ FT_UInt checked_autohint_horizontal_stem_darken_strength = 0; ++ int autohint_horizontal_stem_darken_strength = 0; ++ ++ FT_UInt checked_autohint_vertical_stem_darken_strength = 0; ++ int autohint_vertical_stem_darken_strength = 0; ++ ++ int windows_style_sharpening_strength = 0; ++ FT_UInt checked_windows_style_sharpening_strength = 0; ++ float gamma_correction_value = 1; ++ float gamma_correction_lt = 0; ++ FT_UInt checked_gamma_correction_value = 0; ++ ++ FT_Int brightness_value = 0.0; ++ FT_UInt checked_brightness_value = 0; ++ ++ FT_Int contrast_value = 0.0; ++ FT_UInt checked_contrast_value = 0; ++ ++ FT_Int snapping_sliding_scale_value = 0; ++ FT_UInt checked_snapping_sliding_scale_value = 0; ++ ++ FT_Int global_embolden_x_value = 0; ++ FT_UInt checked_global_embolden_x_value = 0; ++ ++ FT_Int global_embolden_y_value = 0; ++ FT_UInt checked_global_embolden_y_value = 0; ++ ++ FT_Int bold_embolden_x_value = 0; ++ FT_UInt checked_bold_embolden_x_value = 0; ++ ++ FT_Int bold_embolden_y_value = 0; ++ FT_UInt checked_bold_embolden_y_value = 0; ++ ++ FT_Byte chromeos_cutoff; ++ double chromeos_gamma_value; ++ ++ float embolden_value = 0.0; ++ FT_Bool autohinted = FALSE; ++ ++ FT_UInt autohint_minimum_stem_height = 0; ++ FT_UInt checked_autohint_minimum_stem_height = 0; ++ ++ int checked_use_various_tweaks_env = 0; ++ FT_Bool use_various_tweaks = FALSE; ++ ++ int cur_width; ++ char *cur_width_env = getenv( "CUR_WIDTH" ); ++ ++ const FT_Int MIN_PPEM = 1; ++ /*const FT_Int MAX_PPEM = 100; */ ++ ++ int checked_use_known_settings_on_selected_fonts_env = 0; ++ FT_Bool use_known_settings_on_selected_fonts = FALSE; ++ ++ if ( slot->face && ++ slot->face->size && ++ slot->face->size->metrics.x_ppem ) ++ ppem = slot->face->size->metrics.x_ppem; ++ else ++ ppem = 0; ++ ++ if ( cur_width_env != NULL ) ++ { ++ sscanf ( cur_width_env, "%d", &cur_width ); ++ ++ if ( cur_width != 0 ) ++ autohinted = TRUE; ++ } ++ ++ if ( checked_use_known_settings_on_selected_fonts_env == 0 ) ++ { ++ char *use_known_settings_on_selected_fonts_env = ++ getenv( "INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS" ); ++ if ( use_known_settings_on_selected_fonts_env != NULL ) ++ { ++ if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "default" ) != 0 ) ++ { ++ if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "true" ) == 0 ) ++ use_known_settings_on_selected_fonts = TRUE; ++ else if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "1" ) == 0 ) ++ use_known_settings_on_selected_fonts = TRUE; ++ else if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "on" ) == 0 ) ++ use_known_settings_on_selected_fonts = TRUE; ++ else if ( strcasecmp( use_known_settings_on_selected_fonts_env, ++ "yes" ) == 0 ) ++ use_known_settings_on_selected_fonts = TRUE; ++ } ++ } ++ checked_use_known_settings_on_selected_fonts_env = 1; ++ } ++ ++ if ( checked_use_various_tweaks_env == 0 ) ++ { ++ char *use_various_tweaks_env ++ = getenv( "INFINALITY_FT_USE_VARIOUS_TWEAKS" ); ++ ++ if ( use_various_tweaks_env != NULL ) ++ { ++ if ( strcasecmp( use_various_tweaks_env, "default" ) != 0 ) ++ { ++ if ( strcasecmp( use_various_tweaks_env, "true") == 0) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp( use_various_tweaks_env, "1") == 0) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp( use_various_tweaks_env, "on") == 0) ++ use_various_tweaks = TRUE; ++ else if ( strcasecmp( use_various_tweaks_env, "yes") == 0) ++ use_various_tweaks = TRUE; ++ } ++ } ++ checked_use_various_tweaks_env = 1; ++ } ++ ++ if ( checked_autohint_minimum_stem_height == 0 ) ++ { ++ char *autohint_minimum_stem_height_env = ++ getenv( "INFINALITY_FT_AUTOHINT_MINIMUM_STEM_WIDTH" ); ++ ++ if ( autohint_minimum_stem_height_env != NULL ) ++ { ++ sscanf ( autohint_minimum_stem_height_env, "%u", ++ &autohint_minimum_stem_height ); ++ ++ if ( autohint_minimum_stem_height > 100 ) ++ autohint_minimum_stem_height = 100; ++ else if ( autohint_minimum_stem_height < 0 ) ++ autohint_minimum_stem_height = 0; ++ } ++ checked_autohint_minimum_stem_height = 1; ++ } ++ ++ if ( checked_snapping_sliding_scale_value == 0 ) ++ { ++ char *snapping_sliding_scale_env = ++ getenv ( "INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE" ); ++ ++ if ( snapping_sliding_scale_env != NULL ) ++ { ++ sscanf ( snapping_sliding_scale_env, "%d", ++ &snapping_sliding_scale_value ); ++ ++ if ( snapping_sliding_scale_value > MAX_PPEM ) ++ snapping_sliding_scale_value = 0; ++ else if ( snapping_sliding_scale_value < 0 ) ++ snapping_sliding_scale_value = 0; ++ ++ if (snapping_sliding_scale_value < 11 && ++ snapping_sliding_scale_value > 0 ) ++ snapping_sliding_scale_value = 11; ++ } ++ checked_snapping_sliding_scale_value = 1; ++ } ++ ++ if ( checked_alignment_strength == 0) ++ { ++ char *alignment_strength_env = ++ getenv ( "INFINALITY_FT_STEM_ALIGNMENT_STRENGTH" ); ++ ++ if ( alignment_strength_env != NULL ) ++ { ++ sscanf ( alignment_strength_env, "%d", &alignment_strength ); ++ ++ if ( alignment_strength > 100 ) ++ alignment_strength = 100; ++ else if ( alignment_strength < 0 ) ++ alignment_strength = 0; ++ } ++ ++ if ( alignment_strength > 100 ) ++ alignment_strength = 100; ++ checked_alignment_strength = 1; ++ ++ if ( snapping_sliding_scale_value != 0 ) ++ alignment_strength = sliding_scale ++ ( 10, snapping_sliding_scale_value, alignment_strength, 100, ppem ); ++ } ++ ++ if ( checked_fitting_strength == 0 ) ++ { ++ char *fitting_strength_env = ++ getenv( "INFINALITY_FT_STEM_FITTING_STRENGTH" ); ++ ++ if ( fitting_strength_env != NULL ) ++ { ++ sscanf ( fitting_strength_env, "%d", &fitting_strength ); ++ ++ if ( fitting_strength > 100 ) ++ fitting_strength = 100; ++ else if ( fitting_strength < 0 ) ++ fitting_strength = 0; ++ } ++ ++ if ( fitting_strength > 100 ) ++ fitting_strength = 100; ++ ++ checked_fitting_strength = 1; ++ ++ if ( snapping_sliding_scale_value != 0 ) ++ fitting_strength = sliding_scale ++ ( 10, snapping_sliding_scale_value, fitting_strength, 100, ppem ); ++ } ++ ++ if ( checked_chromeos_style_sharpening_strength == 0 ) ++ { ++ char *chromeos_style_sharpening_strength_env = ++ getenv( "INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH" ); ++ if ( chromeos_style_sharpening_strength_env != NULL ) ++ { ++ sscanf ( chromeos_style_sharpening_strength_env, "%d", ++ &chromeos_style_sharpening_strength ); ++ ++ if ( chromeos_style_sharpening_strength > 100 ) ++ chromeos_style_sharpening_strength = 100; ++ else if ( chromeos_style_sharpening_strength < 0 ) ++ chromeos_style_sharpening_strength = 0; ++ } ++ ++ if ( ppem > 10 ) ++ chromeos_style_sharpening_strength = ++ ( chromeos_style_sharpening_strength * ppem ) / 10; ++ ++ if ( chromeos_style_sharpening_strength > 100 ) ++ chromeos_style_sharpening_strength = 100; ++ checked_chromeos_style_sharpening_strength = 1; ++ } ++ ++ ++ if ( checked_brightness_value == 0) ++ { ++ char *brightness_env = getenv( "INFINALITY_FT_BRIGHTNESS" ); ++ if ( brightness_env != NULL ) ++ { ++ sscanf ( brightness_env, "%d", &brightness_value ); ++ if (brightness_value > 100 ) ++ brightness_value = 100; ++ else if (brightness_value < -100 ) ++ brightness_value = 0; ++ } ++ checked_brightness_value = 1; ++ } ++ ++ if ( checked_contrast_value == 0) ++ { ++ char *contrast_env = getenv( "INFINALITY_FT_CONTRAST" ); ++ if ( contrast_env != NULL ) ++ { ++ sscanf ( contrast_env, "%d", &contrast_value ); ++ if (contrast_value > 100 ) ++ contrast_value = 100; ++ else if (contrast_value < -100 ) ++ contrast_value = 100; ++ } ++ checked_contrast_value = 1; ++ } ++ ++ if ( checked_windows_style_sharpening_strength == 0) ++ { ++ char *windows_style_sharpening_strength_env = ++ getenv( "INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH" ); ++ ++ if ( windows_style_sharpening_strength_env != NULL ) ++ { ++ sscanf ( windows_style_sharpening_strength_env, "%d", ++ &windows_style_sharpening_strength ); ++ ++ if ( windows_style_sharpening_strength > 100 ) ++ windows_style_sharpening_strength = 100; ++ else if ( windows_style_sharpening_strength < 0 ) ++ windows_style_sharpening_strength = 0; ++ } ++ /* Decrease effect slightly to have a more linear increase in sharpness */ ++ windows_style_sharpening_strength = ++ ( ( windows_style_sharpening_strength ++ * windows_style_sharpening_strength ) / 100 ++ + windows_style_sharpening_strength ) / 2; ++ checked_windows_style_sharpening_strength = 1; ++ } ++ ++ if ( checked_gamma_correction_value == 0 ) ++ { ++ char *gamma_correction_value_env = ++ getenv( "INFINALITY_FT_GAMMA_CORRECTION" ); ++ ++ if ( gamma_correction_value_env != NULL ) ++ { ++ float f1, f2; ++ ++ if ( strcasecmp( gamma_correction_value_env, "default" ) != 0 ) ++ { ++ sscanf ( gamma_correction_value_env, "%f %f", &f1, &f2 ); ++ gamma_correction_lt = f1; ++ gamma_correction_value = f2 / 100.0; ++ } ++ if ( gamma_correction_value < .01 ) gamma_correction_value = 1.0; ++ } ++ checked_gamma_correction_value = 1; ++ } ++ ++ /* set gamma value to 1 if out of range */ ++ if ( slot->face && ++ slot->face->size && ++ slot->face->size->metrics.x_ppem ) ++ { ++ if ( slot->face->size->metrics.x_ppem >= gamma_correction_lt ) ++ gamma_correction_value = 1; ++ } ++ else ++ gamma_correction_value = 1; ++ ++ ++ if ( checked_fringe_filter_strength == 0 ) ++ { ++ char *fringe_filter_strength_env = ++ getenv( "INFINALITY_FT_FRINGE_FILTER_STRENGTH" ); ++ if ( fringe_filter_strength_env != NULL ) ++ { ++ sscanf ( fringe_filter_strength_env, "%d", &fringe_filter_strength ); ++ ++ if ( fringe_filter_strength > 100 ) ++ fringe_filter_strength = 100; ++ else if ( fringe_filter_strength < 0 ) ++ fringe_filter_strength = 0; ++ } ++ checked_fringe_filter_strength = 1; ++ } ++ ++ ++ if ( checked_grayscale_filter_strength == 0) ++ { ++ char *grayscale_filter_strength_env = ++ getenv( "INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH" ); ++ if ( grayscale_filter_strength_env != NULL ) ++ { ++ sscanf ( grayscale_filter_strength_env, "%d", ++ &grayscale_filter_strength ); ++ if ( grayscale_filter_strength > 100 ) grayscale_filter_strength = 100; ++ else if (grayscale_filter_strength < 0 ) grayscale_filter_strength = 0; ++ } ++ checked_grayscale_filter_strength = 1; ++ } ++ ++ ++ if ( checked_autohint_horizontal_stem_darken_strength == 0) ++ { ++ char *autohint_horizontal_stem_darken_strength_env = ++ getenv( "INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH" ); ++ if ( autohint_horizontal_stem_darken_strength_env != NULL ) ++ { ++ sscanf ( autohint_horizontal_stem_darken_strength_env, "%d", ++ &autohint_horizontal_stem_darken_strength ); ++ ++ if ( autohint_horizontal_stem_darken_strength > 100 ) ++ autohint_horizontal_stem_darken_strength = 100; ++ else if ( autohint_horizontal_stem_darken_strength < 0 ) ++ autohint_horizontal_stem_darken_strength = 0; ++ } ++ checked_autohint_horizontal_stem_darken_strength = 1; ++ } ++ ++ if ( checked_autohint_vertical_stem_darken_strength == 0) ++ { ++ char *autohint_vertical_stem_darken_strength_env = ++ getenv( "INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH" ); ++ if ( autohint_vertical_stem_darken_strength_env != NULL ) ++ { ++ sscanf ( autohint_vertical_stem_darken_strength_env, "%d", ++ &autohint_vertical_stem_darken_strength ); ++ ++ if ( autohint_vertical_stem_darken_strength > 100 ) ++ autohint_vertical_stem_darken_strength = 100; ++ else if ( autohint_horizontal_stem_darken_strength < 0 ) ++ autohint_vertical_stem_darken_strength = 0; ++ } ++ checked_autohint_vertical_stem_darken_strength = 1; ++ } ++ ++ if ( checked_global_embolden_x_value == 0) ++ { ++ char *global_embolden_x_env = ++ getenv ( "INFINALITY_FT_GLOBAL_EMBOLDEN_X_VALUE" ); ++ if ( global_embolden_x_env != NULL ) ++ { ++ sscanf ( global_embolden_x_env, "%d", &global_embolden_x_value ); ++ ++ if ( global_embolden_x_value > 128 ) ++ global_embolden_x_value = 128; ++ else if ( global_embolden_x_value < -128 ) ++ global_embolden_x_value = -128; ++ } ++ checked_global_embolden_x_value = 1; ++ } ++ ++ if ( checked_global_embolden_y_value == 0) ++ { ++ char *global_embolden_y_env = ++ getenv ( "INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE" ); ++ if ( global_embolden_y_env != NULL ) ++ { ++ sscanf ( global_embolden_y_env, "%d", &global_embolden_y_value ); ++ if ( global_embolden_y_value > 128 ) ++ global_embolden_y_value = 128; ++ else if ( global_embolden_y_value < -128 ) ++ global_embolden_y_value = -128; ++ } ++ checked_global_embolden_y_value = 1; ++ } ++ ++ ++ if ( checked_bold_embolden_x_value == 0) ++ { ++ char *bold_embolden_x_env = ++ getenv ( "INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE" ); ++ ++ if ( bold_embolden_x_env != NULL ) ++ { ++ sscanf ( bold_embolden_x_env, "%d", &bold_embolden_x_value ); ++ if (bold_embolden_x_value > 128 ) ++ bold_embolden_x_value = 128; ++ else if (bold_embolden_x_value < -128 ) ++ bold_embolden_x_value = -128; ++ } ++ checked_bold_embolden_x_value = 1; ++ } ++ ++ if ( checked_bold_embolden_y_value == 0) ++ { ++ char *bold_embolden_y_env = getenv ( "INFINALITY_FT_BOLD_EMBOLDEN_Y_VALUE" ); ++ ++ if ( bold_embolden_y_env != NULL ) ++ { ++ sscanf ( bold_embolden_y_env, "%d", &bold_embolden_y_value ); ++ if (bold_embolden_y_value > 128 ) ++ bold_embolden_y_value = 128; ++ else if (bold_embolden_y_value < -128 ) ++ bold_embolden_y_value = -128; ++ } ++ checked_bold_embolden_y_value = 1; ++ } ++ ++ if( use_various_tweaks && ++ slot->face && ++ slot->face->style_name ) ++ { ++ /* needs to also check for artifical italics */ ++ if ( strcasestr(slot->face->style_name, "Italic" ) || ++ strcasestr(slot->face->style_name, "Oblique" ) ) ++ { ++ windows_style_sharpening_strength = 0; ++ chromeos_style_sharpening_strength = 0; ++ } ++ } ++ ++ /*if (fitting_strength == 100) scale_value = 1.1;*/ ++ ++#endif + + /* check glyph image format */ + if ( slot->format != render->glyph_format ) +@@ -136,9 +3613,105 @@ + goto Exit; + } + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++RERENDER: ++ if ( align_called == 1 ) ++ { ++ scaleMat.xx = FT_FixedFromFloat(scale_value); ++ scaleMat.xy = 0; ++ scaleMat.yx = 0; ++ scaleMat.yy = ( 1 << 16 ); ++ ++ FT_Outline_Copy(outline_orig, outline); ++ ++ if ( scale_value != 1.0 ) ++ FT_Outline_Transform( outline, &scaleMat ); ++ ++ FT_Outline_Translate( outline, translate_value, 0 ); ++ ++ FT_Outline_EmboldenXY( outline, embolden_value, 0 ); ++ } ++ else ++ { ++#endif + outline = &slot->outline; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* Need to get this PRIOR to embolden, otherwise bad things happen */ ++ FT_Outline_Get_CBox( outline, &cbox ); ++ ++ /* Various hacks that need to be turned into a new rule set */ ++ /*if ( !autohinted ++ && use_known_settings_on_selected_fonts ++ && mode == FT_RENDER_MODE_LCD ++ && slot->face->family_name ++ && slot->face->style_name ++ && ( strcasestr(slot->face->family_name, "Courier New" ) ++ && ( strcasestr(slot->face->style_name, "Regular" ) ++ || strcasestr(slot->face->style_name, "Italic" ) ) ) ) ++ FT_Outline_Embolden( outline, 24 );*/ ++ ++ if ( slot->face ) ++ { ++ if ( !autohinted && ++ use_known_settings_on_selected_fonts && ++ mode == FT_RENDER_MODE_LCD && ++ slot->face->family_name && ++ slot->face->style_name && ++ strcasestr( slot->face->family_name, "Times New Roman" ) && ++ strcasestr( slot->face->style_name, "Italic" ) ) ++ FT_Outline_EmboldenXY( outline, 12, 0 ); ++ ++ if ( use_known_settings_on_selected_fonts && ++ autohinted && ++ mode == FT_RENDER_MODE_LCD && ++ slot->face->family_name && ++ slot->face->style_name && ++ strcasestr(slot->face->family_name, "FreeSerif" ) && ++ strcasestr(slot->face->style_name, "Italic" ) ) ++ FT_Outline_EmboldenXY( outline, 8, 0 ); ++ ++ if ( global_embolden_x_value != 0 || global_embolden_y_value != 0 ) ++ FT_Outline_EmboldenXY( outline, ++ global_embolden_x_value, ++ global_embolden_y_value ); ++ ++ if ( ( bold_embolden_x_value != 0 || bold_embolden_y_value != 0 ) && ++ ( slot->face->style_name && ++ ( strcasestr(slot->face->style_name, "Bold" ) || ++ strcasestr(slot->face->style_name, "Black" ) || ++ ( slot->face->style_flags && ++ slot->face->style_flags & FT_STYLE_FLAG_BOLD ) ) ) ) ++ FT_Outline_EmboldenXY( outline, ++ bold_embolden_x_value, ++ bold_embolden_y_value ); ++ } ++ ++ FT_Outline_Copy( outline, outline_orig ); ++ } + + /* translate the outline to the new origin if needed */ ++ if ( align_called == 0 ) ++ { ++ FT_Pos enlarge_cbox = 0; ++ ++ /* enlarge for grayscale rendering */ ++ if ( mode == FT_RENDER_MODE_NORMAL ) ++ enlarge_cbox = 64; ++ ++ if ( origin ) ++ { ++ FT_Outline_Translate( outline, origin->x, origin->y ); ++ have_translated_origin = TRUE; ++ } ++ ++ /* compute the control box, and grid fit it */ ++ /*FT_Outline_Get_CBox( outline, &cbox );*/ ++ ++ cbox.xMin = FT_PIX_FLOOR( cbox.xMin - enlarge_cbox ); ++ cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); ++ cbox.xMax = FT_PIX_CEIL( cbox.xMax + enlarge_cbox ); ++ cbox.yMax = FT_PIX_CEIL( cbox.yMax ); ++#else + if ( origin ) + { + FT_Outline_Translate( outline, origin->x, origin->y ); +@@ -152,6 +3725,7 @@ + cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); + cbox.xMax = FT_PIX_CEIL( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL( cbox.yMax ); ++#endif + + if ( cbox.xMin < 0 && cbox.xMax > FT_INT_MAX + cbox.xMin ) + { +@@ -228,6 +3802,9 @@ + y_top += extra >> 1; + } + } ++#endif ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ } + + #endif + +@@ -252,6 +3829,9 @@ + bitmap->pitch = pitch; + + /* translate outline to render it into the bitmap */ ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( align_called == 0 ) ++#endif + FT_Outline_Translate( outline, -x_shift, -y_shift ); + have_outline_shifted = TRUE; + +@@ -307,9 +3887,153 @@ + if ( error ) + goto Exit; + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( ppem <= MAX_PPEM && ppem >= MIN_PPEM ) ++ { ++ if ( align_called == 0 && cur_width / ppem < 10 && ++ ( alignment_strength > 0 || fitting_strength > 0 ) ) ++ _lcd_stem_align ( bitmap, ++ mode, ++ slot, ++ &translate_value, ++ &scale_value, ++ alignment_strength, ++ fitting_strength, ++ &embolden_value ); ++ ++ if ( align_called == 0 && ++ ( translate_value != 0 || scale_value != 1.0 ) ) ++ { ++ align_called = 1; ++ goto RERENDER; ++ } ++ ++ if ( mode == FT_RENDER_MODE_LCD ) ++ { ++ ++ if ( fringe_filter_strength > 0 /*&& autohinted*/ ) ++ _ft_lcd_fringe_filter( bitmap, ++ mode, ++ fringe_filter_strength, ++ slot->library ); ++ ++ /*if ( autohinted) ++ _ft_lcd_stem_end_filter( bitmap, mode, 100, slot->library );*/ ++ ++ if ( gamma_correction_lt > 0 && gamma_correction_value != 1.0 ) ++ _ft_lcd_gamma_correction_correction( bitmap, ++ mode, ++ slot, ++ gamma_correction_lt, ++ gamma_correction_value ); ++ ++ chromeos_cutoff = (FT_Byte)( 0.5 * 255.0 ) ++ * ( chromeos_style_sharpening_strength / 100.0 ); ++ chromeos_gamma_value = 1; ++ ++ if ( chromeos_style_sharpening_strength > 0 ) ++ _ft_lcd_chromeos_sharpen( bitmap, ++ mode, ++ chromeos_cutoff, ++ chromeos_gamma_value ); ++ ++ if ( ppem > 8 ) ++ if ( windows_style_sharpening_strength > 0 ) ++ _ft_lcd_windows_sharpen( bitmap, ++ mode, ++ windows_style_sharpening_strength, ++ slot->library ); ++ ++ if ( autohinted && ++ ( cur_width * 100 ) / 64 ++ > autohint_horizontal_stem_darken_strength && ++ autohint_horizontal_stem_darken_strength != 0 ) ++ autohint_horizontal_stem_darken_strength = ( cur_width * 100 ) / 64; ++ ++ if ( autohint_horizontal_stem_darken_strength > 100) ++ autohint_horizontal_stem_darken_strength = 100; ++ ++ /* only do on autohinted fonts */ ++ /* Necessary to do on some non-thin fonts, which is why it is outside */ ++ /* of the below conditional */ ++ if ( autohint_horizontal_stem_darken_strength > 0 && autohinted ) ++ _ft_lcd_darken_x ( bitmap, ++ mode, ++ autohint_horizontal_stem_darken_strength, ++ slot->library ); ++ ++ /* Enhance thin fonts */ ++ if ( autohinted ) ++ { ++ /* if forcibly set use that, otherwise make a good estimate */ ++ if ( slot->face && !_ft_bitmap_bc ( bitmap, ++ (float)get_brightness( slot->face->family_name, ppem ) / 300.0, ++ (float)get_contrast( slot->face->family_name, ppem ) / 300.0 ) ) ++ { ++ FT_Bool is_fixed_name = FALSE; ++ ++ if ( slot->face->family_name && ++ strcasestr(slot->face->family_name, "Mono" ) ) ++ is_fixed_name = TRUE; ++ ++ /* Darken vertical stems */ ++ _ft_lcd_darken_y ( bitmap, ++ mode, ++ autohint_vertical_stem_darken_strength, ++ slot->library ); ++ ++ /* Adjust brightness / contrast automatically based on stem width */ ++ if ( cur_width != 0 && cur_width < 30 ) ++ cur_width = 30; ++ ++ if ( cur_width >= 30 && cur_width <= 60 ) ++ { ++ float ppem_factor = sliding_scale ( 5, 11, 0.0, 1.0, ppem ); ++ float brightness_factor = sliding_scale ( 30, 52, -.3, 0.0, ++ cur_width ); ++ float contrast_factor = sliding_scale ( 30, 52, .45, 0.0, ++ cur_width ); ++ _ft_bitmap_bc ( bitmap, ++ ppem_factor * brightness_factor, ++ ppem_factor * contrast_factor ); ++ ++ /* Only cap variable width thin-stemmed fonts */ ++ if ( !FT_IS_FIXED_WIDTH( slot->face ) && !is_fixed_name ) ++ _ft_bitmap_cap ( bitmap, ++ ( cur_width * 150 ) / 64, ++ slot->library ); ++ } ++ } ++ } ++ ++ ++ if ( slot->library->lcd_filter_func ) ++ slot->library->lcd_filter_func( bitmap, mode, slot->library ); ++ ++ if ( grayscale_filter_strength > 0 ) ++ _ft_lcd_grayscale_filter( bitmap, ++ mode, ++ grayscale_filter_strength, ++ slot->library ); ++ ++ } ++ ++ /* Global values */ ++ if ( brightness_value != 0 || contrast_value != 0 ) ++ _ft_bitmap_bc ( bitmap, ++ (float)brightness_value / 300.0, ++ (float)contrast_value / 300.0); ++ ++ FT_Outline_Done( slot->library, outline_orig ); ++ } ++ else if ( mode == FT_RENDER_MODE_LCD && ++ slot->library->lcd_filter_func ) ++ slot->library->lcd_filter_func( bitmap, mode, slot->library ); ++#else + if ( slot->library->lcd_filter_func ) + slot->library->lcd_filter_func( bitmap, mode, slot->library ); + ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + + /* render outline into bitmap */ +diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c +index 872894d..44e4274 100644 +--- a/src/truetype/ttinterp.c ++++ b/src/truetype/ttinterp.c +@@ -1842,8 +1842,7 @@ + FT_UNUSED_EXEC; + + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- if ( !CUR.ignore_x_mode || +- ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVEX ) ) ++ if ( !CUR.ignore_x_mode ) + #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + zone->cur[point].x += distance; + zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; +@@ -4464,7 +4463,7 @@ + + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* arguments to opcodes are skipped by `SKIP_Code' */ +- FT_Byte opcode_pattern[7][12] = { ++ FT_Byte opcode_pattern[9][12] = { + /* #0 inline delta function 1 */ + { + 0x4B, /* PPEM */ +@@ -4542,10 +4541,23 @@ + 0x43, /* RS */ + 0x58 /* IF */ + }, ++ /* #7 TypeMan Talk DiagEndCtrl function */ ++ { ++ 0x01, /* SVTCA_x */ ++ 0x20, /* DUP */ ++ 0xB0, /* PUSHB_1 */ ++ /* 3 */ ++ 0x25, /* CINDEX */ ++ }, ++ /* #8 TypeMan Talk Align */ ++ { ++ 0x06, /* SPVTL */ ++ 0x7D, /* RDTG */ ++ }, + }; +- FT_UShort opcode_patterns = 7; +- FT_UShort opcode_pointer[7] = { 0, 0, 0, 0, 0, 0, 0 }; +- FT_UShort opcode_size[7] = { 12, 8, 8, 6, 7, 4, 5 }; ++ FT_UShort opcode_patterns = 9; ++ FT_UShort opcode_pointer[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ++ FT_UShort opcode_size[9] = { 12, 8, 8, 6, 7, 4, 5, 4, 2 }; + FT_UShort i; + #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + +@@ -4684,6 +4696,17 @@ + CUR.face->sph_found_func_flags |= SPH_FDEF_SPACING_2; + } + break; ++ ++ case 7: ++ rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; ++ CUR.face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; ++ break; ++ ++ case 8: ++ /*rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; ++ CUR.face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;*/ ++ break; ++ + } + opcode_pointer[i] = 0; + } +@@ -4729,6 +4752,10 @@ + FT_UNUSED_ARG; + + ++#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING ++ CUR.sph_in_func_flags = 0x0000; ++#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ ++ + if ( CUR.callTop <= 0 ) /* We encountered an ENDF without a call */ + { + CUR.error = FT_THROW( ENDF_In_Exec_Stream ); +@@ -4814,7 +4841,13 @@ + goto Fail; + + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- CUR.sph_in_func_flags &= def->sph_fdef_flags; ++ if ( CUR.ignore_x_mode && ++ ( ( CUR.iup_called && ++ ( CUR.sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) || ++ ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) ) ) ++ goto Fail; ++ else ++ CUR.sph_in_func_flags = def->sph_fdef_flags; + #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + /* check the call stack */ +@@ -4839,10 +4872,6 @@ + + CUR.step_ins = FALSE; + +-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- CUR.sph_in_func_flags &= !def->sph_fdef_flags; +-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +- + return; + + Fail: +@@ -4900,7 +4929,11 @@ + goto Fail; + + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- CUR.sph_in_func_flags &= def->sph_fdef_flags; ++ if ( CUR.ignore_x_mode && ++ ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) ) ++ goto Fail; ++ else ++ CUR.sph_in_func_flags = def->sph_fdef_flags; + #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + /* check stack */ +@@ -4927,10 +4960,6 @@ + CUR.step_ins = FALSE; + } + +-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- CUR.sph_in_func_flags &= !def->sph_fdef_flags; +-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +- + return; + + Fail: +@@ -5779,9 +5808,7 @@ + if ( CUR.GS.freeVector.x != 0 ) + { + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- if ( !CUR.ignore_x_mode || +- ( CUR.ignore_x_mode && +- ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_MOVE_ZP2 ) ) ) ++ if ( !CUR.ignore_x_mode ) + #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + CUR.zp2.cur[point].x += dx; + if ( touch ) +@@ -6030,14 +6057,17 @@ + else + B1 = CUR.zp2.cur[point].x; + +- if ( CUR.GS.freeVector.y != 0 && +- ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_INLINE_DELTAS ) ) +- goto Skip; +- + if ( !CUR.face->sph_compatibility_mode && + CUR.GS.freeVector.y != 0 ) + MOVE_Zp2_Point( point, dx, dy, TRUE ); + ++ else if ( CUR.sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL ) ++ { ++ MOVE_Zp2_Point( point, dx, dy, TRUE ); ++ /* don't allow reversals */ ++ goto Skip; ++ } ++ + else if ( CUR.face->sph_compatibility_mode ) + { + if ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) +@@ -6046,6 +6076,12 @@ + dy = FT_PIX_ROUND( B1 + dy ) - B1; + } + ++ /* skip post-iup deltas */ ++ if ( CUR.iup_called && ++ ( ( CUR.sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) || ++ ( CUR.sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) ) ++ goto Skip; ++ + if ( !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) && + ( ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) || + ( CUR.zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) || +@@ -6223,6 +6259,7 @@ + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode && + CUR.GS.freeVector.x != 0 && ++ CUR.GS.freeVector.y == 0 && + !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + control_value_cutin = 0; + #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +@@ -6489,11 +6526,6 @@ + cvt_dist = 0; + else + cvt_dist = CUR_Func_read_cvt( cvtEntry - 1 ); +-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- if ( CUR.ignore_x_mode && +- ( CUR.sph_tweak_flags & SPH_TWEAK_MIRP_CVT_ZERO ) ) +- cvt_dist = 0; +-#endif + + /* single width test */ + +@@ -6642,12 +6674,6 @@ + ( B2 & 63 ) != 0 && + ( B1 & 63 ) != 0 ) + reverse_move = TRUE; +- +- if ( ( CUR.sph_tweak_flags & +- SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES ) && +- !reverse_move && +- FT_ABS( B1 - B2 ) >= 64 ) +- reverse_move = TRUE; + } + + if ( reverse_move ) +@@ -7214,7 +7240,7 @@ + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode ) + { +- CUR.iup_called = 1; ++ CUR.iup_called = TRUE; + if ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_IUP ) + return; + } +@@ -7291,7 +7317,13 @@ + FT_Long B; + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + FT_UShort B1, B2; +-#endif ++ ++ ++ if ( CUR.ignore_x_mode && ++ CUR.iup_called && ++ ( CUR.sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) ++ goto Fail; ++#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + + #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING +@@ -7388,7 +7420,7 @@ + #if 0 + /* Standard Subpixel Hinting: Allow y move. */ + /* This messes up dejavu and may not be needed... */ +- if ( !CUR.face->sph_compatibility_mode && ++ if ( !CUR.face->sph_compatibility_mode && + CUR.GS.freeVector.y != 0 ) + CUR_Func_move( &CUR.zp0, A, B ); + else +@@ -7419,14 +7451,14 @@ + ( B1 & 63 ) == 0 && + ( B2 & 63 ) != 0 ) || + ( ( CUR.sph_tweak_flags & +- SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && ++ SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) && + ( B1 & 63 ) != 0 && + ( B2 & 63 ) != 0 ) ) ) + CUR_Func_move( &CUR.zp0, A, -B ); + } + #else + CUR_Func_move( &CUR.zp0, A, B ); +-#endif /* *TT_CONFIG_OPTION_SUBPIXEL_HINTING */ ++#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + } + } + else +@@ -8031,6 +8063,19 @@ + TT_RunIns( TT_ExecContext exc ) + { + FT_Long ins_counter = 0; /* executed instructions counter */ ++#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING ++ FT_Byte opcode_pattern[1][2] = { ++ /* #8 TypeMan Talk Align */ ++ { ++ 0x06, /* SPVTL */ ++ 0x7D, /* RDTG */ ++ }, ++ }; ++ FT_UShort opcode_patterns = 1; ++ FT_UShort opcode_pointer[1] = { 0 }; ++ FT_UShort opcode_size[1] = { 1 }; ++ FT_UShort i; ++#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + + #ifdef TT_CONFIG_OPTION_STATIC_RASTER +@@ -8116,6 +8161,34 @@ + CUR.step_ins = TRUE; + CUR.error = FT_Err_Ok; + ++#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING ++ for ( i = 0; i < opcode_patterns; i++ ) ++ { ++ if ( opcode_pointer[i] < opcode_size[i] && ++ CUR.opcode == opcode_pattern[i][opcode_pointer[i]] ) ++ { ++ opcode_pointer[i] += 1; ++ ++ if ( opcode_pointer[i] == opcode_size[i] ) ++ { ++ FT_TRACE7(( "sph: opcode ptrn: %d, %s %s\n", ++ i, ++ CUR.face->root.family_name, ++ CUR.face->root.style_name )); ++ ++ switch ( i ) ++ { ++ case 0: ++ break; ++ } ++ opcode_pointer[i] = 0; ++ } ++ } ++ else ++ opcode_pointer[i] = 0; ++ } ++#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ ++ + #ifdef TT_CONFIG_OPTION_INTERPRETER_SWITCH + + { +@@ -8312,13 +8385,7 @@ + break; + + case 0x2B: /* CALL */ +-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- if ( !CUR.ignore_x_mode || +- !CUR.iup_called || +- ( CUR.iup_called && +- !( CUR.sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) ) +-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +- Ins_CALL( EXEC_ARG_ args ); ++ Ins_CALL( EXEC_ARG_ args ); + break; + + case 0x2C: /* FDEF */ +@@ -8336,11 +8403,7 @@ + + case 0x30: /* IUP */ + case 0x31: /* IUP */ +-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- if ( CUR.ignore_x_mode ) +- CUR.iup_called = TRUE; +-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +- Ins_IUP( EXEC_ARG_ args ); ++ Ins_IUP( EXEC_ARG_ args ); + break; + + case 0x32: /* SHP */ +@@ -8499,13 +8562,7 @@ + break; + + case 0x5D: /* DELTAP1 */ +-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +- if ( !CUR.ignore_x_mode || +- !CUR.iup_called || +- ( CUR.iup_called && +- !( CUR.sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) ) +-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +- Ins_DELTAP( EXEC_ARG_ args ); ++ Ins_DELTAP( EXEC_ARG_ args ); + break; + + case 0x5E: /* SDB */ +diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c +index 27e9b15..5267233 100644 +--- a/src/truetype/ttsubpix.c ++++ b/src/truetype/ttsubpix.c +@@ -286,25 +286,14 @@ + + + /* Don't do subpixel (ignore_x_mode) hinting; do normal hinting. */ +-#define PIXEL_HINTING_RULES_SIZE 1 ++#define PIXEL_HINTING_RULES_SIZE 2 + + const SPH_TweakRule PIXEL_HINTING_Rules + [PIXEL_HINTING_RULES_SIZE] = + { + /* these characters are almost always safe */ +- { "-", 0, "", 0 }, +- }; +- +- +- /* According to Greg Hitchcock and the MS whitepaper, this should work */ +- /* on all legacy MS fonts, but creates artifacts with some. Only using */ +- /* where absolutely necessary. */ +-#define SKIP_INLINE_DELTAS_RULES_SIZE 1 +- +- const SPH_TweakRule SKIP_INLINE_DELTAS_Rules +- [SKIP_INLINE_DELTAS_RULES_SIZE] = +- { +- { "-", 0, "", 0 }, ++ { "Courier New", 12, "Italic", 'z' }, ++ { "Courier New", 11, "Italic", 'z' }, + }; + + +@@ -320,42 +309,41 @@ + + /* Skip Y moves that start with a point that is not on a Y pixel */ + /* boundary and don't move that point to a Y pixel boundary. */ +-#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE 9 ++#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE 5 + + const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules + [SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] = + { + /* fix vwxyz thinness*/ +- { "Consolas", 0, "Regular", 0 }, +- /* fix tiny gap at top of m */ +- { "Arial", 0, "Regular", 'm' }, ++ { "Consolas", 0, "", 0 }, { "-", 0, "N", 0 }, + /* Fix thin middle stems */ +- { "Core MS Legacy Fonts", 0, "Regular/Bold Class", 'N' }, +- { "Lucida Grande", 0, "", 'N' }, +- { "Lucida Grande", 0, "Bold", 'y' }, ++ { "-Core MS Legacy Fonts", 0, "Regular/Bold Class", 0 }, + /* Cyrillic small letter I */ +- { "Legacy Sans Fonts", 0, "", 0x438 }, +- { "Verdana Clones", 0, "",'N' }, +- /* Fix misshapen x */ +- { "Verdana", 0, "Bold", 'x' }, +- /* Fix misshapen s */ +- { "Tahoma", 0, "", 's' }, ++ { "Legacy Sans Fonts", 0, "", 0 }, ++ /* Fix artifacts with some Regular & Bold */ ++ { "Verdana Clones", 0, "", 0 }, + }; + + +-#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 7 ++#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1 + + const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions + [SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] = + { +- { "Tahoma", 0, "", 'N' }, +- { "Comic Sans MS", 0, "", 'N' }, +- { "Verdana", 0, "Regular/Bold Class", 'N' }, +- { "Verdana", 11, "Bold", 'x' }, +- /* Cyrillic small letter I */ +- { "Arial", 0, "", 0x438 }, +- { "Arial", 11, "Bold", 'N' }, +- { "Trebuchet MS", 0, "Bold", 0 }, ++ { "-", 0, "", 0 }, ++ }; ++ ++ ++ /* Skip Y moves that start with a point that is not on a Y pixel */ ++ /* boundary and don't move that point to a Y pixel boundary. */ ++#define SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE 2 ++ ++ const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_DELTAP_Rules ++ [SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE] = ++ { ++ /* Maintain thickness of diagonal in 'N' */ ++ { "Times New Roman", 0, "Regular/Bold Class", 'N' }, ++ { "Georgia", 0, "Regular/Bold Class", 'N' }, + }; + + +@@ -399,16 +387,6 @@ + }; + + +- /* Allow a Direct_Move_X along X freedom vector if matched. */ +-#define ALLOW_X_DMOVEX_RULES_SIZE 1 +- +- const SPH_TweakRule ALLOW_X_DMOVEX_Rules +- [ALLOW_X_DMOVEX_RULES_SIZE] = +- { +- { "-", 0, "Regular", 0 }, +- }; +- +- + /* Allow a Direct_Move along X freedom vector if matched. */ + #define ALLOW_X_DMOVE_RULES_SIZE 1 + +@@ -420,17 +398,6 @@ + }; + + +- /* Allow a ZP2 move along freedom vector if matched; */ +- /* This is called from SHP, SHPIX, SHC, SHZ. */ +-#define ALLOW_X_MOVE_ZP2_RULES_SIZE 1 +- +- const SPH_TweakRule ALLOW_X_MOVE_ZP2_Rules +- [ALLOW_X_MOVE_ZP2_RULES_SIZE] = +- { +- { "-", 0, "", 0 }, +- }; +- +- + /* Return MS rasterizer version 35 if matched. */ + #define RASTERIZER_35_RULES_SIZE 8 + +@@ -455,7 +422,8 @@ + const SPH_TweakRule NORMAL_ROUND_Rules + [NORMAL_ROUND_RULES_SIZE] = + { +- /* Fix serif thickness */ ++ /* Fix serif thickness for certain ppems */ ++ /* Can probably be generalized somehow */ + { "Courier New", 0, "", 0 }, + }; + +@@ -481,7 +449,7 @@ + + + /* Skip DELTAP instructions if matched. */ +-#define ALWAYS_SKIP_DELTAP_RULES_SIZE 15 ++#define ALWAYS_SKIP_DELTAP_RULES_SIZE 18 + + const SPH_TweakRule ALWAYS_SKIP_DELTAP_Rules + [ALWAYS_SKIP_DELTAP_RULES_SIZE] = +@@ -491,7 +459,11 @@ + { "Trebuchet MS", 14, "Regular", 'e' }, + { "Trebuchet MS", 13, "Regular", 'e' }, + { "Trebuchet MS", 15, "Regular", 'e' }, ++ { "Trebuchet MS", 0, "Italic", 'v' }, ++ { "Trebuchet MS", 0, "Italic", 'w' }, ++ { "Trebuchet MS", 0, "Regular", 'Y' }, + { "Arial", 11, "Regular", 's' }, ++ /* prevent problems with '3' and others */ + { "Verdana", 10, "Regular", 0 }, + { "Verdana", 9, "Regular", 0 }, + /* Cyrillic small letter short I */ +@@ -508,57 +480,23 @@ + + + /* Always do DELTAP instructions if matched. */ +-#define ALWAYS_DO_DELTAP_RULES_SIZE 2 ++#define ALWAYS_DO_DELTAP_RULES_SIZE 1 + + const SPH_TweakRule ALWAYS_DO_DELTAP_Rules + [ALWAYS_DO_DELTAP_RULES_SIZE] = + { +- { "Verdana Clones", 17, "Regular Class", 'K' }, +- { "Verdana Clones", 17, "Regular Class", 'k' }, +- }; +- +- +- /* Do an extra RTG instruction in DELTAP if matched. */ +-#define DELTAP_RTG_RULES_SIZE 1 +- +- static const SPH_TweakRule DELTAP_RTG_Rules +- [DELTAP_RTG_RULES_SIZE] = +- { +- { "-", 0, "", 0 }, +- }; +- +- +- /* Force CVT distance to zero in MIRP. */ +-#define MIRP_CVT_ZERO_RULES_SIZE 1 +- +- static const SPH_TweakRule MIRP_CVT_ZERO_Rules +- [MIRP_CVT_ZERO_RULES_SIZE] = +- { +- { "-", 0, "", 0 }, +- }; +- +- +- /* Skip moves that meet or exceed 1 pixel. */ +-#define DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE 1 +- +- static const SPH_TweakRule DELTAP_SKIP_EXAGGERATED_VALUES_Rules +- [DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE] = +- { + { "-", 0, "", 0 }, + }; + + + /* Don't allow ALIGNRP after IUP. */ +-#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE 4 ++#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE 1 + + static const SPH_TweakRule NO_ALIGNRP_AFTER_IUP_Rules + [NO_ALIGNRP_AFTER_IUP_RULES_SIZE] = + { + /* Prevent creation of dents in outline */ +- { "Courier New", 0, "Bold", 'C' }, +- { "Courier New", 0, "Bold", 'D' }, +- { "Courier New", 0, "Bold", 'Q' }, +- { "Courier New", 0, "Bold", '0' }, ++ { "-", 0, "", 0 }, + }; + + +@@ -573,16 +511,13 @@ + + + /* Don't allow CALL after IUP. */ +-#define NO_CALL_AFTER_IUP_RULES_SIZE 4 ++#define NO_CALL_AFTER_IUP_RULES_SIZE 1 + + static const SPH_TweakRule NO_CALL_AFTER_IUP_Rules + [NO_CALL_AFTER_IUP_RULES_SIZE] = + { + /* Prevent creation of dents in outline */ +- { "Courier New", 0, "Bold", 'O' }, +- { "Courier New", 0, "Bold", 'Q' }, +- { "Courier New", 0, "Bold", 'k' }, +- { "Courier New", 0, "Bold Italic", 'M' }, ++ { "-", 0, "", 0 }, + }; + + +@@ -605,29 +540,16 @@ + + + /* Embolden these glyphs slightly. */ +-#define EMBOLDEN_RULES_SIZE 5 ++#define EMBOLDEN_RULES_SIZE 2 + + static const SPH_TweakRule EMBOLDEN_Rules + [EMBOLDEN_RULES_SIZE] = + { +- { "Courier New", 12, "Italic", 'z' }, +- { "Courier New", 11, "Italic", 'z' }, +- { "Courier New", 10, "Italic", 'z' }, + { "Courier New", 0, "Regular", 0 }, + { "Courier New", 0, "Italic", 0 }, + }; + + +- /* Do an extra RDTG instruction in DELTAP if matched. */ +-#define DELTAP_RDTG_RULES_SIZE 1 +- +- static const SPH_TweakRule DELTAP_RDTG_Rules +- [DELTAP_RDTG_RULES_SIZE] = +- { +- { "-", 0, "", 0 }, +- }; +- +- + /* This is a CVT hack that makes thick horizontal stems on 2, 5, 7 */ + /* similar to Windows XP. */ + #define TIMES_NEW_ROMAN_HACK_RULES_SIZE 12 +@@ -998,12 +920,9 @@ + } + + TWEAK_RULES( ALLOW_X_DMOVE ); +- TWEAK_RULES( ALLOW_X_DMOVEX ); +- TWEAK_RULES( ALLOW_X_MOVE_ZP2 ); + TWEAK_RULES( ALWAYS_DO_DELTAP ); + TWEAK_RULES( ALWAYS_SKIP_DELTAP ); + TWEAK_RULES( DEEMBOLDEN ); +- TWEAK_RULES( DELTAP_SKIP_EXAGGERATED_VALUES ); + TWEAK_RULES( DO_SHPIX ); + TWEAK_RULES( EMBOLDEN ); + TWEAK_RULES( MIAP_HACK ); +@@ -1012,13 +931,13 @@ + TWEAK_RULES( NO_CALL_AFTER_IUP ); + TWEAK_RULES( NO_DELTAP_AFTER_IUP ); + TWEAK_RULES( RASTERIZER_35 ); +- TWEAK_RULES( SKIP_INLINE_DELTAS ); + TWEAK_RULES( SKIP_IUP ); +- TWEAK_RULES( MIRP_CVT_ZERO ); + + TWEAK_RULES( SKIP_OFFPIXEL_Y_MOVES ); + TWEAK_RULES_EXCEPTIONS( SKIP_OFFPIXEL_Y_MOVES ); + ++ TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES_DELTAP ); ++ + TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES ); + TWEAK_RULES_EXCEPTIONS( SKIP_NONPIXEL_Y_MOVES ); + +diff --git a/src/truetype/ttsubpix.h b/src/truetype/ttsubpix.h +index 5e5d8e6..8a54fc7 100644 +--- a/src/truetype/ttsubpix.h ++++ b/src/truetype/ttsubpix.h +@@ -34,14 +34,15 @@ FT_BEGIN_HEADER + /* ID flags to identify special functions at FDEF and runtime. */ + /* */ + /* */ +-#define SPH_FDEF_INLINE_DELTA_1 0x0000001 +-#define SPH_FDEF_INLINE_DELTA_2 0x0000002 +-#define SPH_FDEF_DIAGONAL_STROKE 0x0000004 +-#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008 +-#define SPH_FDEF_TTFAUTOHINT_1 0x0000010 +-#define SPH_FDEF_SPACING_1 0x0000020 +-#define SPH_FDEF_SPACING_2 0x0000040 +-#define SPH_FDEF_TYPEMAN_STROKES 0x0000080 ++#define SPH_FDEF_INLINE_DELTA_1 0x0000001 ++#define SPH_FDEF_INLINE_DELTA_2 0x0000002 ++#define SPH_FDEF_DIAGONAL_STROKE 0x0000004 ++#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008 ++#define SPH_FDEF_TTFAUTOHINT_1 0x0000010 ++#define SPH_FDEF_SPACING_1 0x0000020 ++#define SPH_FDEF_SPACING_2 0x0000040 ++#define SPH_FDEF_TYPEMAN_STROKES 0x0000080 ++#define SPH_FDEF_TYPEMAN_DIAGENDCTRL 0x0000100 + + + /*************************************************************************/ +@@ -50,29 +51,25 @@ FT_BEGIN_HEADER + /* */ + /* */ + #define SPH_TWEAK_ALLOW_X_DMOVE 0x0000001 +-#define SPH_TWEAK_ALLOW_X_DMOVEX 0x0000002 +-#define SPH_TWEAK_ALLOW_X_MOVE_ZP2 0x0000004 +-#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000008 +-#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000010 +-#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000020 +-#define SPH_TWEAK_DEEMBOLDEN 0x0000040 +-#define SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES 0x0000080 +-#define SPH_TWEAK_DO_SHPIX 0x0000100 +-#define SPH_TWEAK_EMBOLDEN 0x0000200 +-#define SPH_TWEAK_MIAP_HACK 0x0000400 +-#define SPH_TWEAK_NORMAL_ROUND 0x0000800 +-#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0001000 +-#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0002000 +-#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0004000 +-#define SPH_TWEAK_PIXEL_HINTING 0x0008000 +-#define SPH_TWEAK_RASTERIZER_35 0x0010000 +-#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0020000 +-#define SPH_TWEAK_SKIP_INLINE_DELTAS 0x0040000 +-#define SPH_TWEAK_SKIP_IUP 0x0080000 +-#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0100000 +-#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0200000 +-#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0400000 +-#define SPH_TWEAK_MIRP_CVT_ZERO 0x0800000 ++#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000002 ++#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000004 ++#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000008 ++#define SPH_TWEAK_DEEMBOLDEN 0x0000010 ++#define SPH_TWEAK_DO_SHPIX 0x0000020 ++#define SPH_TWEAK_EMBOLDEN 0x0000040 ++#define SPH_TWEAK_MIAP_HACK 0x0000080 ++#define SPH_TWEAK_NORMAL_ROUND 0x0000100 ++#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0000200 ++#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0000400 ++#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0000800 ++#define SPH_TWEAK_PIXEL_HINTING 0x0001000 ++#define SPH_TWEAK_RASTERIZER_35 0x0002000 ++#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0004000 ++#define SPH_TWEAK_SKIP_IUP 0x0008000 ++#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0010000 ++#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0020000 ++#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0040000 ++#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP 0x0080000 + + + FT_LOCAL( FT_Bool ) --- freetype-2.4.12.orig/debian/patches-ft2demos/series +++ freetype-2.4.12/debian/patches-ft2demos/series @@ -0,0 +1,3 @@ +ft2demos-2.1.7-no-rpath.patch -p0 +compiler_hardening_fixes.patch +git_init_variables.patch --- freetype-2.4.12.orig/debian/patches-ft2demos/compiler_hardening_fixes.patch +++ freetype-2.4.12/debian/patches-ft2demos/compiler_hardening_fixes.patch @@ -0,0 +1,49 @@ +Index: ft2demos-2.3.9/src/ftcommon.c +=================================================================== +--- ft2demos-2.3.9.orig/src/ftcommon.c ++++ ft2demos-2.3.9/src/ftcommon.c +@@ -445,6 +445,7 @@ + + if ( file == NULL ) /* shouldn't happen */ + { ++ free( (void *)font->filepathname ); + free( font ); + return FT_Err_Invalid_Argument; + } +@@ -454,7 +455,15 @@ + fseek( file, 0, SEEK_SET ); + + font->file_address = malloc( file_size ); +- fread( font->file_address, 1, file_size, file ); ++ ++ if (fread( font->file_address, 1, file_size, file ) < file_size) ++ { ++ fclose( file ); ++ free( font->file_address ); ++ free( (void *)font->filepathname ); ++ free( font ); ++ return FT_Err_Invalid_Argument; ++ } + + font->file_size = file_size; + +Index: ft2demos-2.3.9/src/ftdiff.c +=================================================================== +--- ft2demos-2.3.9.orig/src/ftdiff.c ++++ ft2demos-2.3.9/src/ftdiff.c +@@ -1138,8 +1138,13 @@ + + if ( text != NULL ) + { +- fread( text, tsize, 1, tfile ); +- text[tsize] = 0; ++ if (fread( text, tsize, 1, tfile ) < 1) { ++ fprintf( stderr, "could not read '%s'\n", textfile ); ++ free( text ); ++ text = (char *)default_text; ++ } else { ++ text[tsize] = 0; ++ } + } + else + { --- freetype-2.4.12.orig/debian/patches-ft2demos/ft2demos-broken-internal-includes.patch +++ freetype-2.4.12/debian/patches-ft2demos/ft2demos-broken-internal-includes.patch @@ -0,0 +1,41 @@ +Index: src/ftcommon.i +=================================================================== +--- src/ftcommon.i.orig 2005-05-26 22:49:41.000000000 -0700 ++++ src/ftcommon.i 2006-03-05 11:54:24.000000000 -0800 +@@ -21,9 +21,6 @@ + #include FT_BITMAP_H + #include FT_SYNTHESIS_H + +- /* the following header shouldn't be used in normal programs */ +-#include FT_INTERNAL_DEBUG_H +- + #include "common.h" + + #include +Index: src/ftdump.c +=================================================================== +--- src/ftdump.c.orig 2004-05-10 13:54:54.000000000 -0700 ++++ src/ftdump.c 2006-03-05 11:54:24.000000000 -0800 +@@ -13,7 +13,8 @@ + #include FT_SFNT_NAMES_H + #include FT_TRUETYPE_IDS_H + +- /* the following header shouldn't be used in normal programs */ ++ /* the following headers shouldn't be used in normal programs */ ++#include "freetype/internal/internal.h" + #include FT_INTERNAL_DEBUG_H + + /* showing driver name */ +Index: src/ftvalid.c +=================================================================== +--- src/ftvalid.c.orig 2005-05-23 13:42:39.000000000 -0700 ++++ src/ftvalid.c 2006-03-05 11:54:24.000000000 -0800 +@@ -17,6 +17,8 @@ + #include + + #include FT_FREETYPE_H ++/* XXX: these are internal headers and should never be used */ ++#include "freetype/internal/internal.h" + #include FT_INTERNAL_DEBUG_H + #include FT_INTERNAL_VALIDATE_H + #include FT_TRUETYPE_TABLES_H --- freetype-2.4.12.orig/debian/patches-ft2demos/ft2demos-2.1.7-no-rpath.patch +++ freetype-2.4.12/debian/patches-ft2demos/ft2demos-2.1.7-no-rpath.patch @@ -0,0 +1,19 @@ +Index: graph/x11/rules.mk +=================================================================== +--- graph/x11/rules.mk.orig 2003-06-16 01:37:10.000000000 -0700 ++++ graph/x11/rules.mk 2006-03-05 11:57:36.000000000 -0800 +@@ -67,9 +67,11 @@ + # The GRAPH_LINK variable is expanded each time an executable is linked + # against the graphics library. + # +- ifeq ($(PLATFORM),unix) +- GRAPH_LINK += $(X11_LIB:%=-R%) +- endif ++ # No, we do not want rpath on Debian; reversing YAMANO-UCHI Hidetoshi's ++ # 2003-06-13 change. (Anthony Fok, 2003-08-28) ++ #ifeq ($(PLATFORM),unix) ++ # GRAPH_LINK += $(X11_LIB:%=-R%) ++ #endif + GRAPH_LINK += $(X11_LIB:%=-L%) -lX11 + + # Solaris needs a -lsocket in GRAPH_LINK. --- freetype-2.4.12.orig/debian/patches-ft2demos/ft2demos-ftview-wrong-types +++ freetype-2.4.12/debian/patches-ft2demos/ft2demos-ftview-wrong-types @@ -0,0 +1,47 @@ +Index: ft2demos-2.1.10/src/ftview.c +=================================================================== +--- ft2demos-2.1.10.orig/src/ftview.c 2005-05-25 11:31:14.000000000 -0700 ++++ ft2demos-2.1.10/src/ftview.c 2006-04-28 01:44:44.000000000 -0700 +@@ -865,10 +865,6 @@ + debug = 1; + break; + +- case 'D': +- dump_cache_stats = 1; +- break; +- + case 'e': + encoding = (FT_Encoding)make_tag( optarg ); + break; +@@ -1053,19 +1049,6 @@ + grWriteCellString( &bit, 0, 8, Header, fore_color ); + grRefreshSurface( surface ); + +- if ( dump_cache_stats ) +- { +- /* dump simple cache manager statistics */ +- fprintf( stderr, "cache manager [ nodes, bytes, average ] = " +- " [ %d, %ld, %f ]\n", +- cache_manager->num_nodes, +- cache_manager->cur_weight, +- cache_manager->num_nodes > 0 +- ? cache_manager->cur_weight * 1.0 / +- cache_manager->num_nodes +- : 0.0 ); +- } +- + grListenSurface( surface, 0, &event ); + if ( !( key = Process_Event( &event ) ) ) + goto End; +Index: ft2demos-2.1.10/src/ftcommon.i +=================================================================== +--- ft2demos-2.1.10.orig/src/ftcommon.i 2006-04-27 23:46:09.000000000 -0700 ++++ ft2demos-2.1.10/src/ftcommon.i 2006-04-28 01:45:41.000000000 -0700 +@@ -186,7 +186,6 @@ + + FTC_ImageTypeRec current_font; + +- int dump_cache_stats = 0; /* do we need to dump cache statistics? */ + int use_sbits_cache = 1; + + int num_indices; /* number of glyphs or characters */ --- freetype-2.4.12.orig/debian/patches-ft2demos/git_init_variables.patch +++ freetype-2.4.12/debian/patches-ft2demos/git_init_variables.patch @@ -0,0 +1,29 @@ +--- ft2demos-2.4.12/src/ftview.c 2013-05-13 13:32:54.433099060 +0200 ++++ ft2demos-2.4.12/src/ftview.c.new 2013-05-13 13:31:17.297095826 +0200 +@@ -1420,7 +1420,7 @@ + if ( !( status.render_mode == RENDER_MODE_TEXT || + status.render_mode == RENDER_MODE_WATERFALL ) ) + { +- const char* encoding; ++ const char* encoding = NULL; + + + switch ( status.encoding ) +@@ -1489,7 +1489,7 @@ + + /* render mode */ + { +- const char* render_mode; ++ const char* render_mode = NULL; + + + switch ( status.render_mode ) +@@ -1563,7 +1563,7 @@ + + if ( handle->antialias ) + { +- const char* lcd_mode; ++ const char* lcd_mode = NULL; + + + switch ( handle->lcd_mode ) --- freetype-2.4.12.orig/debian/source/lintian-overrides +++ freetype-2.4.12/debian/source/lintian-overrides @@ -0,0 +1,4 @@ +# two separate series files; not getting fixed without extensive changes +# upstream +freetype source: quilt-build-dep-but-no-series-file +