Commit Graph
292 Commits
Author SHA1 Message Date
Behdad Esfahbod 346b8dcf93 Wrap formats in struct
Part of https://github.com/harfbuzz/harfbuzz/issues/5601

This was done automatically using codex, the ChatGPT coding
agent.
2025-11-11 12:29:06 -07:00
Behdad Esfahbod 2bcce37ffd [Coverage] Wrap format in a struct
Part of https://github.com/harfbuzz/harfbuzz/issues/5601
2025-11-11 02:24:50 -07:00
Behdad Esfahbod 844f2fea06 [GPOS] Handle attach_chain() overflow (#5636)
Fixes https://oss-fuzz.com/testcase-detail/5461871294742528
2025-11-03 20:28:54 -07:00
Garret Rieger 07ee609f5a Fix invalid pointer conversions in graph Coverage. (#5622)
For #5604.
2025-10-20 20:06:43 -06:00
Behdad Esfahbod 4a26e289f7 Add hb_ot_layout_lookup_collect_glyph_alternates() (#5367)
* [map] Massage operator << overloads

* [ot-layout] Add +hb_ot_layout_lookup_collect_glyph_alternates

To collect all glyph mapping from SingleSubst or AlternateSubst
lookups in one call.  Needed by FreeType autohinter for performance.

New API:
+hb_ot_layout_lookup_collect_glyph_alternates()

* [layout] Change hb_ot_layout_lookup_collect_glyph_alternates() API

https://github.com/harfbuzz/harfbuzz/pull/5367#discussion_r2149019638
2025-09-30 13:31:04 -06:00
Behdad Esfahbod af286b8f71 [Coverage] Simplify initialization 2025-09-30 13:00:36 -06:00
Behdad Esfahbod fc7617251a [ValueFormat] comment 2025-09-24 12:42:53 -06:00
Behdad Esfahbod d350cb833a Speed up ValueFormat len() calc 2025-09-23 20:34:13 -06:00
Behdad Esfahbod a89c36e0d9 [GPOS/kerx] Support attaching marks to bases after them (#5520)
See comments. Fuzzer found. I'm surprised this was not discovered
before though. I hope I have not missed anything.

Fixes https://oss-fuzz.com/testcase-detail/6399443634290688
2025-09-02 13:05:11 -06:00
Behdad Esfahbod c61a4f26a0 [GPOS] Micro-optimize offset propagation 2025-08-29 02:11:52 -06:00
Behdad Esfahbod bc6eba9407 Fix kerx attachment shaping issues (#5515)
* [ot-shape] Don't zero offsets of default-ignorables

Part of fixing https://github.com/harfbuzz/harfbuzz/issues/5514

* [ot-shape] Propagate chain offsets in opposite direction if RTL

Part of fixing https://github.com/harfbuzz/harfbuzz/issues/5514
2025-08-27 13:29:15 -06:00
Behdad Esfahbod 6b62d3678b [ligature-cache] Handle case of ligature with no components (#5500)
In the cache with "seconds" set-digest.
2025-08-25 14:02:59 -06:00
Behdad Esfahbod 8bdedb3b9e Limit external caches (#5483)
* Revert "[external_cache] Remove a conditional (#5471)"

This reverts commit 9794ad9e00.

* Limit external_cache to 8 subtables per lookup
2025-08-20 00:27:41 -06:00
Behdad Esfahbod 2254574384 Match positions no malloc (#5481)
* Reduce allocation of match_positions by caching one in ctx

* Use a stack-array for small match-positions

This surgically enables stack-backed storage in vector.

* Handle match-positions alloc failure

And make allocations unchecked.

* Clean up CFF hack to use static storage in vector

* Fixup for match_positions allocations

* Fix vector handling of foreign arrays memory management
2025-08-20 00:06:00 -06:00
Behdad Esfahbod 9794ad9e00 [external_cache] Remove a conditional (#5471) 2025-08-16 15:51:05 -06:00
Behdad Esfahbod 368598b5bd Increase match_positions stack allocation from 4 to 8 (#5468)
Slight speedup on NotoNastaliq.
2025-08-16 00:38:42 -06:00
Behdad Esfahbod dae2c8bbbd [ligature] Add a set-digest on the second component (#5464) 2025-08-14 22:26:40 -06:00
Behdad Esfahbod 8268473a02 Add external_cache_create separate from cache_func (#5463)
* Add external_cache_create separate from cache_func

* Simplify cache_func_t signature

* Rename a cache type

* Rename another cache type
2025-08-14 21:57:19 -06:00
Behdad Esfahbod cf614fc85d [LigatureSet] Use slow path only if <= 1 ligatures (#5462) 2025-08-14 16:23:45 -06:00
Behdad Esfahbod 4aa7dcba0e [Coverage cache] Micro-optimize 2025-08-12 03:18:38 -06:00
Behdad Esfahbod a4dbb7d459 [Coverage] Cache NOT_COVERED effectively (#5453)
Before, our cache.set was always failing for NOT_COVERED,
making the cache ineffective for uncovered glyphs. Fix that.

Some nice speedups in Latin fonts.
2025-08-12 02:34:49 -06:00
Behdad Esfahbod 6ec1b2790c [lookup] Give each subtable an external-cache opportunity (#5449)
* [lookup] Give each subtable an external-cache opportunity

* [subtable-cache] Fixups
2025-08-11 01:14:19 -06:00
Qunxin Liu cd49b14b4f [subset] add more aggressive pruning for MarkLigPos and MarkMarkPos (#5434)
Remove lig/mark glyphs without defined anchor points after subsetting
2025-07-29 15:32:26 -06:00
Behdad Esfahbod 11daf566a3 [GDEF] Rename a var 2025-07-26 06:35:20 -06:00
Behdad Esfahbod 7b56d3a1e5 [ot-layout] s/hb_ot_lookup_cache_t/hb_ot_layout_mapping_cache_t/g 2025-07-26 06:29:10 -06:00
Behdad Esfahbod 09978fc510 [ot] Rename hb_ot_lookup_cache_op_t, and cache to subtable_cache 2025-07-26 06:29:10 -06:00
Behdad Esfahbod 786f8381bd [GDEF] Use bit-set instead of set-digest for mark glyph classes
Most fonts don't even have these. Some, like NotoSansDuployan
have huge ones. This speeds it up by 25%.
2025-07-25 04:00:37 -06:00
Qunxin Liu 879c4ac784 [subset] MarkBasePos: remove base glyphs with empty base record
BaseRecord could become empty if all anchor offsets for retained mark
classes are null
2025-07-24 14:25:54 -07:00
Behdad Esfahbod 3d154bc6b2 [buffer-message] Fix potential buffer overflow...
...when buffer messaging is enabled and with malicious font.

Fixes https://github.com/harfbuzz/harfbuzz/security/advisories/GHSA-p965-5rr7-9mhq
2025-07-14 13:54:49 -06:00
Qunxin Liu 5dbb814164 [subset] AnchorFormat3: better check for when should downgrade to format1 2025-07-14 10:54:43 -06:00
Behdad Esfahbod 6ed598e1c0 Merge pull request #5382 from harfbuzz/lig_split
[repacker] Implement table splitting for LigatureSubst
2025-07-10 13:03:44 -06:00
Qunxin Liu 95dc11092f [subset] bug fix
Don't downgrade to format1 when subsetting
2025-07-10 12:25:10 -06:00
Garret Rieger 38ab13c67e [repacker] add support for splitting GSUB Ligature lookups. 2025-07-04 23:37:24 +00:00
Behdad Esfahbod 47089fe7a3 Big misc changes
- Make geometry types into templates taking float or double.
- Changes to paint() transform elimination.
- Add font->has_nonzero_coords and use it across.
- Extensions to avar processing for otherwise invalid mappings.
2025-06-08 13:43:27 +03:00
Behdad Esfahbod c124252df5 [algs] Add support for little-endian int types
As well as 64bit-int, and float types.

Add Align type.
2025-06-08 13:43:27 +03:00
Behdad Esfahbod 89e28a2381 [skippy-iter] Use auto for type deduction 2025-05-10 16:30:35 -06:00
Behdad Esfahbod 5933468261 [shape] Only apply slant to shaping results if horizontal 2025-04-23 20:56:32 -06:00
Behdad Esfahbod 7f5fafec0d [GDEF] Simplify cache declaration 2025-04-01 21:35:28 -06:00
Qunxin Liu 5ebe36e1ac [subset] bug fix for CaretValueFormat3
Don't return false in case of a Hinting Device table
2025-03-27 15:12:42 -06:00
Qunxin Liu 192d264ae7 [subset] remove divisions when computing the cost of binary search 2025-03-25 15:37:14 -06:00
Behdad Esfahbod b8327fe605 Fix compiler errors 2025-02-06 20:01:12 +00:00
Behdad Esfahbod c737829449 [OT] Remove likely() from coverage check
Not that it matters, but because of the set-digest, this path
is not very likely() anymore.
2025-02-06 01:42:25 +00:00
Behdad Esfahbod cad264b2c9 Indent 2025-02-06 00:56:16 +00:00
Behdad Esfahbod 69057e6ec0 [Ligature] Cache coverage the same way as PairPos1
Another 7% down on Roboto-Regular.
2025-02-05 19:50:51 +00:00
Behdad Esfahbod 7a746c3295 [Coverage] Fix cache cost reporting 2025-02-05 19:38:25 +00:00
Behdad Esfahbod 5be62a9f66 [PairPosFormat1] Use a coverage cache as well
Speeds up Arial shaping by 3%.
2025-02-05 19:30:01 +00:00
Behdad Esfahbod f22943a2a2 [PairPos] Cache coverage as well
Another 3% down in Roboto-Regular.
2025-02-05 19:18:25 +00:00
Behdad Esfahbod 726af2e4e5 [PairPos] Use a class cache
10% speedup on Roboto-Regular. 5% on SF Pro.
2025-02-05 19:18:25 +00:00
Behdad Esfahbod 4877405211 [GDEF] Sprinkle some hb_barrier()s 2024-09-22 13:01:14 -06:00
Behdad Esfahbod 0dace9f341 [PairPos] Forgo an optimization for the sake of compatibility
Fixes https://github.com/harfbuzz/harfbuzz/issues/4797
2024-09-21 12:38:16 -06:00