Issue #28226 involved a work-around for a font which used the
`setcurrentpoint' operator in an invalid way; this operator is only
supposed to be used with the result of OtherSubrs, and the font used
it directly. The supplied patch removed the block of code which
checked this usage entirely.
This turns out to be a Bad Thing. If `setcurrentpoint' is being
used correctly it should reset the flex flag in the decoder. If we
don't do this then the flag never gets reset and we omit any further
contours from the glyph (at least until we close the path or
similar).
* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<op_setcurrentpoint>: Handle `flex_state' correctly.
Ghostscript requires the incremental font interface for handling
some Postscript documents. It is moving to using FreeType as its
primary renderer; supporting this in the default build makes it
Ghostscript to be linked against the system FreeType when one is
available.
* include/freetype/config/ftoption.h (FT_CONFIG_OPTION_INCREMENTAL):
Uncomment.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap) [FT_CONFIG_OPTION_PIC]:
Declare `library' for FT_BITMAP_GLYPH_CLASS_GET.
* src/base/ftinit.c (ft_destroy_default_module_classes,
ft_create_default_module_classes): Use proper casts (needed for C++
compilation).
* src/sfnt/ttcmap.c (tt_cmap13_class_rec): Use FT_DEFINE_TT_CMAP.
Reported by Sean.
* src/base/ftdbgmem.c [!FT_DEBUG_MEMORY]: ANSI C doesn't like empty
source files; however, some compilers warn about an unused variable
declaration. This is now replaced with a typedef.
There exist corrupt, subsetted fonts (embedded in PDF files) which
contain a private dict that ends with an unterminated floating point
number (no operator following). We now ignore this error (as
acrobat does).
* src/cff/cffparse.c (cff_parser_run): Don't emit a syntax error for
unterminated floating point numbers.
This fixes Savannah bug #28226.
At least two wild PostScript files of unknown provenance contain
Type 1 fonts, apparently converted from TrueType fonts in earlier
PDF versions of the files, which use the `setcurrentpoint' operator
inappropriately.
FreeType currently throws an error in this case, but Ghostscript and
Adobe Distiller both accept the fonts and ignore the problem. This
commit #ifdefs out the check so PostScript interpreters using
FreeType can render these files.
The specification says `setcurrentpoint' should only be used to set
the point after a `Subr' call, but these fonts use it to set the
initial point to (0,0). Unnecessarily so, as they correctly use an
`hsbw' operation which implicitly sets the initial point.
Reported by Sean McBride <sean@rogue-research.com>.
* src/tools/apinames.c (read_header_file)<STATE_TYPE>: Use a cast to
`int', as specified in the printf(3) man page.
* src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
(cid_face_init), src/type1/t1afm.c (T1_Read_Metrics),
src/type1/t1objs.c (T1_Face_Init): Don't use unsigned constant
values for rounding if the argument can be negative.
* src/cff/cffgload.c (CFF_Operator, cff_argument_counts): Handle
`seac', `sbw', and `setcurrentpoint' opcodes.
(cff_compute_bias): Add parameter to indicate the charstring type.
Update all callers.
(cff_operator_seac): Add parameter for side bearing.
(cff_decoder_parse_charstrings): Updated for more Type1 support.
Reported by Jeremy Manson <jeremy.manson@gmail.com>.
src/truetype/ttgload.c (load_truetype_glyph): Add parameter to
quickly load the glyph header only.
Update all callers.
(tt_loader_init): Add parameter to quickly load the `glyf' table
only.
Update all callers.
(TT_Load_Glyph): Compute linear advance values for embedded bitmap
glyphs too.
* src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_get,
cff_op_put>: Appendix B of Adobe Technote #5177 limits the number of
elements for the `get' and `put' operators to 32.
* src/cff/cffgload.h (CFF_MAX_TRANS_ELEMENTS): Define.
(CFF_Decoder): Use it for `buildchar' and remove `len_buildchar'.
Problem and solution reported by Ning Dong <flintning@163.com>.
* src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_dup>:
Increase `args' by 2, not 1.
==========================
Tag sources with `VER-2-3-11'.
* docs/VERSION.DLL: Update documentation and bump version number to
2.3.11.
* README, Jamfile (RefDoc), builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj,
builds/win32/visualce/index.html,
builds/win32/visualce/freetype.dsp,
builds/win32/visualce/freetype.vcproj: s/2.3.10/2.3.11/, s/2310/2311/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 11.
* builds/unix/configure.raw (version_info): Set to 9:22:3.
==========================
Tag sources with `VER-2-3-10'.
* builds/toplevel.mk (major, minor, patch): Fix regexp to allow more
than a single digit.
(dist): We now use git.
* docs/VERSION.DLL: Update documentation and bump version number to
2.3.10.
* README, Jamfile (RefDoc), builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj,
builds/win32/visualce/index.html,
builds/win32/visualce/freetype.dsp,
builds/win32/visualce/freetype.vcproj: s/2.3.9/2.3.10/, s/239/2310/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 10.
* builds/unix/configure.raw (version_info): Set to 9:21:3.
This was broken since version 2.3.0.
* src/raster/ftraster.c (count_table): Use pre-2.3.0 values (which
were then computed dynamically).
(Vertical_Gray_Sweep_Step): Updated.
(ft_black_render): Initialize `worker->gray_lines' (problem found by
valgrind).
(FT_RASTER_OPTION_ANTI_ALIASING, DEBUG_RASTER): Dont' #undef, just
comment out.
The calculation of `vertBearingX' is not defined in the OTF font
spec so FreeType does a `best effort' attempt. However, this value
is defined in the PDF and PostScript specs, and that algorithm is
better than the one FreeType currently uses:
FreeType: Use the middle of the bounding box as the X coordinate
of the vertical origin.
Adobe PDF spec: Use the middle of the horizontal advance vector as
the X coordinate of the vertical origin.
FreeType's algorithm goes wrong if you have a really small glyph
(like the full-width, circle-like dot at the end of the sentence, as
used in CJK scripts) with large bearings. With the FreeType
algorithm this dot gets centered on the baseline; with the PDF
algorithm it gets the correct location (in the top right). Note
that this is a serious issue, it's like printing the dot at the end
of a Roman sentence at the center of the textline instead of on the
baseline like it should. So i believe the PDF spec's algorithm
should be used in FreeType as well.
The `vertBearingY' value for such small glyphs is also very strange
if no `vmtx' information is present, since the height of the bbox is
not representable for the height of the glyph visually (the
whitespace up to the baseline is part of the glyph). The fix also
includes some code for a better estimate of `vertBearingY'.
* src/base/ftobjs.c (ft_synthesize_vertical_metrics): `vertBearingX'
is now calculated as described by the Adobe PDF Spec. Estimate for
`vertBearingY' now works better for small glyphs completely above or
below the baseline into account.
* src/cff/cffgload.c (cff_slot_load): `vertBearingX' is now
calculated as described by the Adobe PDF Spec. Vertical metrics
information was always ignored when FT_CONFIG_OPTION_OLD_INTERNALS
was not defined.
* src/truetype/ttgload.c (compute_glyph_metrics): `vertBearingX' is
now calculated as described by the Adobe PDF Spec.
* include/freetype/internal/t1types.h (T1_EncodingRecRec_): Update
comment to reflect revised code_last meaning.
* src/type1/t1load.c (T1_Open_Face), src/type42/t42objs.c
(T42_Open_Face): Assign max_char as highest character code + 1 and
use this for T1_EncodingRecRec_::code_last.
* src/psaux/t1cmap.c (t1_cmap_custom_init): Follow revised
T1_EncodingRecRec_::code_last meaning.
Bug reported by Ivan Nincic <inincic@pdftron.com>.
* src/cff/cffgload.c (cff_slot_load): Thinko: Check `xx' element of
`font_matrix' also.
* docs/CHANGES: Updated.