Commit Graph
17 Commits
Author SHA1 Message Date
Behdad Esfahbod 3c4d303c70 [subset] Bound default UVS ranges to 256 codepoints (#6317)
The dense DefaultUVS copy path merged adjacent source ranges without
respecting additionalCount's 8-bit limit.  Subsetting 257 consecutive
default UVS mappings could leave only one mapping after count truncation.

Start a new range before the additional count overflows.  Exercise cmap
formats 14 and 15 at 1, 255, 256, 257, 512, 513, and 768 mappings, checking
both the retained mapping count and the last variation glyph.

Built with C++11 and ran the complete Meson suite: 279 passed.

Assisted-by: OpenAI Codex
2026-10-02 21:33:22 -06:00
Behdad Esfahbod 58a90bf833 [cmap] Support DMAP
Consult DMAP before cmap for nominal and variation mappings, and combine
their character coverage while retaining DMAP precedence. Reuse the cmap
parser and serializer for DMAP, including effective subsetting closure.

Keep DMAP available independently of beyond-64K support; only cmap format
15 remains conditional.

Tested with the full Meson suite and with an HB_NO_BEYOND_64K build.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 16:27:20 -06:00
Behdad Esfahbod ebc4034483 [cmap] Support format 15
Template the variation-selector structures by glyph-ID width.

Add format 15 lookup, collection, sanitization, and closure.

Add format 15 subsetting.

Prefer format 15 when both variation-selector formats are present.

Assisted-by: OpenAI Codex
2026-06-05 12:34:52 +02:00
Garret Rieger b0d52abe97 [subset] consider variation selectors subsetting cmap14
cmap14 subsetting code was not considering variation selectors in the input unicode set when deciding which variant glyphs to keep. This updates subsetting to only keeps variant glyphs if their variation selector code point is in the input unicodes set.

For https://github.com/harfbuzz/harfbuzz/issues/4911
2024-11-11 13:45:08 -07:00
Qunxin Liu b2a965df5e [subset] Add support for "--gids" option
cmap subsetting now retains entries associated with any glyph ids explicitly requested
2020-05-11 15:28:58 -07:00
Qunxin Liu e53c44e326 [subset] temporarily revert previous cmap commit
Required in https://github.com/harfbuzz/harfbuzz/issues/2356
2020-04-25 12:21:22 +04:30
ckitagawa-work 774725b43a [subset] Avoid incorrectly dropping cmap for NotoColorEmoji.ttf
NotoColorEmoji.ttf uses two cmap subtables

 Format 14 | Platform ID 0 | Platform Encoding ID  5
 Format 12 | Platform ID 3 | Platform Encoding ID 10

This combination results in the cmap table being dropped during subsetting despite being valid/required.
2020-02-05 16:13:10 +03:30
Qunxin Liu c370da45ff [subset] Cmap table: remove encodingRecord entry for empty cmap4 subtable 2020-01-23 17:23:55 -08:00
Qunxin Liu 1db2c1d0da fix for cmap4 and OS_2 subsetting: maximum character code allowed is 0xFFFF 2020-01-09 10:00:32 -08:00
Ebrahim Byagowi c110878cb6 [test] Unify font file opening across the tests 2018-10-21 11:27:05 +03:30
Garret Rieger a8e7f9b958 [subset] Get cmap tests passing again. 2018-05-04 11:20:03 -07:00
Garret Rieger c817992f49 [subset] Write out a format 4, plat 0 encoding record to match fontTools. 2018-05-04 11:20:03 -07:00
Garret Rieger e29c8e33f3 [subset] Add a test for previous cmap breakage. 2018-04-19 12:51:51 -06:00
Chun-wei Fan 831d4a2dab test/api: Fix building subset tests
Include stdbool.h in hb-setset-test.h instead of in the individual
sources, if it is found; otherwise use a simplistic fallback for it if
it is not found.

Also declare variables at the top of the block, to build on pre-C99
compiliers.
2018-03-13 20:17:58 +08:00
Rod Sheeter 4f07437dfe [subset] sketch out dropping in-glyf instructions. Sometimes yields differnet size glyphs than fonttools, possibly due to padding not being corrected 2018-02-21 22:23:05 -08:00
Garret Rieger 8cf8b78faa [subset] whitespace 2018-02-12 16:30:21 -08:00
Rod Sheeter 89ee20f1a3 basic wiring for a (failing) cmap test 2018-02-12 16:01:15 -08:00