Commit Graph

1825 Commits

Author SHA1 Message Date
Garret Rieger 8c0c217b5a [subset] fail reference blob in face builder if allocation for table sorting fails.
Fixes https://oss-fuzz.com/testcase-detail/5041767803125760
2021-08-06 15:54:41 -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 84946e4d2c [test] Suggest updating the expectation if ttx matches
https://github.com/harfbuzz/harfbuzz/issues/3089#issuecomment-892208892
2021-08-04 17:35:19 -06:00
Behdad Esfahbod 5086e10538 [test] Add failing fuzzer test case
From https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36236
https://oss-fuzz.com/testcase-detail/5061207689134080
2021-08-04 11:55:53 -06:00
Khaled Hosny f698fe5aee [test] Always fail subset tests if hashes don’t match
Regardless of the pre sentience or absence of fonttools.
2021-08-04 10:26:14 -06:00
Khaled Hosny 9f544e5008 [test] Don’t skip subset tests early
Check for FontTools only when the checksums are mismatching.
2021-08-04 04:20:14 +02:00
Khaled Hosny b084153317 [test] Remove subset tests from the slow suite 2021-08-04 04:12:31 +02: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 2cc9ed2b9e [test] More lookup_collect_glyphs() tests 2021-08-03 10:06:27 -06:00
Khaled Hosny 0664037401 [test] More lookup_collect_glyphs() tests 2021-08-03 10:06:27 -06:00
Khaled Hosny ecdd8e3f18 [test] More lookup_collect_glyphs() tests 2021-08-03 10:06:27 -06:00
Khaled Hosny f998d7e1ce [test] Add API test for lookup_collect_glyphs()
We don’t seem to have any tests exercising this API at all, and it is a
good check of GSUB/GPOS code.
2021-08-03 10:06:27 -06:00
Khaled Hosny 10e73d188a [test] Add batch mode to hb-subset and use it
time meson test --suite=subset down from:
real	0m22.822s
user	0m44.561s
sys	0m9.255s

to:
real	0m19.418s
user	0m38.171s
sys	0m3.587s

Does not seem to help much, but it is something.

Part of https://github.com/harfbuzz/harfbuzz/issues/3089
2021-08-01 22:08:28 -06:00
Khaled Hosny 1fd3a261e5 [test] Remove unused shaping tests reference mode 2021-08-01 19:38:39 +02:00
Behdad Esfahbod 05cf81283b [util/hb-shape] Fix use of EOF as end-of-line
EOF is -1, which was being treated as a valid char (255).
Use int instead.
2021-08-01 08:12:40 -06:00
Behdad Esfahbod 7cbcdaf68a Whitespace 2021-07-30 11:26:46 -06:00
Behdad Esfahbod 5d283aa0bd
Merge pull request #3095 from harfbuzz/subset-tests-speed
[test] Speed-up subset tests by saving TTX dump
2021-07-30 10:15:09 -06:00
Garret Rieger f9d8e4a976 [subset] switch ..._set_flags to not take a mask. 2021-07-29 18:30:27 -07:00
Garret Rieger 3d534b146c [subset] convert subset input flags into bit flags.
Store the flags in a bit set. Updates the public api to work with the bit set directly.
2021-07-29 18:02:34 -07:00
Khaled Hosny f6c67a5fcf [test] Open file in UTF-8
It is 2021 and Python still does not default to UTF-8 on Windows!
2021-07-30 02:20:19 +02:00
Khaled Hosny bafbade087 [test] Force FontTools to use \n on all platforms
On Windows in helfuly uses \r\n.
2021-07-30 01:42:45 +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
Khaled Hosny 72489f3e0e [test] Free memory in hb-aots-tester 2021-07-29 10:42:23 -06:00
Khaled Hosny 895162d6f3 [test] Account for mark zeroing in AOTS tests
The AOTS are not written with the face that mark glyphs gets their
advances zeroed. Taking this into account makes 16 more tests to pass.
2021-07-29 10:42:23 -06:00
Khaled Hosny e65bf60500 [test] make this test runner less verbose
Print the command being called once and in a way the can be manually
run.
2021-07-29 10:42:23 -06:00
Khaled Hosny 9a7ff54bb7 [test] Write one sequence per-line
https://github.com/harfbuzz/harfbuzz/pull/3087#issuecomment-888691436
2021-07-28 18:25:51 -06:00
Khaled Hosny ddf87ffb22 [test] Add generated tests for emoji clusters
Fixes https://github.com/harfbuzz/harfbuzz/issues/3017

Uses AdobeBlank2.ttf from:

  https://github.com/adobe-fonts/adobe-blank-2

