* src/autofit/afadjust.c If harfbuzz is enabled, the reverse character
map generation will now consider GSUB entries when looking for
glyphs that correspond to a codepoint
* src/autofit/aflatin.c add tilde unflattening algorithm, applied
based on adjustment database and reverse character map
* src/autofit/aflatin.c fix adjustment database entry for n with tilde
* include/freetype/internal/fttrace.h add "afadjust" trace function
definition, to be used for all adjustment database code.
* src/autofit/afadjust.c fix null derefence when reverse character map
is null.
* src/autofit/aflatin.c contour positions are now adjusted vertically
based on the entries in the adjustment database and reverse character map
src/autofit/aftypes.h add reverse character map to AF_StyleMetricsRec
as well as looking up entries in the adjustment database.
* include/freetype/internal/ftobjs.h (find_unicode_charmap) Move documentation
and function prototype from ftobjs.c to this file so that it can be called
from afadjust.c
* src/base/ftobjs.c (find_unicode_charmap) make this function non-static
* src/autofit/afadjust.c Add functions for looking up vertical adjustment
type, tilde correction type, creating and deleting reverse character maps
* src/autofit/afadjust.h Add headers for the above functions. Correct
definition of AF_AdjustmentDatabaseEntry_ to include tilde correction
type
* src/autofit/aftypes.h Add prototype of AF_ReverseCharacterMap
* src/autofit/autofit.c Add include of afadjust.c
* src/autofit/afadjust.h header file for adjustment database functions
* src/autofit/afadjust.c will contain implementations of the
adjustment database functions
This is mostly cosmetic and removes a few casts, plus Short is
promoted to Int in calculations anyway.
* src/raster/ftraster.c (Vertical_Sweep_Init, Vertical_Sweep_Span,
Vertical_Sweep_Drop, Horizontal_Sweep_Init, Horizontal_Sweep_Span,
Horizontal_Sweep_Drop, Draw_Sweep): Mostly s/Short/Int/ and remove
casting.
This only helps to delay the pool overflow and bisections to larger
sizes and benefits only very intricate glyphs at reasonable sizes.
* src/raster/ftraster.c (TProfile): Use Int instead of Long or PLong
when it is sufficient.
(New_Profile, End_Profuile, Bezier_Up, Sort): Updated accordingly.
* src/raster/ftraster.c (TProfile): Include the variable array member
and repackage with pointers first.
(New_Profile): Advance the top using the variable array pointer.
These ancient builtins have been supported by clang since 2013. We
condition it somewhat stricter but still around 2017. This is more
portable than `__has_builtin`. Fixes#1260.
* src/raster/ftraster.c (New_Profile): Set important fields only and
delay setting `gProfile` until...
(End_Profile): ... it is checked to be valid here.
(Convert_Glyph): Updated.
This fixes a subtle bug when the last profile in a contour was not
properly short-circuited if it was still empty at `End_Profile`.
We finalize all linking in `Finalize_Profile_List` now and do nothing
else there. The turns are added in `End_Profile`.
* src/raster/ftraster.c (Insert_Y_Turn): Moved up unchanged.
(End_Profile): Take care of turns but set only preliminary linking.
(Finalize_Profile_Table): Take care of linking and null-termination.
(Convert_Glyph): Adjusted accordingly.
* src/raster/ftraster.c (End_Profile): Do not initiate next profile.
(New_Profile): Fully initiate new profile.
(Convert_Glyph): Clean up variables, initialize `fProfile` here.
The general square root calculations are not necessary in FreeType.
For vector normalization or length, FreeType uses special functions.
It is, however, required in the legacy CFF specifications.
* src/base/ftcalc.c (FT_SqrtFixed): New function that uses either
Babylonian or bit-wise algorithm, whichever is faster for the given
situation.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed): Declare it.
When matching the keywords, we avoid calculating their lengths by
checking the stored values. This itself is a sufficient pre-check
before diving into `memcmp`. Therefore, we remove explicit check of
the first characters.
* include/freetype/internal/psaux.h (T1_FieldRec): Store length.
* src/cid/cidload.c (cid_parse_dict): Use `memcmp` and stored length.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
* src/cff/cffobjs.c (remove_style): Rewrite using pointers.
(remove_subset_prefix): Unwrap loop and use `memmove`.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag): Unwrap loop
and avoid `strlen`.
This also reduces the used heap size by a large factor.
From Behdad.
* src/autofit/afcjk.h (AF_CJKAxisRec): Use `AF_BLUE_STRINGSET_MAX_LEN`.
* src/autofit/aflatin.h (AF_LatinAxisRec): Ditto.