freetype2/src/cff
Dave Arnold 3a2cb0f881 Fix Savannah bug #39295.
The bug was caused by switching to the initial hintmap (the one in
effect when `moveto' executes) just before drawing the final element
in the charstring.  This ensured that the path was closed (in both
Character Space and Device Space).  But if the final element was a
curve and if the final hintmap was different enough from the initial
one, then the curve was visibly distorted.

The first part of the fix is to draw the final curve using the final
hintmap as specified by the charstring.  This corrects the
distortion but does not ensure closing in Device Space.  It may
require the rasterizer to automatically generate an extra closing
line.  Depending on the hintmap differences, this line could be from
zero to a couple pixels in length.

The second part of the fix covers the case where the charstring
subpath is closed with an explicit line.  We now modify that line's
end point to avoid the distortion.

Some glyphs in the bug report font (TexGyreHeros-Regular) that show
the change are:

  25ppem    S (98)
  24ppem    eight (52)
  25.5ppem  p (85)

Curves at the *end* of a subpath are no longer distorted.  However,
some of these glyphs have bad hint substitutions in the middle of a
subpath, and these are not affected.

The patch has been tested with a set of 106 fonts that shipped with
Adobe Creative Suite 4, together with 756 Open Source CFF fonts from
Google Fonts.  There are 1.5 million glyphs, of which some 20k are
changed with the fix.  A sampling of a few hundred of these changes
have been examined more closely, and the changes look good (or at
least acceptable).

* src/cff/cf2hints.h (CF2_GlyphPathRec): New element `pathIsClosing'
to indicate that we synthesize a closepath line.

* src/cff/cf2hints.c (cf2_glyphpath_init): Updated.
(cf2_glyphpath_pushPrevElem): If closing, use first hint map (for
`lineto' operator) and adjust hint zone.
For synthesized closing lines, use end point in first hint zone.
(cf2_glyphpath_lineTo): Take care of synthesized closing lines.  In
particular, shift the detection of zero-length lines from character
space to device space.
(cf2_glyphpath_closeOpenPath): Remove assertion.
Updated.
2013-09-29 16:17:02 +02:00
..
Jamfile Position Independent Code (PIC) support in cff driver. 2009-04-05 18:12:03 +03:00
cf2arrst.c Next round of compiler fixes. 2013-06-06 09:16:38 +02:00
cf2arrst.h [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2blues.c Another round of cppcheck nitpicks. 2013-08-01 12:20:20 +02:00
cf2blues.h [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2error.c [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2error.h [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2fixed.h Fix errors reported by clang's `sanitize' feature. 2013-05-04 14:05:24 +02:00
cf2font.c [cff] Add `darkening-parameters' property. 2013-06-25 23:28:02 +02:00
cf2font.h [cff] Add `darkening-parameters' property. 2013-06-25 23:28:02 +02:00
cf2ft.c [cff] Add `darkening-parameters' property. 2013-06-25 23:28:02 +02:00
cf2ft.h [cff] Make Adobe CFF engine work correctly on 64bit hosts. 2013-05-04 18:04:07 +02:00
cf2glue.h [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2hints.c Fix Savannah bug #39295. 2013-09-29 16:17:02 +02:00
cf2hints.h Fix Savannah bug #39295. 2013-09-29 16:17:02 +02:00
cf2intrp.c More compiler warning fixes. 2013-06-12 10:58:06 +02:00
cf2intrp.h [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2read.c More compiler warning fixes. 2013-06-12 10:58:06 +02:00
cf2read.h [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2stack.c [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2stack.h [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cf2types.h [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
cff.c [cff] Add a new Type 2 interpreter and hinter. 2013-04-13 18:53:28 +02:00
cffcmap.c */*: Use `FT_THROW'. 2013-03-14 10:27:35 +01:00
cffcmap.h Position Independent Code (PIC) support in cff driver. 2009-04-05 18:12:03 +03:00
cffdrivr.c Better tracing of loaded glyphs. 2013-08-26 12:55:48 +02:00
cffdrivr.h Position Independent Code (PIC) support in cff driver. 2009-04-05 18:12:03 +03:00
cfferrs.h Prepare source code for amalgamation. 2012-03-08 06:04:03 +01:00
cffgload.c Better tracing of loaded glyphs. 2013-08-26 12:55:48 +02:00
cffgload.h Add CFF_CONFIG_OPTION_OLD_ENGINE configuration option. 2013-06-03 12:41:58 +02:00
cffload.c Fix Savannah bug #39702. 2013-08-06 08:55:19 +02:00
cffload.h Remove trailing spaces. 2012-01-17 02:00:24 +09:00
cffobjs.c [cff] Add `darkening-parameters' property. 2013-06-25 23:28:02 +02:00
cffobjs.h [cff] Add `darkening-parameters' property. 2013-06-25 23:28:02 +02:00
cffparse.c Fix clang fixes. 2013-05-04 18:57:56 +02:00
cffparse.h [cff] Better tracing of the parsing process. 2011-08-25 13:41:16 +02:00
cffpic.c Whitespace. 2013-03-17 08:14:46 +01:00
cffpic.h Add framework for CFF properties. 2013-04-12 19:48:06 +02:00
cfftoken.h [cff] Better tracing of the parsing process. 2011-08-25 13:41:16 +02:00
cfftypes.h [cff] Add a new Type 2 interpreter and hinter. 2013-04-13 18:53:28 +02:00
module.mk FT_USE_MODULE declares things as: 2008-12-21 10:29:30 +00:00
rules.mk [cff] Add a new Type 2 interpreter and hinter. 2013-04-13 18:53:28 +02:00