With 64-bit platforms widely available, it is more efficient to use
64-bit variables readily. It results in noticeable 10% improvement
in glyph loading speed.
* src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14) [FT_INT64]:
Prioritize available implementation with arguments adjusted based on
the use cases.
Resolves inconsistencies in 64-bit multiplication discussed in !355.
Importantly, FT_MulFix arguments and return value is FT_Long,
whatever sizeof FT_Long is on 64-bit platforms: 8 bytes on Linux or
4 bytes on Windows.
* include/freetype/internal/ftcalc.h (FT_MulFix_x86_64): Removed.
(FT_MulFix_64): Generalize and prioritize the inline implementation
for all 64-bit platforms ifdef FT_INT64.
* src/base/ftcalc.c (FT_MulFix)[FT_INT64]: Call 'FT_MulFix_64'.
* src/base/ftbase.c: Include 'ftcalc.c' after the FT_MulFix callers
to enable its inlining.
Resolves inconsistencies in 64-bit multiplication discussed in !355. Importantly, FT_MulFix arguments and return value is FT_Long, whatever sizeof FT_Long is on 64-bit platforms: 8 bytes on Linux or 4 bytes on Windows. * include/freetype/internal/ftcalc.h (FT_MulFix_x86_64): Removed. (FT_MulFix_64): Generalize and prioritize the inline implementation
for all 64-bit platforms ifdef FT_INT64. * src/base/ftcalc.c (FT_MulFix)[FT_INT64]: Call 'FT_MulFix_64'. * src/base/ftbase.c: Include 'ftcalc.c' after the FT_MulFix callers to enable its inlining.
Before, we were loading a palette (again and again) even if the
same was requested. Even if the font only had one palette...
For a font like NotoColorEmoji that has over 5000 colors in its
palette, this was dominating the COLRv1 loading times for HarfBuzz
(and I believe all other clients) because they have to set the
palette to get access to the colors.
* src/base/ftcolor.c (FT_Palette_Select): Check the current palette.
* src/bdf/bdflib.c (bdf_parse_start_): Reject fonts with initial
COMMENTs.
(bdf_parse_properties_): Skip COMMENTs so that...
(bdf_add_property_): Do not make exception for COMMENT.
(bdf_parse_glyphs_, bdf_add_comments): Updated.
* src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling
of the default char until...
* src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties.
* src/bdf/bdf.h (bdf_font_t): Remove `monowidth`.
* src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling
of the font spacing until...
* src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties.
* src/bdf/bdflib.c (bdf_parse_start_, bdf_add_property_): Delay handling
of the font ascent and descent until...
* src/bdf/bdfdrivr.c (BDF_Face_Init): ... handles all other properties.
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.