instead of a dummy empty font so that everything maps to GID 1 and
control code points are kept instead of being dropped because there is
not space glyph (otherwise we’d need to identify control code points
somehow when generating the expectations).
2021-07-28 18:25:51 -06:00
Behdad Esfahbod 6fe0d7d6e8 [GSUB] If MultipleSubst is applied to a ligature-component, preserve lig-id
Fixes https://github.com/harfbuzz/harfbuzz/issues/3069
2021-07-28 12:06:49 -06:00
Garret Rieger acbd8b27dc [subset] temporarily disable COLRv1 subsetting.
Currently COLRv1 spec is being changed so the subsetting implementation is out of sync. Disable subsetting by failing sanitization for COLRv1 tables and disable all colrv1 tests.
2021-07-28 11:36:34 -06:00
Behdad Esfahbod 0ded6a70c8 [subset] Fix another fuzzer issue
Addition could overflow on 32bit arch.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36636
Fixes https://oss-fuzz.com/testcase-detail/5072358514753536
2021-07-28 11:35:27 -06:00
Khaled Hosny c65e1e0842 [test] Run AOTS cmap tests with ot font functions only
We are not interested in testing FreeType cmap support.

Fixes most format 4 tests. The remaining test seems to be peculiar, and
I can’t find any cmap implementation that produces the expected output.
2021-07-28 11:35:09 -06:00
Khaled Hosny 8396c523b6 [test] Add AOTS cmap tests
Uses https://github.com/adobe-type-tools/aots/pull/3

Related to https://github.com/unicode-org/text-rendering-tests/issues/70

We don’t support format 4 or 8, so these tests are disabled. We support
format 4 but most of the tests are failing, investigating.
2021-07-28 11:35:09 -06:00
Khaled Hosny 50379fbb15 [util] Don’t split text at new lines in batch mode
In batch mode (which is used for testing) we are probably not interested
in splitting text into lines as we could have split the string into
different tests. This fixes a bunch of AOTS tests that use newlines as
input.
2021-07-28 11:35:09 -06:00
Khaled Hosny 92b85749f2 [util] Strip quotes when parsing features
When running in batch mode, the quotes are not stripped by the shell and
end up in the feature string. This breaks one of the AOTS tests.

Alternatively, we can remove the quotes from the test files, not sure
which is less hacky, though!
2021-07-28 11:35:09 -06:00
Khaled Hosny ad9559e3e2 [tests] Make AOTS update.py work on macOS
Use C++ compiler and make sure C++11 is used.
2021-07-28 14:35:23 +02:00
Khaled Hosny d84efca312 [tests] Add missed test file to Makefile/meson
It was introduced in 205737acdc but was
not actually used.

See https://github.com/harfbuzz/harfbuzz/issues/2098
2021-07-28 13:39:15 +02:00
Garret Rieger 09474d8d7b [subset] Fix fuzzer timeout in add_gid_and_children.
The composite glyph graph isn't check for max operations by sanitize so track an operations count during the graph traversal.
2021-07-27 13:30:06 -06:00
Behdad Esfahbod c68a00b92e [subset] Fix possible overflows in VarRegionList serialize
Fixes https://oss-fuzz.com/testcase-detail/5362189182566400
2021-07-27 13:28:09 -06:00
Behdad Esfahbod 4762fcb415
Merge pull request #3067 from googlefonts/glyph_names
[subset] support option --glyph-names
2021-07-26 11:48:55 -07:00
Behdad Esfahbod aeec278453
Merge pull request #3068 from harfbuzz/hoi
[variations] Support multiple axes with same tag, aka HOI
2021-07-26 11:31:54 -07:00
Qunxin Liu 71b5509c19 [subset] support option --glyph-names 2021-07-23 13:57:39 -07:00
Behdad Esfahbod b235511ed8
Merge pull request #3021 from googlefonts/stable_api
[subset] update hb_subset api with final changes before going stable.
2021-07-23 12:15:15 -07:00
Behdad Esfahbod a9a607d360 [variations] Support multiple axes with same tag, aka HOI
The axes in fvar are in arbitrary order, NOT sorted. Hence have to
lsearch all entries.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1673
Fixes https://github.com/harfbuzz/harfbuzz/issues/2743

Test from https://github.com/ctrlcctrlv/FontForge-Higher-Order-Interpolation
2021-07-23 11:58:58 -07:00
Garret Rieger 9ab751ac9f [subset] Remove hb_subset(). Leaving just hb_subset_or_fail(). 2021-07-22 12:14:47 -07:00
Garret Rieger aba2e13141 [subset] Remove hb_subset_input_get/set_overlaps_flag (). 2021-07-22 12:12:36 -07:00
Garret Rieger 7d82191f61 [subset] Remove hb_subset_input_get/set_name_legacy (). 2021-07-22 12:12:36 -07:00
Garret Rieger 942636ae13 [subset] Remove hb_subset_input_get/set_retain_gids. 2021-07-22 12:12:36 -07:00