Commit Graph
44 Commits
Author SHA1 Message Date
Behdad Esfahbod d89fa94461 [subset] Preserve distinct feature parameters and variations (#6350)
Matching lookup lists alone cannot establish that same-tag features are
duplicates. Different feature parameters carry distinct UI metadata, and
alternate features can have different behavior in each language system.

Compare complete supported parameter data before merging, and preserve
indices referenced by retained feature variations. Fully pinned fonts can
still merge features after resolving their alternates.

Add GSUB/GPOS regressions with differing cv01 character arrays, size
values, ss01 names, and ss02 alternatives, plus identical ss03 controls.
The full Meson suite passes, as do reduced-feature compilation checks.

Assisted-by: Codex
2026-10-10 17:07:29 -06:00
Behdad Esfahbod fd0c6c9a69 [subset] Preserve parameters and names in alternate features (#6349)
Alternate feature serialization lacks the source feature tag, so it
cannot identify and retain cvXX, ssXX, or size parameters. Name-ID
closure also visits only the original base feature, losing labels
referenced by retained alternates or fully instantiated substitutions.

Carry source tags for retained features after deduplication. Collect
name IDs from the current base feature, retained variation records,
and original features used by catch-all records.

Add ordinary, full, partial, and range regressions for all three
parameter formats in GSUB and GPOS. Ten of twelve regression subtests
fail before the fix. The complete Meson suite passes: 284 tests.
The changed layout units also compile with HB_NO_VAR.

Assisted-by: Codex
2026-10-10 04:12:54 -06:00
Behdad Esfahbod a2ccf95182 [subset] Preserve IFTB offsets when downgrading CFF2 (#6348)
Pass the requested minimum CharStrings offset size to the CFF1 INDEX
serializer, matching the CFF2 path. The conversion previously emitted
short offsets even with HB_SUBSET_FLAGS_IFTB_REQUIREMENTS enabled.

Add a Cantarell downgrade regression, registered with the existing
IFTB tests only when experimental API support is enabled. The original
subsetter fails it with and without preprocessing.

Full Meson suites pass with experimental API enabled (282 tests) and
disabled (263 tests, one skipped).

Assisted-by: Codex
2026-10-10 01:46:09 -06:00
Behdad Esfahbod 19f54f2cfd Merge pull request #5784 from harfbuzz/downgrade-cff-hintmask
[subset] Fix CFF2->CFF1 specializer hintmask encoding
2026-03-04 12:55:54 -07:00
Garret Rieger aa58b43de4 [subset] Introduce HB_SUBSET_FLAGS_RETAIN_NUM_GLYPHS. (#5547)
Used in conjunction with retain gids, when set the num glyphs from the input font will be preserved. Empty glyphs will be inserted as necessary to maintain the num glyphs value. Put under experimental for now.
2025-09-12 14:24:41 -06:00
Garret Rieger 4e76727183 Add a test checks we can recover from cmap4 overflow. 2025-05-15 10:05:18 -06:00
Garret Rieger efcb7d3de1 [subset] close unicodes over bidi mirror variants during subsetting.
Fixes #5281. Does the closure by default, but I've introduced a new flag and option to disable this behaviour since some users may want to get the minimal set if they know they don't need the mirrored variants.
2025-04-11 18:13:28 -06:00
Qunxin Liu 634778efc0 [subset] bug fix in post table
insert retain-gid holes when retain-gids is enabled
2024-08-21 12:06:02 -06:00
Qunxin Liu cfbb6a6872 [subset] support BASE table subsetting (#4618)
* [subset] support BASE table

* [subset] add tests for BASE table subsetting
2024-03-14 18:33:34 -06:00
Garret Rieger c6884377ec [subset] Add HB_SUBSET_FLAGS_IFTB_REQUIREMENTS flag.
When enabled the output subset conforms to the requirements for a base font to be patched by IFTB patches. IFTB is a proposed incremental font transfer patch. This new flag is set as experimental. Currently, setting this flag causes the output subset to also use long offsets for outline data in loca/glyf, gvar, CFF, and CFF2.

This change is a version of https://github.com/skef/harfbuzz/commit/3ae2fe2084d96f61d8ad1bbe42a6ef4e62ec830a rebased onto head w/ tests added.
2023-11-06 16:49:09 -07:00
Qunxin Liu 57dac23d79 [instancer] add tests
Also update tests to gei rid of no-tables-with-item-variations profile
2023-10-18 08:07:26 -06:00
Garret Rieger bbd53fcfa4 Remove glyph_map test that uses retain gids.
We no longer allow the use of glyph map + retain gids (see: https://github.com/harfbuzz/harfbuzz/blob/main/src/hb-subset-plan.cc#L817). Also add the test to the meson file so it will be run by default.
2023-10-10 17:59:05 -06:00
Qunxin Liu 2415d5f239 [instancer] update tests to include GDEF/GPOS tables 2023-09-27 13:33:09 -07:00
Qunxin Liu 2d2818c096 [instancer] update expected tests to include HVAR/VVAR tables 2023-09-20 10:30:47 -07:00
Qunxin Liu 7b5daff5eb [instancer] add tests for mvar partial instancing 2023-09-18 12:20:36 -07:00
Qunxin Liu 77b158c72d [instancer] add tests for gvar partial instancing 2023-08-07 16:02:02 -07:00
Garret Rieger 77a8155425 [subset] Add some basic tests for a provided glyph map. 2023-05-04 23:01:56 +00:00
Garret Rieger 3db6baa20e [subset] add test for lig glyph fix. 2023-04-17 14:35:27 -06:00
Garret Rieger 14b9d8d534 [subset] add --no-layout-closure flag.
Disables layout glyph closure. Fixes #4192.
2023-04-14 15:12:41 -06:00
Garret Rieger c324d99952 [instancing] Add tests for MVAR instancing. 2023-01-12 18:15:07 +00:00
Garret Rieger d6f579e96a [subset] add tests that exercise script filtering. 2022-06-30 22:22:03 +00:00
Garret Rieger 44802c8ec4 [subset] use layout-features=* for layout subsetting tests w/ synthetic test fonts. 2021-08-12 14:57:18 -06:00
Garret Rieger 2c024dc3cb [subset] prune redundant cmap12 subtables.
If the post subset cmap12 table is equivalent to another cmap subtable don't include the 12 table in the final subset. Matches change https://github.com/fonttools/fonttools/pull/2146 from fontTools.
2021-08-04 17:36:24 -06:00
Qunxin Liu 71b5509c19 [subset] support option --glyph-names 2021-07-23 13:57:39 -07:00
Qunxin Liu eee7b459ee [subset] add option --no-prune-unicode-ranges 2021-06-24 11:44:20 -07:00
Qunxin Liu d07f789ae3 [subset] support option "--notdef-outline" 2021-06-18 15:35:02 -07:00
Qunxin Liu cb5a6b5a27 [subset] support option --layout-features 2021-05-26 18:04:18 -06:00
Garret Rieger 6fddc2bbf9 [subset] subset layout tables (G*) by default. 2021-04-22 15:08:49 -07:00
Garret Rieger 4ec18c85e6 [subset] add subsetting tests with drop hints and layout subsetting enabled. 2021-04-06 11:50:44 -06:00
Garret Rieger 7a72b20aa2 [subset] Subset GDEF during layout subsetting tests. 2020-09-24 15:58:48 -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 c8cc1e378d fix issues in ClassDefFormat1 serialize:
glyph ids in Iterator may be non-consecutive,
so the number in classValue might be larger than length of the Iterator
2020-04-03 12:31:48 -07:00
Qunxin Liu fcd7f33bbb [subset] GDEF glyphClassDef subsetting support
glyphClassDef uses the same ClassDef format. However, glyphClassDef table
uses predefined class values so we do not remap class values.
2020-02-26 11:10:31 -08:00
Qunxin Liu 36a5c042d7 [subset] Add "--name-languages" and "--name-legacy" options
Make name table subsetting consistent with fontTools
2020-01-24 23:17:04 +03:30
Ebrahim Byagowi e171beeb5f Revert "[subset] Add "--name-languages" and "--name-legacy" options"
Causes tests failures, please reapply when tests are fixed, thanks.

This reverts commit fd85818b5b.
2020-01-24 19:51:32 +03:30
Qunxin Liu fd85818b5b [subset] Add "--name-languages" and "--name-legacy" options
Make name table subsetting consistent with fontTools
2020-01-23 17:24:05 -08:00
Garret Rieger c740c8636b [subset] Add integration tests for SingleSubst. 2019-05-21 13:02:11 -07:00
Qunxin Liu 6faac8df83 [subset] Subsetting Name Table Step 4
Add unit test and integration test
2019-04-26 15:24:47 -07:00
Michiharu Ariza c12862657f added desubroutinize & retain-gids full test cases with CFF fonts
and CFF retain-gids fixes
2019-02-01 14:50:01 -08:00
Garret Rieger e6ffcc5904 [subset] Add expected files for retain-gids integration tests. 2019-01-29 13:19:21 -08:00
Garret Rieger a903f9c228 [subset] Add some subsetting integration tests covering retain gids. 2019-01-29 13:19:21 -08:00
Michiharu Ariza d8fadec098 added desubroutinize full font test profiles & expected fonts
modified subset_test_suite.py to apply desubroutinize profiles to CFF only (not to TT)
2018-11-04 13:12:20 -08:00
Garret Rieger 70a1049b3f [subset] Add a drop hints profile to basics.tests 2018-02-27 17:23:44 -08:00
Garret Rieger 4cdae914e2 Add basic directory structure for subsetter integration tests. Plus a utility for generating expected output files. 2018-02-04 12:57:33 -08:00