Commit Graph

39 Commits

Author SHA1 Message Date
Garret Rieger 95329081c2 [subset] further optimize cmap4 packing. 2021-11-28 07:47:49 -07:00
Garret Rieger d9660fd58a [subset] Make cmap4 packing more optimal.
The current CMAP4 implementation uses whatever the current codepoint ranges are and then encodes them as indivudal glyph ids or as a delta if possible. However, it's often possible to save bytes by splitting up existing ranges and encoding parts of them using deltas where the cost of splitting the range is less than encoding each glyph individual.
2021-11-26 13:21:50 -07:00
Garret Rieger 49c9392412 [subset] During LigatureSubstFormat1 subsetting always place Coverage last.
In Windows 7 on Chrome if the coverage table comes before any of the LigatureSet or Ligature subtables the font won't load. This changes the packing order to always place the Coverage table last. Virtual links are used to ensure the repacker maintains the desired ordering.

Coincidentally fontTools also does the same thing (a3f988fbf6/Lib/fontTools/ttLib/tables/otTables.py (L1137)) to reduce overflows during packing.
2021-11-02 12:19:13 -06:00
Garret Rieger c2ee1fdd40 [subset] remove unsed table_entry struct. 2021-08-05 11:47:07 -06:00
Garret Rieger dea0fe5717 [subset] discard extra copies of a table in face builder.
Fixes #2361. Stores tables in the builder in a hashmap so you end up with at most one copy of each table. Table serialization order is now based on tag sort order instead of order of insertion into the builder.
2021-08-05 11:47:07 -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
Khaled Hosny 7ccc52b075 [test] Compare sha256 hash before TTX dumps
Most of time the files are identical, so instead of comparing the TTX
dump we can check sha256 hashes of the files first and if they match, we
don’t have to check the TTX dumps at all, making the subset tests orders
of magnitude faster.

time meson test --suite=subset down from:
real    0m19.418s
user    0m38.171s
sys     0m3.587s

to:
real	0m3.102s
user	0m8.622s
sys	0m1.701s

The expected files have been replaced by hb-subset output so they are
bit-identical where FontTools output might not.

The generate-expected-outputs.py now compares the hb-subset output with
fontttols subset and errors of they don’t match.
2021-08-04 04:10:38 +02:00
Khaled Hosny 770fbd5aa6 Revert "[test] Speed-up subset tests by saving TTX dump"
This reverts commit 278f44dcee.
2021-08-04 04:10:37 +02:00
Khaled Hosny 278f44dcee [test] Speed-up subset tests by saving TTX dump
Speed-up subset tests by saving TTX dump of expected output instead of
generating it each time the tests are run.

Cuts down meson test --suite=subset on my system from:
real	0m38.977s
user	1m12.024s
sys	0m10.547s

to:
real	0m22.291s
user	0m44.548s
sys	0m9.221s

Part of https://github.com/harfbuzz/harfbuzz/issues/3089
2021-07-30 00:00:35 +02: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 92757f6809 [subset] Don't drop anchor device tables when dropping hints. These may contain variation data.
Update subseting expected files to match latest version of fontTools.
2021-04-23 18:50:33 -07: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 596f4258d0 [subset] copy Lookup::markFilteringSet when subseting. 2021-04-02 15:33:52 -06: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 490ef1cc23 [subset] Fix namerecord ordering
This will fix inconsistency with fontTools.
Also according to the spec, namerecords must be sorted
first by platform ID, then by platform-specific ID,
then by language ID, and then by name ID.
2020-02-01 23:07:47 +03:30
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
blueshade7 4cba7bdae9 regenerate Confortaa subset test expected results 2019-07-18 14:03:33 -07:00
blueshade7 a76d8b0d55 Merge commit '504bb17287c978d60a4a515555852465319f74ed' into var-subset 2019-07-17 14:12:06 -07:00
Qunxin Liu 1da1b4dc94 [subset] For option "--unicodes", add support for "*" to retain all code points 2019-07-15 11:18:50 -07:00
blueshade7 0eef8113d8 retain gids in HVAR so in sync with fontTools
regenerate Comfortaa subset test results
2019-07-09 11:43:59 -07:00
Qunxin Liu 993d81b9c5 [subset] Add one ttf file with fvar/STAT tables to integration test
Ignore gvar/MVAR/HVAR table
add support for --nameIDs=* option
2019-05-22 17:20:45 -07:00
Garret Rieger 6555f20958 [subset] Truncate empty gids at the end in retain-gids mode. 2019-05-16 10:34:53 -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
Garret Rieger e6ffcc5904 [subset] Add expected files for retain-gids integration tests. 2019-01-29 13:19:21 -08:00
Garret Rieger 7947927317 [subset] Update expected files for subset integration tests to include cmap4. 2018-05-04 11:20:03 -07:00
Garret Rieger 70a1049b3f [subset] Add a drop hints profile to basics.tests 2018-02-27 17:23:44 -08:00
Garret Rieger 33f4381314 [subset] Add some more variations of the basic test. 2018-02-27 17:23:43 -08:00
Garret Rieger 2b84480343 [subset] Update expected files for subsetting integration test to not include cmap 4. 2018-02-23 10:51:49 -08:00
Garret Rieger a88504c601 [subset] Fix checksum clearning in subset test diff. Add an updated expected file (has cmap4 restored). 2018-02-23 10:51:49 -08:00
Garret Rieger 04c1ec2b73 [subset] Don't fail on different checksum adjustment in subsetting tests. 2018-02-14 17:01:20 -08:00
Garret Rieger b0eefacf4c [subset] Drop GSUB, GDEF, GPOS, and DSIG from subsetter expected test outputs. 2018-02-14 10:19:50 -08:00
Garret Rieger 38af23b8df Make the expected output for subsetting basics test be equal to the input file for now. 2018-02-04 12:57:33 -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