Instead of cumbersome field list mamangement, we will tokenize input
using custom `bdf_strtok_`.
* src/bdf/bdflib.c (bdf_list_t_, bdf_list_init_, bdf_list_ensure_,
bdf_list_shift_, bdf_list_join_, bdf_list_split_,
bdf_set_default_spacing_): Removed.
(bdf_strtok_): New function which NUL-terminates the first token at
the delimiter position and returns the next token that follows
consequtive delimiters.
(bdf_parse_*_, bdf_load_font): Updated.
* docs/CHANGES: Claim overall 75% performance improvement.
* src/bdf/bdf.h (bdf_options_t): Removed.
(BDF_KEEP_COMMENTS, BDF_KEEP_UNENCODED, BDF_CORRECT_METRICS): Updated
to avoid collisions with the other parsing flags.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Use default flags explicitly.
* src/bdf/bdflib.c (bdf_load_font): Use flags as an argument to
initialize the parser.
(bdf_set_fedault_spacing_): Default to BDF_PROPORTIONAL explicitly.
(bdf_parse_*_): Updated.
A dedicated parser of bitmap data with minimal error checking and
no string comparisons helps to improve performance.
* src/bdf/bdflib.c (bdf_parse_bitmap_): New dedicated bitmap parser.
(bdf_parse_glyphs_): Pass to `bdf_parse_bitmap_` on BITMAP.
This resolves build problems with newer libPNG versions by switching
to using IMPORTED CMake targets for common libraries where provided.
To do this the required CMake version is raised to version 3.12.
Doing this seems justified as using IMPORTED targets is a cleaner
and more powerful solution that can leverage advanced and CMake-specific
features that may be utilized by the referred dependencies' CMake modules.
Resolves#1311.
After the previous commit, cff_glyph_load is no longer called
without first checking for valid size and glyph objects in
FT_Glyph_Load and these checks can be removed downstream.
* src/cff/cffdrivr.c (cff_glyph_load): Remove `size` and `glyph` checks.
* src/cff/cffgload.c (cff_slot_load): Ditto.
Otherwise, let TT_Get_Advances fall back on cff_load_glyph to do
slow advances. This avoids unchecked access to cff_load_glyph and
this is how tt_get_advances is implemented.
This assignmets used to be done prematurely before errors were checked
and outlines were actually loaded. Delaying the assignment provides
certain protection against careless usage of malformed input that
should now remain FT_GLYPH_FORMAT_NONE.
* src/cff/cffgload.c (cff_slot_load): Ditto.
* src/cid/cidgload.c (cid_slot_load_glyph): Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Ditto.
* src/truetype/ttgload.c (TT_Load_Glyph): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
This is already done by `ft_glyphslot_clear`.
* src/cff/cffgload.c (cff_slot_load): Do not zero outline fields.
* src/cid/cidgload.c (cid_slot_load_glyph: Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Ditto.
* src/truetype/ttgload.c (load_sbit_image): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
For consistency with other bitmap-only fonts, we should ignore this
flag of the font is not scalable.
* src/truetype/ttgload.c (TT_Load_Glyph): Check if face is scalable
when checking for FT_LOAD_NO_BITMAP.
* docs/CHANGES: Start new chapter wtith this change.
In `FT_Stroker_ConicTo` and `FT_Stroker_CubicTo` there is a `bez_stack`.
`arc` is initialized with `arc = bez_stack` and is never set to point
into any different object. The main loop looks like `while ( arc >=
bez_stack )` which is depending on a later `arc -= 2` (or `arc -= 3`) to
make `arc` point to before `bez_stack`. However, using pointer
subtraction to make `arc` point outside the array is undefined behavior,
and attempting to use the value in the loop predicate is "very"
undefined behavior. (C99 "Additive operators" 6.5.6.8.)
This particular undefined behavior was discovered as either hangs or
MemorySantizer issues after "[InstCombine] Infer nuw for gep inbounds
from base of object" [0]. With this change, clang can infer that `arc`
must always point into the `bez_stack` object and therefore cannot be at
a "negative index" so the predicate is always true.
[0] e21ab4d16b
* src/base/ftstroke.c (FT_Stroker_ConicTo, FT_Stroker_CubicTo): test
loop exit condition (there are no more arcs to process) before
decrementing `arc`
Fixes: #1307
When `sfnt->load_face` succeeds it has already loaded any (optional)
cmap data. As a result, a subsequent call to `sfnt->load_cmap` will
overwrite the cmap data pointer with a new copy of the data but not free
the old, leading to a leak.
This is a fix for "* src/cff/cffobjs.c (cff_face_init): Better handling
of Type0 fonts.". This still allows the cmap to be missing but avoids
the leak by only calling `sfnt->load_cmap` when there is no `head`
table (the font data is not being loaded as OpenType/CFF).
* src/cff/cffobjs.c (cff_face_init): Fix leak
Fixes: #1306
This issue relates to the PDF specification and its usage of CFF-based
embedded Type0 fonts. For Type0 fonts containing CID-keyed descendant
CFF-based fonts, the glyph index is the CID present in the content stream.
As a result, there is no requirement for a 'cmap' table to be present in the
font since the glyph indices are derived directly from the CIDs. FreeType
throws an error when it doesn’t find a 'cmap' table for such an Open Type
font containing CFF outlines. This commit relaxes this requirement for a
'cmap' table for such fonts.
* builds/toplevel.mk: In `make dist`, checkout gnu-config
git repository at savannah, copy the latest versions of
`config.guess` and `config.sub` to builds/unix/. Also
the latest version of `gitlog-to-changelog` is used to
generate `ChangeLog`.
* src/base/ftobjs.c (destroy_size, destroy_face): This is such that the
generic destroy can be used to call `FT_Done_Library`. For that to work,
it needs to call it *after* having removed the face from the respective
module.
o Replace `test -e` by `test -d` (directory) and `-h`
(symlink), because pre-POSIX /bin/sh of Solaris 10
does not support `test -e`.
o Replace the combination of `head` and `sed ...` by
single sed command `sed -n 1...p`. GNU libtoolize
with Solaris 10 /bin/sh complains "Broken Pipe" for
the closure of stdout by `head`. Let `sed` receive
all stdout and discard.
Some output formats may rewrite symbol names during the output,
like the concatenation of "64__" suffix on VMS. To estimate
sufficient size to store symbol name, pass the output format
info to `names_add`. For VMS, `names_add` allocates longer
buffer to append "64__".
* apinames.c (SUFFIX_VMS_64ADDR): New macro of "64__".
(main): Pass the format info to `read_header_file`.
(read_header_file): Pass the format info to `names_add`.
(names_add): Receive the format info, and reserve the symbol
name buffer 4 byte longer in the case of VMS, to append the
suffix in `names_dump`.
* apinames.c (names_dump): For WATCOM_LBC format, the
DLL name with no suffix is constructed on a static
array temp[], but the scope is closed before use it.
The declaration of temp[] is moved to the wider
scope for the dumping part to refer it.
* src/tools/apinames.c: The first header file must be
given after the options. All arguments after the
first header file are dealt as header files to be
parsed, regardless with their leading "-".
For example,
"apinames include/freetype/freetype.h -dFREETYPE.DLL"
warns "unable to open -dFREETYPE.DLL".
Thus, the "header1" must be given after the arguments
to be parsed as the options.
* vms_name.com: Suppress a warning with the latest Clang compiler.
* builds/vms/apinames_vms.bash: Use absolute path to avoid dependency on the
environment.