I introduced some compiler warnings into read_png() with the superfluous
introduction of a couple of volatile qualifiers. I'm sure at the time,
the reason was that gcc suggested adding them - however, ATM gcc issues
no warnings without them.
The CID font subsetting exposed a bug where the subset_glyph->is_scaled
return argument of _cairo_scaled_font_subsets_map_glyph() is sometimes
not assigned a value.
Make cairo-scaled-font-subsets.c limit Type1 font subsets to
256 glyphs. This allows Type1 subsetting to be enabled again
with type1-fallback as the fallback option for Type1 fonts.
Switching to CID font embedding requires a fallback font for
the case where CFF CID or TrueType CID subsetting fails.
The new function _cairo_type2_charstrings_init() added to
cairo-type1-fallback.c creates Type2 charstrings from glyph
paths. _cairo_cff_fallback_init() in cairo-cff-subset.c
wraps these charstrings in a CFF CID font.
OpenType/CFF fonts come in two types: CID and non CID.
CFF CID font subsetting was previously disabled in cairo
due 1) to the need to embed CFF CID fonts in PDF as a CID fonts
and 2) there is no easy way to convert CFF CID to CFF non CID.
With the switch to CID fonts cairo-cff-subset.c has been
updated to subset CID fonts and to covert non CID fonts to
CID. A further advantage of converting non CID CFF fonts
to CID is the reduction in size due to not embedding the
name of each glyph in the font subset.
cairo-scaled-font-subsets.c now provides three functions for creating subsets:
_cairo_scaled_font_subsets_create_scaled()
Create a subset for each scaled font with maximum size INT_MAX.
_cairo_scaled_font_subsets_create_simple()
Create subsets suitable for embedding as simple fonts in PS/PDF.
_cairo_scaled_font_subsets_create_composite()
Create subsets suitable for embedding as composite fonts in PS/PDF.
The _create_simple() and _create_composite() functions both merge
scaled fonts with the same face and an outline path available into
the same subset. _create_composite() has a maximum subset size of
65536 for outline fonts. Bitmap fonts have a separate subset for
each scale with a maximum subset size of 256.
The _create_simple() and _create_composite() functions both reserve
the first glyph in the subset for the .notdef glyph. CID fonts require
CID 0 to be .notdef.
Update Type1, TrueType and CFF subsetting to expect glyph 0 of each
subset to be the .notdef.
During MT cairo testing we get the error "libpng: Read Error" which is
emitted should the fread return fewer bytes than asked. However, this is
not necessarily an error, so double-check the ferror() status before
raising a png_error().