|
4334f009
|
2025-09-28T08:09:48
|
|
[autofit] Prevent signed integer overflow.
* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
af_latin_stretch_bottom_tilde, af_latin_align_top_tilde,
af_latin_align_bottom_tilde,
af_glyph_hints_apply_vertical_separation_adjustments): Use `ADD_LONG` and
`SUB_LONG` for values that involve `FT_LONG_MAX` and `FT_LONG_MIN`.
Fixes issue #1363.
|
|
53b9319b
|
2025-09-10T14:10:23
|
|
* src/autofit/afgsub.c (af_map_lookup): Fix handling of lookup type 7.
Fixes issue #1356.
|
|
e969f529
|
2025-09-08T05:57:19
|
|
[autofit] Fix HarfBuzz calling.
* src/autofit/afadjust.c (af_reverse_character_map_new)
[FT_CONFIG_OPTION_USE_HARFBUZZ]: Use `ft_hb_enabled`.
Fixes issue #1354.
|
|
32cb5390
|
2025-09-06T06:14:03
|
|
Update all copyright notices.
|
|
23fa1e35
|
2025-08-21T07:09:15
|
|
Updating `CHANGES` file; minor fixes elsewhere (mostly formatting).
|
|
508c30e0
|
2025-08-14T10:33:30
|
|
* src/autofit/afgsub.c: Fix a warning.
Fixes [-Wunused-function] warning without HarfBuzz.
|
|
0fd0cf33
|
2025-07-01T22:15:07
|
|
[autofit] Remove `globals->gsub_length`.
We completely validate the accessed data from the 'GSUB' table, making this
field unnecessary.
* src/autofit/afglobal.h (AF_FaceGlobalsRec): Remove `gsub_length` field.
* src/autofit/afglobal.c (af_face_globals_new), src/autofit/afgsub.c
(af_parse_gsub): Updated.
|
|
5e671510
|
2025-07-01T18:09:27
|
|
* src/autofit/afgsub.c: Include `tttables.h` and `afgsub.h`.
This fixes 'make multi' compilation with clang.
Reported as
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984610
|
|
01695ea7
|
2025-07-01T18:06:17
|
|
Various minor fixes.
As reported by clang 19.
* src/autofit/afadjust.c (adjustment_database): Make it static.
* src/base/ftdbgmem.c (FT_MEM_SIZE_MIN): Remove unused macro.
* src/psaux/psobjs.c (skip_procedure), src/truetype/ttinterp.c (Ins_IF,
Ins_ELSE, Ins_FDEF, Ins_IDEF): Add `default` clause.
|
|
f1be7392
|
2025-07-01T18:00:12
|
|
More signedness fixes.
As reported by clang 19.
* src/autofit/afadjust.c (add_substitute): Make first argument unsigned.
Update all callers.
Other minor signedness fixes.
(af_reverse_character_map_new): Minor signedness fixes.
* src/autofit/afgsub.c (af_hash_insert): Minor signedness fixes.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Make third
argument unsigned.
Update all callers.
Other minor signedness fixes.
(af_latin_hints_apply): Minor signedness fixes.
* src/bdf/bdflib.c (bdf_parse_bitmap_): Minor signedness fix.
* src/truetype/ttobjs.c (tt_size_init_bytecode): Minor signedness fix.
|
|
8d82c9fa
|
2025-07-01T17:08:37
|
|
*/*: Fix trivial signedness issues with format strings in trace messages.
As reported with clang 19's `-Wformat` option.
|
|
346d8fae
|
2025-07-01T05:16:54
|
|
Fix `make multi`.
Reported as
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381#note_2984253
* src/base/fthash.c: Include `ftobjs.h`.
* src/autofit/afgsub.c: Include `afglobal.h`.
|
|
6a982bde
|
2025-06-14T16:21:44
|
|
[autofit] Speed up computation of `af_reverse_character_map_new`. (4/4)
With this commit, the start-up time for creating the reverse character map
gets reduced from more than 300% to about 25% (as tested with `arial.ttf`
version 7.00).
* src/autofit/afadjust.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include
`afgsub.h`.
(add_substitute): New auxiliary function to recursively add elements to
the reverse cmap.
(af_reverse_character_map_new): New code that replaces the old code
removed in the previous commit.
|
|
9e8b642b
|
2025-06-13T11:39:43
|
|
[autofit] Speed up computation of `af_reverse_character_map_new`. (3/4)
Rip out some HarfBuzz code of `af_reverse_character_map_new`. The new code
comes immediately in a follow-up commit, making it easier to follow the
changes.
* src/autofit/afadjust.c (af_get_glyph_alternates_helper,
af_get_glyph_alternates): Remove.
(af_reverse_character_map_new): Remove code to create the `*map` hash.
|
|
9bfb8e80
|
2025-06-13T11:27:09
|
|
[autofit] Speed up computation of `af_reverse_character_map_new`. (2/4)
Create an array of GSUB lookup indices for `SingleSubst` and
`AlternateSubst` lookup types to exit early if we have different types.
Also improve tracing.
* src/autofit/afglobal.h (AF_FaceGlobals) [FT_CONFIG_OPTION_USE_HARFBUZZ]:
New fields `gsub_length`, `gsub`, and `gsub_lookups_single_alternate`.
* src/autofit/afglobal.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include
`afgsub.h`.
(af_face_globals_new) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call
`af_parse_gsub` to fill `gsub_lookups_single_alternate`.
(af_face_globals_free): Updated.
* src/autofit/afadjust.c (af_get_glyph_alternates_helper): Exit early if we
possible.
(af_reverse_character_map_new): Trace GSUB lookup indices to be checked.
|
|
cda418a4
|
2025-06-13T11:23:14
|
|
[autofit] Speed up computation of `af_reverse_character_map_new`. (1/4)
Using HarfBuzz's API functions to construct the reverse map is too slow; we
have to call `hb_ot_layout_lookup_get_glyph_alternates` far too often
because it can only handle a single glyph at a time. For this reason we are
going to parse the GSUB table by ourselves.
The new non-local functions are `af_parse_gsub` and `af_map_lookup`.
* src/autofit/afgsub.c, src/autofit/afgsub.h: New files for parsing,
validating, and mapping the `SingleSubst` and `AlternateSubst` subtable
types of a GSUB table.
* src/autofit/autofit.c, src/autofit/rules.mk (AUTOF_DRV_SRC): Updated.
|
|
61bacf3d
|
2025-06-18T14:57:56
|
|
Set minimum HarfBuzz version back to 2.0.0.
Due to the new GSUB parsing we no longer need
`hb_ot_layout_lookup_get_glyph_alternates`.
This partially reverts commit 5d2fd7608a9.
* CMakeLists.txt (HARFBUZZ_MIN_VERSION), meson.build (harfbuzz_dep),
builds/unix/configure.raw (harfbuzz_pkg): Set version to 2.0.0.
* src/autofit/ft-hb-decls.h: Remove entry for
`hb_ot_layout_lookup_get_glyph_alternates`.
|
|
3ccc27dc
|
2025-06-19T08:06:53
|
|
[autofit] Really fix handling of `RTLD_DEFAULT`.
This commit actually implements what commit 43ec023e1a7 describes.
* src/autofit/ft-hb.c (FT_RTLD_FLAGS): New macro for `dlopen`; it uses
`RTLD_GLOBAL` only if `RTLD_DEFAULT` is available.
|
|
fc051dc0
|
2025-06-12T10:20:07
|
|
[autofit] Ignore virtual glyph indices from GSUB lookups.
Reported as
https://issues.chromium.org/issues/420401651
* src/autofit/afadjust.c (af_reverse_character_map_new): Implement it.
|
|
bd28cf7a
|
2025-06-04T08:55:04
|
|
[autofit] Fix `-Wunused-but-set-variable` warning in Windows builds.
With this commit, the following warning gets removed.
```
In file included from src/autofit/autofit.c:21:0:
src/autofit/ft-hb.c: In function 'ft_hb_funcs_init':
src/autofit/ft-hb.c:75:35: warning:
variable 'version_atleast' set but not used [-Wunused-but-set-variable]
ft_hb_version_atleast_func_t version_atleast = NULL;
^~~~~~~~~~~~~~~
```
* src/autofit/ft-hb.c (ft_hb_funcs_init): Move `NULL` check of
`version_atleast` out of ifdefs.
|
|
1518bc83
|
2025-06-03T12:38:38
|
|
* src/autofit/ft-hb.c: Fix definition of `_GNU_SOURCE`.
Commit 43ec023e1a730f defined the macro too late.
|
|
43ec023e
|
2025-06-03T07:56:13
|
|
* src/autofit/ft-hb.c: Fix usage of `RTLD_DEFAULT`.
Using `RTLD_DEFAULT` we see whether the process already has HarfBuzz linked
in, and reuse it. If this symbol is not defined it is tempting to use
`RTLD_GLOBAL` instead, which would make the library available to the whole
process. However, without `RTLD_DEFAULT`, we would risk loading a second
HarfBuzz library, and if the linker mixes them up, probably giving symbols
from the new library to other clients, we might get into trouble. For this
reason, we do not pass `RTLD_GLOBAL` to `dlopen`; the default is
`RTLD_LOCAL`, and the rest of the process won't see the loaded HarfBuzz and
hopefully all be happy.
|
|
c6abd1e4
|
2025-05-26T20:24:55
|
|
[autofit] Fix integer overflow.
Reported as
https://issues.oss-fuzz.com/issues/420401635
* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
af_latin_stretch_bottom_tilde): Use `SUB_LONG`.
|
|
57a87304
|
2025-05-26T06:28:09
|
|
[autofit] Make the accent database work for more glyphs (again).
See the added comment for an explanation.
This partially undoes commit f68733d4a8.
* src/autofit/afadjust.c (af_reverse_character_map_new): Always loop over all
elements of the adjustment database.
(in_range): Removed, no longer needed.
|
|
541ad3d3
|
2025-05-18T19:09:19
|
|
[autofit] Whitespace.
|
|
72e0c071
|
2025-05-16T14:35:51
|
|
[autofit] Use `FT_Offset`.
* src/autofit/afadjust.c (af_adjustment_database_lookup,
af_reverse_character_map_new): Do it.
|
|
47e35a58
|
2025-05-16T08:08:53
|
|
[autofit] Simplify return value of `af_adjustment_database_lookup`.
* src/autofit/adfadjust.h (af_adjustment_database_lookup): Return integer.
(AF_AdjustmentDatabaseEntry): Move structure to...
* src/autofit/afadjust.c: ...this file.
(af_adjustment_database_lookup, af_reverse_character_map_new): Updated.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Updated.
|
|
94e93c7c
|
2025-05-16T07:46:43
|
|
[autofit] Remove no longer used functions and structures.
This is the clean-up from the previous commit.
* src/autofit/afadjust.c (af_reverse_character_map_entry_compare,
af_reverse_character_map_lookup, af_reverse_character_map_expand):
Removed.
* src/autofit/afadjust.h: Updated.
* src/autofit/aftypes.h (AF_ReverseMapEntry, AF_ReverseCharacterMap):
Removed.
|
|
2492b547
|
2025-05-16T07:39:06
|
|
[autofit] Use a hash for handling vertical accent adjustments.
This greatly simplifies the code.
* src/autofit/afadjust.c (af_reverse_character_map_new): Implement it.
(af_reverse_character_map_done): Updated.
* src/autofit/afadjust.h: Updated.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Updated.
* src/autofit/aftypes.h: Include `fthash.h`.
(AF_StyleMetrics): Change type of `reverse_charmap` to `FT_Hash`.
|
|
70154166
|
2025-05-16T07:20:57
|
|
* src/autofit/aflatin.c (af_latin_hints_apply): Improve code legibility.
|
|
9dc66cbd
|
2025-05-20T05:36:49
|
|
[autofit] Use `FT_LONG_MIN` and `FT_LONG_MAX` for `FT_Pos` variables.
* src/autofit/aflatin.c (af_latin_metrics_init_blues,
af_compute_vertical_extrema, af_find_highest_contour,
af_find_second_highest_contour, af_find_lowest_contour,
af_find_second_lowest_contour, af_check_contour_horizontal_overlap):
Updated.
|
|
d6e087d1
|
2025-05-19T16:13:06
|
|
[autofit] Fix uninitialized variables.
* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
af_latin_stretch_bottom_tilde): Initialize `min_measurement`.
|
|
ed0ab879
|
2025-05-21T07:56:08
|
|
[autofit] Minor code cleanup.
* src/autofit/afadjust.c (af_reverse_character_map_new): Rename `result_set`
to `glyph_alternates` and move its clearing to...
(af_get_glyph_alternates): ...this function.
(af_get_glyph_alternates_helper): s/result/helper_result/.
|
|
a312820c
|
2025-05-21T07:17:11
|
|
[autofit] Speed up construction of reverse character map. (4/4)
* src/autofit/afadjust.c (af_get_glyph_alternates): Move creation and
deletion of the `helper_result` set to...
(af_reverse_character_map_new): ...this function.
Gain for `arial.ttf` version 7.00: approx. 1%.
|
|
c0e7df61
|
2025-05-20T18:59:00
|
|
[autofit] Speed up construction of reverse character map. (3/4)
* src/autofit/afadjust.c (af_reverse_character_map_new): Fold two loops into
one.
Gain for `arial.ttf` version 7.00: approx. 1%.
|
|
3dd7fc42
|
2025-05-19T05:37:23
|
|
[autofit] Speed up construction of reverse character map. (2/4)
This commit, together with the previous one, makes the startup of the
auto-hinter much faster.
Note, though, that the startup time for handling the diacritic database is
still rather large. For example, loading `arial.ttf` version 7.00 followed
by auto-hinting a first Latin glyph is still approx. three times slower
than before the introduction of the database (this is because function
`hb_ot_layout_lookup_get_glyph_alternates` is called very often).
* src/autofit/afshaper.c (scripts): Rename this array to...
(af_hb_scripts): ...this and export it.
(af_shaper_get_coverage_hb): Updated.
* src/autofit/afshaper.h: Updated.
* src/autofit/afadjust.c (af_reverse_character_map_new): Pass the current
script to `hb_ot_layout_collect_lookups` to make HarfBuzz check less
lookups while searching for glyph alternates.
|
|
f68733d4
|
2025-05-19T05:23:29
|
|
[autofit] Speed up construction of reverse character map. (1/4)
Build reverse cmap for characters of the current script style only.
* src/autofit/afadjust.c (in_range): New function.
(af_reverse_character_map_new): Pass `AF_StyleMetrics` instead of
`AF_FaceGlobals` so that we can access the current script style.
Use `in_range` to limit tested code points.
* src/autofit/afadjust.h: Updated.
* src/autofit/aflatin.c (af_latin_metrics_init): Updated.
|
|
4514f051
|
2025-05-18T08:08:25
|
|
[autofit] Avoid variable shadowing.
* src/autofit/afadjust.c (af_reverse_character_map_new): Do it.
|
|
fd33c037
|
2025-05-18T08:00:54
|
|
[autofit] Minor speedup of reverse charmap creation.
* src/autofit/afglobal.h (AF_HAS_CMAP_ENTRY): New flag.
(AF_STYLE_MASK): Update value.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Set
`AF_HAS_CMAP_ENTRY`.
* src/autofit/afadjust.c (af_reverse_character_map_new): For the creation of
the reverse map, change code to handle glyphs with cmap entries before
glyphs without cmap entries. Doing so avoids some code redundancy and
reduces the number of hash lookups.
|
|
b87f48a7
|
2025-05-19T15:48:24
|
|
* src/aflatin.c (af_latin_hint_edges): Refine fix for serif handling.
Commit 11432424 (from 2025-May-12) was too aggressive; it is now restricted
to edges that are not too far away.
|
|
46edeb32
|
2025-05-13T23:36:00
|
|
* src/afadjust.c (adjustment_database): Make it complete up to U+FFFF.
Also fix two entries.
This is for Unicode 17.0.
|
|
d3fbbed9
|
2025-05-13T14:44:20
|
|
[autofit] Fix vertical adjustment of (mainly) double diacritics.
The series of commits that introduced this adjustment support had some
flaws.
- If there were two diacritics on top of a base glyph, and the upper
diacritic was a tilde, the vertical centering correction was incorrectly
applied to the lower, non-tilde glyph instead of the tilde.
- The maximum value allowed to shift a glyph was too strict (and also not
handling rounding issues), causing some diacritics and combinations of
diacritics to be not shifted at all.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Correctly handle
vertical centering correction.
|
|
4c9f14f4
|
2025-05-12T18:04:14
|
|
[autofit] Code hygiene.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Use more flag
variables and improve trace messages.
|
|
11432424
|
2025-05-12T08:52:19
|
|
* src/autofit/aflatin.c (af_latin_hint_edges): Fix handling of serifs.
This has been discovered while inspecting the auto-hinting results of
character 'Ễ' in font `arial.ttf` (version 7.00) at 13ppem.
|
|
87f0b694
|
2025-05-12T14:02:31
|
|
[autofit] Minor.
* src/autofit/aflatin.c (af_latin_hint_edges): Rename `has_serifs` to
`has_non_stem_edges` and make it of type `FT_Bool`.
|
|
fd66a29d
|
2025-05-12T08:28:55
|
|
[autofit] New algorithm for preventing hinting of tilde glyphs.
The old algorithm removed segments from edges to make the auto-hinter ignore
a tilde. However, the implementation had two flaws.
- Edge array elements were moved around without reordering them afterwards.
- The linking between edges and segments wasn't correctly updated for moved
edges, which could cause endless loops.
Correcting both problems are non-trivial; additionally, a fix would make
the auto-hinter slower.
For these reasons, a new, simpler approach is taken: A new flag allows
points to be tagged as being ignored, and if such a point is enountered, it
doesn't get added to a segment.
Fixes issue #1333.
* src/autofit/afhints.h (AF_FLAG_IGNORE): New macro.
* src/autofit/aflatin.c (af_latin_hints_compute_segments, af_touch_contour):
Use it.
(af_remove_segments_containing_point, af_remove_top_points_from_edges,
af_remove_bottom_points_from_edges): Removed.
(af_latin_stretch_top_tilde): Call `af_touch_top_contours` and
`af_touch_bottom_contours` unconditionally.
(af_latin_hints_apply): Updated.
|
|
15b7e8c3
|
2025-05-14T10:20:04
|
|
Whitespace, formatting, minor spelling fix.
|
|
3e079bd7
|
2025-05-05T18:02:44
|
|
[autofit] Add safety check for accent adjustments.
This commit does two things.
- Ignore accents that have too large heights. This situation can happen if
an accent outline is unexpectedly not the highest (or lowest) contour.
- Add a new adjustment flag `AF_ADJUST_NO_HEIGHT_CHECK` to override the
height check.
* src/autofit/afadjust.h (AF_ADJUST_NO_HEIGHT_CHECK): New macro.
* src/autofit/afadjust.c (adjustment_database): Updated.
* src/autofit/aflatin.c (af_latin_hints_apply): Handle new flag.
(af_glyph_hints_apply_vertical_separation_adjustments): Check limit.
|
|
d32c637d
|
2025-05-04T07:50:30
|
|
[autofit] Better handling of characters with attached diacritics. (3/3)
Fixes issue #136.
* src/autofit/afadjust.c (adjustment_database): Updated.
|
|
620daa3c
|
2025-05-03T20:35:42
|
|
[autofit] Better handling of characters with attached diacritics. (2/3)
* src/autofit/afadjust.h (AF_IGNORE_CAPITAL_TOP, AF_IGNORE_CAPITAL_BOTTOM,
AF_IGNORE_SMALL_TOP, AF_IGNORE_SMALL_BOTTOM): New macros.
* src/autofit/afadjust.c (af_reverse_character_map_new)
[FT_DEBUG_LEVEL_TRACE]: Updated.
Also fix debugging strings of other flags.
* src/autofit/afhints.h (AF_EDGE_NO_BLUE): New edge flag to make the
auto-hinter ignore the edge while assigning blue zones.
* src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Use it.
(af_prevent_top_blue_alignment, af_prevent_bottom_blue_alignment,
af_latin_get_base_glyph_blues, af_latin_ignore_top,
af_latin_ignore_bottom): New functions.
(af_latin_hints_apply): Updated.
|
|
a37e11c3
|
2025-05-01T06:19:25
|
|
[autofit] Better handling of characters with attached diacritics. (1/3)
Introduce blue zone properties that will be used to make the auto-hinter
ignore diacritics attached on the top or the bottom of a base character.
* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM,
AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM): New properties.
* src/autofit/afblue.dat: Use them.
* src/autofit/afblue.c, src/autofit/afblue.h: Rengenerated.
* src/autofit/aflatin.h (AF_LATIN_IS_CAPITAL_BOTTOM_BLUE,
AF_LATIN_IS_SMALL_BOTTOM_BLUE, AF_LATIN_BLUE_BOTTOM,
AF_LATIN_BLUE_BOTTOM_SMALL): New macros.
* src/autofit/aflatin.c (af_latin_metrics_init_blues)[FT_DEBUG_LEVEL_TRACE]:
Updated.
|
|
ab0fe6d5
|
2025-05-05T19:38:04
|
|
[autofit] Avoid division by zero.
Fixes issue #1331.
* src/autofit/aflatin.c (af_latin_stretch_bottom_tilde): Don't divide by
zero.
|
|
97bb53ee
|
2025-04-28T07:24:41
|
|
[autofit] Enable dynamic loading of HarfBuzz. (2/2)
Handle the case where loading HarfBuzz dynamically fails.
* src/autofit/ft-hb.c, src/autofit/ft-hb.h (ft_hb_enabled): New function.
* src/autofit/afglobal.c (af_face_globals_new, af_face_globals_free):
Guard HarfBuzz functions with `ft_hb_enabled`.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits): Simplify
setup of `shaper_buf`.
Guard calls of `af_shaper_buf_create` with `ft_hb_enabled`.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Dito.
* src/autofit/afshaper.c: Guard all HarfBuzz function calls with
`ft_hb_enabled`.
|
|
7651fe00
|
2025-04-27T18:44:49
|
|
[autofit] Enable dynamic loading of HarfBuzz. (1/2)
This commit activates the mini-HarfBuzz header files and provides the
necessary infrastructure for dynamically loading HarfBuzz if
`FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC` is defined (this macro gets set up
in a follow-up commit).
* src/autofit/ft-hb.c: New file, providing `ft_hb_funcs_init` and
`ft_hb_funcs_done` for loading HarfBuzz dynamically. The name of the
library is hold in the macro `FT_LIBHARFBUZZ`, which can be overridden.
* src/autofit/ft-hb.h: Don't include `hb.h` but `ft-hb-types.h`.
(hb): Modified to handle both standard linking and dynamically
loading of HarfBuzz.
(HB_EXTERN): New macro to load `ft-hb-decls.h`.
* src/autofit/afadjust.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: For the sake of
dynamically loading the HarfBuzz library, replace the compile-time macro
`HB_VERSION_ATLEAST` with a call to the run-time function
`hb_version_atleast` where necessary – a follow-up commit will set the
minimum version of HarfBuzz to 2.6.8, which provides all necessary
functions needed by FreeType.
* src/autofit/afmodule.h: Include `ft-hb.h`.
(AF_ModuleRec) [FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC]: Add `hb_funcs`
structure to hold pointers to the dynamically loaded HarfBuzz functions.
* src/autofit/afmodule.c (af_autofitter_init, af_autofitter_done)
[FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC]: Call `ft_hb_funcs_init` and
`ft_hb_funcs_done`.
* src/autofit/afshaper.h: Updated.
* src/autofit/autofit.c: Include `ft-hb.c`.
* src/autofit/rules.mk (AUTOF_DRV_SRC, AUTOF_DRV_H): Updated.
|
|
b512ce3e
|
2025-04-26T22:31:22
|
|
[autofit] Some preparations for loading HarfBuzz dynamically. (4/4)
Add 'mini' HarfBuzz declarations to make FreeType independent on HarfBuzz
header files.
The files get activated in a follow-up commit.
* src/autofit/ft-hb-decls.h, src/autofit/ft-hb-types.h: New files, holding
verbatim (or slightly massaged) entries from public HarfBuzz header files.
* src/autofit/hb-script: New file.
A verbatim copy of a public HarfBuzz header file.
|
|
9242c88f
|
2025-04-26T21:46:51
|
|
[autofit] Some preparations for loading HarfBuzz dynamically. (3/4)
* src/autofit/afshaper.c: Move around code so that the non-HarfBuzz code is
present even if `FT_CONFIG_OPTION_USE_HARFBUZZ` is not defined. This is a
preliminary step to allow deactivation of HarfBuzz at run-time.
|
|
e9d03072
|
2025-04-26T19:05:31
|
|
[autofit] Some preparations for loading HarfBuzz dynamically. (2/4)
Pass `AF_FaceGlobals` to many functions, or provide it, tagged with
`FT_UNUSED`. We need this later on to access a dynamically linked HarfBuzz
library.
* src/autofit/ft-hb-ft.h (ft_hb_ft_font_create): Use `globals` argument.
Drop unused `destroy` argument.
* src/autofit/ft-hb-ft.c (ft_hb_ft_face_create, ft_hb_ft_font_create): Use
`globals` argument.
Drop unused `destroy` argument.
(ft_hb_ft_face_create, ft_hb_ft_reference_table): Cast `user_data` to
`AF_FaceGlobals`.
* src/autofit/afadjust.c (af_get_glyph_alternates_helper,
af_get_glyph_alternates): Add `globals` argument.
Update callers.
* src/autofit/afshaper.c, src/autofit/afshaper.h (af_shaper_buf_create,
af_shaper_buf_destroy): Use `globals` argument.
* src/autofit/afglobal.c (af_face_globals_new): Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits): Updated.
|
|
8b443d70
|
2025-04-26T12:22:23
|
|
[autofit] Some preparations for loading HarfBuzz dynamically. (1/4)
* src/autofit/ft-hb.h: New file, defining the `hb` macro. Later on, we
provide a different definition of this macro depending on a yet-to-come
configuration option to support dynamic loading of HarfBuzz functions.
* src/autofit/afadjust.c, src/autofit/afglobal.c, src/autofit/afshaper.c,
stc/ft-hb-ft.c: Use it.
|
|
3eb4eade
|
2025-04-12T00:44:46
|
|
[autofit] Rename 'ft-hb' to 'ft-hb-ft'.
Since it's a (shrinked) copy of 'hb-ft'.
* src/autofit/afglobal.c (af_face_globals_new), src/autofit/afshaper.h,
src/autofit/autofit.c: Updated.
* src/autofit/ft-hb.c, src/autofit/ft-hb.h: Renamed to...
* src/autofit/ft-hb-ft.c, src/autofit/ft-hb-ft.h: ...this; updated.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Updated.
|
|
f35bb759
|
2025-04-29T21:14:21
|
|
* src/autofit/aflatin.c (af_latin_stretch_top_tilde): Don't divide by zero.
Reported as
https://issues.oss-fuzz.com/issues/414320186
|
|
2d1abd3b
|
2025-04-25T18:05:41
|
|
[autofit] Extend adjustment database with characters up to U+1FFF.
This adds many pre-combined Latin glyphs, Cyrillic, Greek, and some
characters from other scripts (or rather, Unicode blocks).
Fixes issues #112 and #471.
|
|
d38a13dd
|
2025-04-25T17:58:56
|
|
[autofit] Support diacritics with special vertical minima.
This code catches situations like U+1F90 ('ᾐ'), where some fonts have
exactly the same vertical minimum for the lower accent as for the base
glyph.
* src/autofit/aflatin.c (af_find_highest_contour, af_find_lowest_contour):
Handle it.
|
|
9eb6548d
|
2025-04-25T12:28:18
|
|
[autofit] More tilde stretch support. (3/3)
The auto-hinter now supports up to four tilde glyphs (two above and two
below a base character).
Note that diacritics above (or below) a tilde are now also ignored by the
auto-hinter.
* src/autofit/afadjust.h (AF_ADJUST_TILDE_TOP2, AF_ADJUST_TILDE_BOTTOM2):
New macros.
* src/autofit/afadjust.c (af_reverse_character_map_new): Updated.
* src/autofit/aflatin.c (af_remove_top_points_from_edges,
af_remove_bottom_points_from_edges): Make functions also handle all
contours higher (or lower) of the given one in the argument.
(af_touch_top_contours, af_touch_bottom_contours): New functions.
(af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde): Use it to
also handle all contours higher (or lower) than the tilde contour.
* (af_latin_hints_apply): Handle more tilde glyphs.
|
|
c6b45a76
|
2025-04-25T12:26:45
|
|
[autofit] More tilde stretch support. (2/3)
* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
af_latin_stretch_bottom_tilde): Return vertical size difference between
stretched and original contour.
(af_latin_align_top_tilde, af_latin_align_bottom_tilde): Return applied
delta.
(af_latin_hints_apply): Updated; the return values are not used yet.
|
|
cbce230d
|
2025-04-24T08:13:54
|
|
[autofit] More tilde stretch support. (1/3)
Move some existing code that we soon need elsewhere into separate functions.
* src/autofit/aflatin.c (af_move_contours_up, af_move_contours, down): New
functions.
(af_glyph_hints_apply_vertical_separation_adjustments): Use them.
(af_touch_contour): New function.
(af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde): Use it.
(af_latin_remove_top_tilde_points_from_edges,
af_latin_remove_bottom_tilde_points_from_edges): Renamed to...
(af_remove_top_points_from_edges, af_remove_bottom_points_from_edges):
...this.
Update callers.
|
|
7722a5b2
|
2025-04-23T19:29:59
|
|
[autofit] Support two below/above accents for vertical adjustment. (2/2)
* src/autofit/afadjust.h (AF_ADJUST_UP2, AF_ADJUST_DOWN2): New macros.
* src/autofit/afadjust.c (af_reverse_character_map_new): Updated.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Implement it.
|
|
40d4b579
|
2025-04-23T19:13:45
|
|
[autofit] Support two below/above accents for vertical adjustment. (1/2)
Some variable renamings.
|
|
619305c4
|
2025-04-23T17:35:21
|
|
[autofit] Routines for finding the second highest/lowest contour.
* src/autofit/aflatin.c (af_find_second_highest_contour,
af_find_second_lowest_contour): New functions.
|
|
7a2646e6
|
2025-04-23T06:47:33
|
|
[autofit] Use more functions to reduce code.
* src/autofit/aflatin.c (af_find_highest_contour, af_find_lowest_contour):
Updated.
(af_glyph_hints_apply_vertical_separation_adjustments): Use
`af_compute_vertical_extrema`, `af_find_highest_contour`, and
`af_find_lowest_contour`.
(af_latin_hints_apply): Use `af_compute_vertical_extrema`,
|
|
387c2d80
|
2025-04-23T06:44:10
|
|
* src/autofit/aflatin.c (af_compute_vertical_extrema): New function.
To be used in a follow-up commit.
|
|
357032d1
|
2025-04-22T19:48:16
|
|
* src/autofit/aflatin.c: Some variable renaming.
|
|
25369eca
|
2025-04-22T18:24:25
|
|
[autofit] Avoid recomputation of highest and lowest contour.
* src/autofit/aflatin.c (af_latin_hints_apply): Compute highest and lowest
contour in this function.
(af_latin_remove_top_tilde_points_from_edges,
af_latin_remove_bottom_tilde_points_from_edges,
af_latin_stretch_top_tilde, af_latin_stretch_bottom_tilde,
af_latin_align_top_tilde, af_latin_align_bottom_tilde): Updated.
|
|
64da9d47
|
2025-04-22T18:10:26
|
|
* src/aflatin.c (af_latin_trace_height): Remove.
Update caller.
The algorithm works fine.
|
|
ba94c954
|
2025-04-22T12:43:55
|
|
[autofit] Support vertical stretching of tilde below base glyph. (2/2)
* src/autofit/afadjust.h (AF_ADJUST_TILDE_BOTTOM): New macro.
* src/autofit/afadjust.c (af_reverse_character_map_new): Updated.
* src/autofit/aflatin.c (af_find_lowest_contour,
af_latin_remove_bottom_tilde_points_from_edges,
af_latin_stretch_bottom_tilde, af_latin_align_bottom_tilde): New functions
in analogy to the top tilde versions.
(af_glyph_hints_apply_vertical_separation_adjustments): Add support in
analogy to the top tilde code.
(af_latin_hints_apply): Updated.
|
|
ec28f488
|
2025-04-21T13:38:17
|
|
[autofit] Support vertical stretching of tilde below base glyph. (1/2)
* src/autofit/aflatin.c (af_latin_remove_tilde_points_from_edges,
af_latin_stretch_tilde, af_latin_align_tilde): Rename to...
(af_latin_remove_top_tilde_points_from_edges, af_latin_stretch_top_tilde,
af_latin_align_top_tilde): ...this.
Update all callers.
(af_latin_hints_apply): Rename `is_tilde` to `is_top_tilde`.
|
|
8d1f5156
|
2025-04-21T09:55:44
|
|
[autofit] Allow vertical adjustment at the top and bottom simultaneously.
This will be used to hint characters like U+1FB7 ('ᾷ').
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Implement it.
|
|
5e0b0871
|
2025-04-21T07:52:42
|
|
* src/autofit/afadjust.c (af_reverse_character_map_new): Update tracing.
|
|
162a93b1
|
2025-04-21T07:00:07
|
|
[autofit] Indicate tilde handling with a flag macro, too.
* src/autofit/afadjust.h (AF_ADJUST_TILDE_TOP): New macro.
(AF_AdjustmentDatabaseEntry): Remove field `apply_tilde`.
* src/autofit/afadjust.c (adjustment_database,
af_reverse_character_map_new), src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments,
af_latin_hints_apply): Updated.
|
|
582cc21b
|
2025-04-21T06:37:45
|
|
[aflatin] Convert adjustment database enum to macros.
We are going to add more values, and we want to use combinations of them.
* src/autofit/afadjust.h (AF_VerticalSeparationAdjustmentType): Replace
with...
(AF_ADJUST_UP, AF_ADJUST_DOWN, AF_ADJUST_NONE): ... new macros.
(AF_AdjustmentDatabaseEntry): Rename field
`vertical_separation_adjustment_type` to `flags`.
* src/autofit/afadjust.c (af_reverse_character_map_new),
src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Updated.
|
|
566e30c1
|
2025-04-21T05:47:41
|
|
[autofit] Shorten adjustment enum names.
* src/autofit/afadjust.h (AF_VERTICAL_ADJUSTMENT_TOP_CONTOUR_UP,
AF_VERTICAL_ADJUSTMENT_BOTTOM_CONTOUR_DOWN, AF_VERTICAL_ADJUSTMENT_NONE):
Renamed to...
(AF_ADJUST_UP, AF_ADJUST_DOWN, AF_ADJUST_NONE): ...this.
* src/autofit/afadjust.c (adjustment_database,
af_reverse_character_map_expand), src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Updated.
|
|
1da283b8
|
2025-04-26T09:54:16
|
|
* src/autofit/afranges.c: Updated to Unicode 17.0.
But no support for new scripts (volunteers welcomed).
|
|
3ce99005
|
2025-04-26T09:42:44
|
|
* src/autofit/afranges.c: Updated to Unicode 16.0.
But no support for new scripts (volunteers welcomed).
|
|
08a13fe2
|
2025-04-26T08:31:17
|
|
* src/autofit/afranges.c: Updated to Unicode 15.1.
But no support for new scripts (volunteers welcomed).
|
|
3019fa6c
|
2025-04-26T08:09:15
|
|
* src/autofit/afranges.c: Updated to Unicode 14.0.
But no support for new scripts (volunteers welcomed).
|
|
373aa744
|
2025-04-26T07:39:27
|
|
* src/autofit/afranges.c: Updated to Unicode 13.0.
But no support for new scripts (volunteers welcomed).
|
|
12a9f65d
|
2025-04-26T07:26:34
|
|
* src/autofit/afranges.c: Updated to Unicode 12.0.
But no support for new scripts (volunteers welcomed).
|
|
1019b1c2
|
2025-04-22T06:20:22
|
|
* src/autofit/afadjust.c (af_get_glyph_alternates): Fix endless loop.
|
|
b5b3fd57
|
2025-04-20T10:48:54
|
|
* src/afadjust.c: Fix test for newer HarfBuzz version (second try).
|
|
05f3cf13
|
2025-04-20T10:29:32
|
|
* src/afadjust.c: Fix test for newer HarfBuzz version.
|
|
a64b49cc
|
2025-04-20T08:00:26
|
|
[autofit] Request at least HarfBuzz 7.2.0 for diacritic support. (3/3)
This version (from April 2023) added 'SingleSubst' support to
`hb_ot_layout_lookup_get_glyph_alternates`.
|
|
de98b1ba
|
2025-04-20T07:32:05
|
|
[autofit] Speed up creation of the adjustment database's reverse map. (2/3)
Remove the old code and activate the new one.
|
|
573201be
|
2025-04-20T06:27:52
|
|
[autofit] Speed up creation of the adjustment database's reverse map. (1/3)
As it turns out, the original implementation using
`hb_ot_shape_glyphs_closure` is extremely slow if a font has a rich set of
OpenType features. For example, this function was called 66954 times while
loading font `arial.ttf` version 7.00, increasing FreeType's startup time by
a factor of 10, which is unacceptable.
The new algorithm uses a completely different, more low-level approach, no
longer working with OpenType features but with OpenType lookups. It relies
on function `hb_ot_layout_lookup_get_glyph_alternates`, also replacing
recursion with a simple loop. In total, this brings the additional startup
time back to an acceptable range of a few percent.
A side effect of the new approach is that it catches more alternate forms:
the old code didn't properly handle script-specific features.
To make the change more readable, this commit only adds new code.
|
|
9536e472
|
2025-04-18T06:31:51
|
|
* src/autofit/afadjust.c (af_reverse_character_map_new): Check `map` limit.
Reported as
https://issues.chromium.org/issues/410925355
|
|
d6c29228
|
2025-04-17T19:36:51
|
|
[autofit] Don't access uninitialized memory.
Reported as
https://bugs.ghostscript.com/show_bug.cgi?id=708295
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments): Initialize all
array elements of `contour_y_minima` and `contour_y_maxima`.
|
|
cc849c32
|
2025-04-16T19:39:02
|
|
[autofit] Avoid crash.
Reported as
https://issues.oss-fuzz.com/issues/410811029
* src/autofit/aflatin.c (af_remove_segments_containing_point): Check
`edge->last`.
|
|
dc55f4e6
|
2025-04-14T21:03:08
|
|
[autofit] Avoid unnecessary recomputation of HarfBuzz data.
Call the functions once per font instead of once per glyph.
* src/autofit/afadjust.c (af_all_glyph_variants): Move code to compute the
`feature_tags` and `type_3_lookup_indices` sets to...
(af_reverse_character_map_new): ...this function.
|
|
d1ac9524
|
2025-04-14T15:48:33
|
|
[autofit] Fix creation of the adjustment database's reverse map.
Due to the way the reverse map array gets constructed with HarfBuzz, there
might be multiple, identical glyph index entries with different character
values in the array. As an example, an OpenType feature like 'unic' might
map lowercase glyph 'ae' to uppercase glyph 'AE', in addition to the already
present cmap entry for 'AE'.
In most cases, this incorrect mapping is harmless (but still wrong).
However, there exist some lowercase/uppercase character pairs where the
diacritic for the uppercase character is on the other vertical side of the
base character as for the lowercase character. An example is U+0122 (LATIN
CAPITAL LETTER G WITH CEDILLA) and U+0123 (LATIN SMALL LETTER G WITH
CEDILLA): the former has the cedilla below, the latter above. A wrong
mapping would thus shift the base glyph 'G' up by a pixel instead of
shifting the cedilla down.
We fix this by always giving precedence to cmap entries.
* src/autofit/afadjust.c (af_reverse_character_map_entry_compare): Do a
secondary sort on the character code.
(af_reverse_character_map_lookup): Adjust binary search to return the
first occurrence of an entry (i.e., the one with the lowest array index).
(af_reverse_character_map_new)[FT_CONFIG_OPTION_USE_HARFBUZZ]: Implement
cmap priority.
|
|
05797069
|
2025-04-14T09:22:10
|
|
[autofit] Reduce adjustment database lookups.
This is also in preparation for a follow-up commit.
* src/autofit/afadjust.h (af_lookup_vertical_separation_type,
af_lookup_tilde_correction_type): Replaced with...
(af_adjustment_database_lookup, af_reverse_character_map_lookup):
... this.
* src/autofit/afadjust.c (af_adjustment_database_lookup,
af_adjustment_database_lookup): Updated.
(af_lookup_vertical_separation_type, af_lookup_tilde_correction_type):
Removed.
(af_reverse_character_map_new)[FT_DEBUG_LEVEL_TRACE]: Updated.
* src/autofit/aflatin.c
(af_glyph_hints_apply_vertical_separation_adjustments,
af_latin_hints_apply): Updated.
|
|
233cdea8
|
2025-04-12T10:32:44
|
|
* src/afadjust.c (adjustment_database): Make it complete up to U+017F.
|
|
535498a0
|
2025-04-13T22:11:39
|
|
* src/autofit/afadjust.c (af_reverse_character_map_new): Add tracing code.
|