freetype/src
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
..
autofit [autofit] Remove outdated comment. 2013-09-25 23:32:25 +02:00
base Fix vertical size of emboldened glyphs. 2013-09-20 07:20:53 +02:00
bdf [bdf, pcf] Refuse non-zero face_index. 2013-09-25 10:57:17 +09:00
bzip2 */*: Use FT_Err_Ok only. 2013-03-14 11:21:17 +01:00
cache * src/cache/ftcmanag.c (FTC_Manager_Reset): Add missing cache flush. 2013-06-09 08:20:54 +02:00
cff Fix Savannah bug #39295. 2013-09-29 16:17:02 +02:00
cid Better tracing of loaded glyphs. 2013-08-26 12:55:48 +02:00
gxvalid Another round of cppcheck nitpicks. 2013-08-01 12:20:20 +02:00
gzip [gzip] New function `FT_Gzip_Uncompress'. 2013-08-29 17:53:24 +02:00
lzw Apply fixes for cppcheck nitpicks. 2013-06-04 10:30:48 +02:00
otvalid */*: Use FT_ERR_EQ, FT_ERR_NEQ, and FT_ERR where appropriate. 2013-03-14 17:50:49 +01:00
pcf [bdf, pcf] Refuse non-zero face_index. 2013-09-25 10:57:17 +09:00
pfr Better tracing of loaded glyphs. 2013-08-26 12:55:48 +02:00
psaux Next round of compiler fixes. 2013-06-06 09:16:38 +02:00
pshinter Another round of cppcheck nitpicks. 2013-08-01 12:20:20 +02:00
psnames Whitespace. 2013-03-17 08:14:46 +01:00
raster More compiler warning fixes. 2013-06-12 10:58:06 +02:00
sfnt [sfnt] Fix frame access while reading WOFF table directory. 2013-08-29 21:03:05 +02:00
smooth [smooth] Fix segfault caused by previous commit. 2013-07-16 15:25:24 +02:00
tools [autofit] Introduce data file for blue strings. 2013-08-25 08:01:41 +02:00
truetype Implement support for WOFF containers. 2013-08-29 17:53:40 +02:00
type1 Better tracing of loaded glyphs. 2013-08-26 12:55:48 +02:00
type42 [bdf, pcf] Refuse non-zero face_index. 2013-09-25 10:57:17 +09:00
winfonts Better tracing of loaded glyphs. 2013-08-26 12:55:48 +02:00
Jamfile Add license. 2005-06-04 23:04:30 +00:00