Commit Graph

2067 Commits

Author SHA1 Message Date
Garret Rieger d700646c33 [subset] In preperation for 3.0.0 release remove legacy subsetting api methods. 2021-09-16 15:31:29 -06:00
David Corbett a0101a31b5 [Unicode 14] Add tests 2021-09-14 18:38:50 -04:00
Khaled Hosny 4d9b7de0b6 [style] Prepare for release 2021-09-13 10:10:10 -06:00
Behdad Esfahbod 201cbe3c66 [style] Rename HB_STYLE_TAG_SLANT to HB_STYLE_TAG_SLANT_ANGLE 2021-09-10 04:59:16 -06:00
Qunxin Liu 37379f8f7d [subset] fox for (Chain)ContextFormat3: subset lookupRecord
skip copying a lookupRecord if lookup referenced in the lookupRecord is
not retained after subset
2021-09-08 13:55:21 -06:00
Khaled Hosny 9fddbb3e24 [test] Rename test and split into smaller subtests 2021-09-03 18:24:40 +02:00
Khaled Hosny c6bb719e65 [test] Add tests for Arabic decomposition
Test that both NFC and NFD input produces identical results for fonts
that used composed fonts internally (Amiri here) and fonts that
decompose internally (Noto Nastaliq Urdu here) and that for the former
composed forms are used.

See https://github.com/harfbuzz/harfbuzz/issues/3179
2021-09-03 08:58:35 -06:00
Khaled Hosny a9dc4fbeac [test] Make shape test names match file names
No idea why test names are underscorified but it it just makes calling
meson test testname harder than it should being not able to copy file
name directly.
2021-09-03 08:56:34 -06:00
Garret Rieger 102666dab7 [subset] add test for hb_subset_input_set (...). 2021-08-27 10:36:42 -07:00
Behdad Esfahbod 99356ea5f0
Merge pull request #3150 from harfbuzz/item-context-tests
[test] Add tests for item context
2021-08-25 17:19:06 -06:00
Behdad Esfahbod 955f86a034 [test-set] Fix compiler warnings 2021-08-24 23:16:24 -06:00
Garret Rieger f2441a4b65 [subset] Remove retain all layout features flag.
Instead use inverted sets to handle requesting all features. Modifies feature collection in subset plan to intersect the set of requested features against the features in the font. This prevents iterating a fully filled feature tag set.
2021-08-24 18:17:07 -06:00
Garret Rieger f84daccb4f [set] include null pool sets in the permutations tested by inverted_operations. 2021-08-24 16:51:11 -06:00
Garret Rieger fb07f8f876 During subset input creation check for set alloc failures and fail if encountered. 2021-08-24 10:59:14 -06:00
Khaled Hosny 33bfe9edd6 [test] Add tests for item context
Test pre-context and post-context in Arabic shaper, as well as
interaction of pre-context with BOT flag.
2021-08-24 02:12:34 +02:00
Qunxin Liu 34e0b28fae [subset] make glyph-names option match fonttools behavior
Don't encode psNames that are contained in standard glyph names set
2021-08-20 01:30:23 -06:00
Behdad Esfahbod 829b0f3353
Merge pull request #3154 from harfbuzz/set-invert
Resurrect hb_set_invert()
2021-08-20 01:28:15 -06:00
Garret Rieger 915550ab19 [set] remove inverted test TODO. 2021-08-19 17:48:38 -07:00
Garret Rieger c4ed582997 [set] add test for inverted set operations.
This test checks all possible set configurations against each operation type.
2021-08-19 17:47:41 -07:00
Garret Rieger 325fd6ddb8 [set] add tests for inverted set equality. 2021-08-19 15:54:31 -07:00
Garret Rieger 287032af6c [set] update set test TODO list. 2021-08-19 15:45:28 -07:00
Garret Rieger 5c003d80a6 [set] add tests for inverted previous iteration. 2021-08-19 15:41:12 -07:00
Garret Rieger 3f2cc582f2 [set] add basic and iteration set inverion tests. 2021-08-19 15:05:10 -07:00
Garret Rieger dc31920bbe Don't serialize null offsets in CPAL.
Fixes https://oss-fuzz.com/testcase-detail/5443213648330752
2021-08-18 16:52:45 -06:00
Garret Rieger cb05c363d7 [subset] add some basic tests for the legacy subset methods. 2021-08-14 10:37:02 -06: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 c0f3af91b8 [subset] speed up add_gid_and_children and adjust op limit.
Fix for fuzzer timeout: https://oss-fuzz.com/testcase-detail/5001604901240832.

- Operation limit is per glyph, so 100,000 should still be far more than needed.
- Switches from for(...) to while(...) loop for iteration. for(...) calls it.end() which in this case triggers a complete iteration.
- Cache CompositeGlyph size in the iterator to avoid needing to recalculate it.
2021-08-12 14:50:42 -06:00
Behdad Esfahbod 23282c9c9d [util/hb-subset] Support ranges in --unicodes / --unicodes-file
Fixes https://github.com/harfbuzz/harfbuzz/issues/3109
2021-08-11 22:49:47 -06:00
Behdad Esfahbod 58bfe40794 [util] Move hb-subset away from main-font-text 2021-08-11 20:12:36 -06:00
Behdad Esfahbod 3147e081da Merge branch 'main' into post-parse 2021-08-11 19:33:00 -06:00
Khaled Hosny 43722cc9f4 [test] Add some real reverse sub tests 2021-08-11 19:30:16 -06:00
Behdad Esfahbod e0d7060f80 [test] Rename shaping/ to shape/ 2021-08-11 18:49:59 -06:00
Khaled Hosny f122698810 [test] Improve generate-expected-outputs.py diff output 2021-08-12 02:02:10 +02:00
Khaled Hosny 6ac6a2b27b [test] hb_ot_layout_language_get_feature_tags() 2021-08-11 16:33:37 -06:00
Khaled Hosny e9b743b26d [test] hb_ot_layout_script_get_language_tags() 2021-08-11 16:33:37 -06:00
Khaled Hosny bf438b815f [test] hb_ot_layout_table_get_feature_tags() 2021-08-11 16:33:37 -06:00
Khaled Hosny 2f88ea5a20 [test] hb_ot_layout_table_find_script() 2021-08-11 16:33:37 -06:00
Khaled Hosny f60caad7ff [test] hb_ot_layout_table_get_script_tags() 2021-08-11 16:33:37 -06:00
Garret Rieger c08f1b8903 [map] fix incorrect population count in hash map.
If the same key was set twice the population was being incorrectly incremented.
2021-08-10 14:00:55 -06:00
Garret Rieger e39c3bde7b [subset] fix bug in parsing glyf flags.
the bytes of the flag stream were being treated as signed integers instead of unsigned as specified in the spec.
2021-08-10 12:57:07 -06:00
Behdad Esfahbod f3acb977ec [test/shaping;util] Use ';' instead of ':' to separate test fields
Accept that in --batch mode. Also in batch mode don't send the 0th arg.

Related discussion: https://github.com/harfbuzz/harfbuzz/pull/3102
2021-08-10 11:08:36 -06:00
Behdad Esfahbod b83fd3a564 [util] Refactor batch-processing code into batch.hh 2021-08-10 02:32:55 -06:00
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
Garret Rieger 77b4a1cd96 [subset] Remove hb_subset_input_get/set_desubroutinize. 2021-07-22 12:12:36 -07:00
Garret Rieger 8bf5d4d4f7 [subset] Remove hb_subset_input_get/set_drop_hints. 2021-07-22 12:12:36 -07:00
Behdad Esfahbod 79e8b30609 [ot-shape] Fix application of kern table if GPOS kern is missing
Was broken sometime after we implemented kerx and tweaking it.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3043
2021-07-16 16:29:44 -06:00
Garret Rieger deee24fbef [subset] Add missing FontName op code in top dict parsing.
Fix for #3058
2021-07-14 16:01:18 -06:00
Qunxin Liu 7416faceeb [subset] fuzzer fix: https://oss-fuzz.com/testcase-detail/5715464591376384 2021-07-08 09:09:30 -07:00
Garret Rieger 0da9158f62 [subset] Remove OffsetTo::serialize().
Convert remaining uses of it to serialize_serialize() which correctly uses the object packer.
2021-06-30 14:05:48 -07:00
Qunxin Liu eee7b459ee [subset] add option --no-prune-unicode-ranges 2021-06-24 11:44:20 -07:00
Khaled Hosny c3be28ea26 [ot-shape] Numeric runs native direction is LTR
See inline comments. Slightly modified version of the code from Jonathan
Kew on the linked issue.

Fixes https://github.com/harfbuzz/harfbuzz/issues/501
2021-06-23 13:11:27 -07:00
Khaled Hosny 71a6296620 [tests] Make record-test.sh work with .otf files
It hard-codes the file extension, but fonttools sunset will use .otf for
CFF fonts, so hard-code the output file from subset as well.
2021-06-23 13:11:27 -07:00
Garret Rieger bc06af977f [subset] speed up feature collection when tags are specified.
Precompute a feature index filter to avoid needing to iterate the feature tag list for each encountered feature index. For this particular fuzzer case speeds up feature collection from 50s to 2s.
2021-06-20 17:45:19 -07:00
Garret Rieger d2397d91f3 [subset] Add additional colrv1 subsetting tests that has a glyph with components. 2021-06-18 22:34:00 -07:00
Qunxin Liu d07f789ae3 [subset] support option "--notdef-outline" 2021-06-18 15:35:02 -07:00
Garret Rieger 675ebbeb3a [subset] don't alloc zero bytes.
It will be leaked later since hb_blob_create() won't set up the blob to cleanup since it has length zero.
2021-06-16 17:35:39 -06:00
Behdad Esfahbod bdfed8f113 [blob] Add failing versions of create API
Fixes https://github.com/harfbuzz/harfbuzz/issues/2567

New API:
+hb_blob_create_or_fail()
+hb_blob_create_from_file_or_fail()

Use these in util/ to distinguish empty file from not-found file.
Only err on the latter.
2021-06-15 13:56:30 -06:00
Behdad Esfahbod 5bc05ba155 Prefer GPOS over kerx, if GSUB was applied
Fixes https://github.com/harfbuzz/harfbuzz/issues/3008
2021-06-13 05:28:20 -06:00
David Corbett 5585ea02eb [syllabic] Set position of dotted circle for Indic 2021-06-06 10:35:59 -07:00
Qunxin Liu 35d6af6943 [subset] fix fuzzer testcase: https://oss-fuzz.com/testcase-detail/5965777994907648 2021-06-04 18:16:23 -06:00
Qunxin Liu 1b6008ca62 fix fuzzer testcase: https://oss-fuzz.com/testcase-detail/5417934246772736 2021-06-02 17:32:16 -06:00
Qunxin Liu 7ab0f4eda9 fuzzer fix 2021-05-31 12:44:33 -06:00
Qunxin Liu cb5a6b5a27 [subset] support option --layout-features 2021-05-26 18:04:18 -06:00
Garret Rieger 0989b5553a [subset] Add test for overlaps flag setting. 2021-05-26 16:04:56 -06:00
Qunxin Liu f739e1dc6a [subset] subset both CPAL and COLRv1 2021-05-26 15:39:42 -06:00
Kurt Kartaltepe 2000f47ae5 [set] Compute is_subset by comparing pages.
Test subsets one page at a time instead of by codepoints. On my machine
this is about 250x faster than the previous implementation.
2021-05-26 14:15:25 -06:00
Jonathan Kew 89df353996 [aat] Add testcase for Apple Color Emoji couple-with-skin-tones sequence. 2021-05-17 21:44:29 -06:00
Garret Rieger a08900b721 [subset] fix failing colrv0 subsetting when font has composite glyphs.
Composite glyph collection was happening along side colrv0 glyph collection which meant it was possible to miss grabbing the component glyphs for a glyph added by colrv0.
2021-05-10 15:33:54 -06:00
Garret Rieger b07b97d5d7 [subset] Add more Noto Nastaliq test cases. 2021-05-06 14:24:45 -06:00
Garret Rieger 2b7647649a [subset] update test-subset-gpos expected files. 2021-04-30 14:46:57 -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 425ba1f4ab [subset] fixes infinite loop in hb_set_get_max().
Fixes https://oss-fuzz.com/testcase-detail/5363902507515904
2021-04-20 13:18:07 -06:00
Garret Rieger ec4321068b [subset] fix infinite loop caused by alloc failure in repacker.
Fixes: https://oss-fuzz.com/testcase-detail/5609112151916544.
2021-04-20 13:18:07 -06:00
Garret Rieger 0e845d973e [subset] fix memory leak in repacker caused by failed alloc.
Fixes: https://oss-fuzz.com/testcase-detail/5616763250278400.
2021-04-20 13:18:07 -06:00
Garret Rieger 3fb62cdc14 [subset] fail on offset overflow in tables that we don't repack.
Fixes: https://oss-fuzz.com/testcase-detail/5229304507138048
2021-04-19 17:01:05 -06:00
Behdad Esfahbod 47cbf8f2c4 [test] Silence more compiler warnings 2021-04-16 13:32:02 -06:00
Qunxin Liu 9dc9f0385d [subset] fix for fuzzer testcase: https://oss-fuzz.com/testcase-detail/5858518134554624 2021-04-09 11:07:28 -06:00
Qunxin Liu 4af5dacedc [subset] add fuzzer testcase 2021-04-07 13:02:04 -06:00
Garret Rieger 64122b5a44 [subset] don't visit lookup if covered glyph set has failed.
If covered glyph set is in error then the same lookup can be recursed into repeatedly potentially causing a fuzzer timeout. Fixes: https://oss-fuzz.com/testcase-detail/5416421032067072.
2021-04-06 12:34:44 -06: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 71d6d15600 [subset] clamp distance to prevent shifting outside of the limits of int64.
Fixes https://oss-fuzz.com/testcase-detail/4961171477233664.
2021-04-06 11:48:39 -06:00
Garret Rieger 596f4258d0 [subset] copy Lookup::markFilteringSet when subseting. 2021-04-02 15:33:52 -06:00
Garret Rieger c35d786397 [subset] never drop the 'pref' feature.
Never ever drop feature 'pref', even if it's empty. Harfbuzz uses it to choose the shaper for Khmer.
2021-04-01 16:27:35 -06:00
Garret Rieger 85b0728783 Add full variable font subsetting test. 2021-04-01 15:26:02 -06:00
Garret Rieger b10741ca7f [subset] when closing glyphs in context lookups don't use a current glyph set if a lookup is already applied. 2021-03-31 21:03:33 -06:00
Garret Rieger 2773d05740 [subset] Add a test case using NotoNastaliqUrdu. 2021-03-31 21:03:33 -06:00
Garret Rieger c5c13006a1 [subset] fix memory leaks found in https://oss-fuzz.com/testcase-detail/5179935334465536 2021-03-31 12:37:45 -06:00
Garret Rieger adca4ce071 [subset] fixes https://oss-fuzz.com/testcase-detail/6173520787800064.
Caused by incorrect bounds check in glyph closure for context lookups.
2021-03-30 15:44:41 -06:00
Garret Rieger 752e393ad2 [subset] avoid calling clear on null pool set. 2021-03-30 15:12:52 -06:00
Garret Rieger 8741914a80 [subset] fix memory leak when map insert fails. 2021-03-29 18:02:32 -06:00
Garret Rieger 5b6da6d2f0 [subset] add fuzzer test case. 2021-03-29 17:41:07 -06:00
Garret Rieger a804a0c903 [subset] add fuzzer test case. 2021-03-29 17:15:22 -06:00
Qunxin Liu 95230e291d [subset] support subsetting GSUB8 2021-03-29 15:54:11 -06:00
Garret Rieger 0104409959 Fix repack_tests for distcheck. 2021-03-17 15:53:58 -07:00
Garret Rieger b8b8c58b9f [subset] add tests that check for successful repacking of a real font file. 2021-03-17 15:53:58 -07:00
Qunxin Liu 56ca435787 [subset] fix for collect_features and remove_redundant_lamngsys
previously remove_redundant_sys () is missing in harfbuzz, after
redundant langsys removal, some features are removed as well in
prune_features() in fonttools. This change is trying to get the same
result between harfbuzz and fonttools.
2021-03-17 14:24:04 -07:00
Garret Rieger 69d772e522 [subset] Fixed test gsub5 test files. 2021-03-17 15:22:07 -06:00
Qunxin Liu 0e1c0fa404 [subset] optimize glyph closure method: step 5
add testcase and some fixes
2021-03-17 15:22:07 -06:00
Garret Rieger 1b79b8cd2d [subset] update gpos tests to reflect updated behaviour. 2021-03-16 15:23:11 -07:00
Garret Rieger b1b1486d07 [subset] update expected files to not include cmap12 pruning. 2021-03-16 14:49:35 -07:00
Garret Rieger 190b7a98f8 [subset] Update PairPosFormat2 subsetting to match fontTools updated subsetting (https://github.com/fonttools/fonttools/pull/2221)
- subset class def 1 against the coverage table.
- Don't re-use class 0 in class def 2.
- Ignore class 0 glyphs for the purposes of determing format 1 vs format 2 encoding for ClassDef.

Add an additional test case which demonstrates these issues.
2021-03-16 14:49:35 -07:00
Khaled Hosny 4c34478b28
Merge pull request #2899 from harfbuzz/ci-fix
[ci] Don’t install meson from its master branch
2021-03-16 10:37:49 +02:00
Khaled Hosny f2d08578e7 [tests] Increase shape-fuzzer timeout 2021-03-16 01:15:40 +02:00
Behdad Esfahbod 15f3ef0136 [test] Fix output format 2021-03-15 16:01:35 -06:00
Khaled Hosny 7686ff854b
[ot] Keep substituted Default_Ignorables (#2886)
Don’t replace Default_Ignorables with zero-width space if they are
substituted or multiplied, not just when ligated.

After this change, HarfBuzz output matches that of Uniscribe and
CoreText for the new tests.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2883
2021-03-04 13:09:32 -08:00
Behdad Esfahbod fd489433a8 [indic] Fix cluster-merging logic with cluster-level=1
Was producing non-monotonic cluster numbers because our faulty logic
was not merging clusters if something from before base and after base
had switched positions.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2272
2021-03-02 16:30:09 -07:00
Behdad Esfahbod 1c693e8c28 [test] Fix unused-var warning 2021-02-22 17:11:36 -07:00
justvanrossum 1551f3d518 fixing more expected test results 2021-02-19 16:53:21 -07:00
justvanrossum 79e4f436e7 Apply rounding correctly when calculating glyph extents for CFF and CFF2; adjust expected test results 2021-02-19 16:53:21 -07:00
justvanrossum d01ebeae21 calculate extents based on scaled then rounded values; undo two of the earlier test result adjustments 2021-02-19 16:53:21 -07:00
justvanrossum 1d02e9c63b two more adjusted expected extents results (still not convinced this is the right thing, though) 2021-02-19 16:53:21 -07:00
justvanrossum cd0babe6a6 adjust expected test result 2021-02-19 16:53:21 -07:00
Behdad Esfahbod d8ea552d10 [aat] Improve unsafe-to-break logic
Reduces false-positives.  See comments for new logic.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2860

Adjusts run-tests.sh to allow unhashed absolute filenames.
2021-02-19 16:23:22 -07:00
Garret Rieger 5ca353a2d0 [subset] fix heap buffer overflow found by fuzzer. 2021-02-16 12:43:02 -07:00
David Corbett 751ed68fee [indic] Fix shaping of U+0B55 ORIYA SIGN OVERLINE
Fixes https://github.com/harfbuzz/harfbuzz/issues/2849
2021-02-14 12:47:34 -05:00
Garret Rieger 00d9276343 Add gpos9 expected files to Makefile.am 2021-02-11 13:41:31 -07:00
Garret Rieger 08a4997fde [subset] Add subset support for Extension lookups (GPOS 9, GSUB 7). 2021-02-11 13:41:31 -07:00
Behdad Esfahbod eb069f3948 [tests] Update expected output of recently-merged gpos5
The merged PR was from before landing this:

commit 7a72b20aa2
Author: Garret Rieger <grieger@google.com>
Date:   Thu Sep 24 15:58:48 2020 -0700

    [subset] Subset GDEF during layout subsetting tests.
2021-02-10 19:13:51 -07:00
Behdad Esfahbod c7d232ce4e
Merge pull request #2701 from googlefonts/Mark-To-Ligature_grieger
[subset] GPOS 5 MarkToLigature subsetting support
2021-02-10 18:13:38 -07:00
Khaled Hosny 554aaa0c5d [build] Fix make distcheck
A regression from 7b77ce0507.
It was caught by the CI build in the PR, but apparently we are now used
to CI failures that they are effectively ignored.

Also, yay for multiple build systems.
2021-02-10 23:22:02 +02:00
Behdad Esfahbod 6a3fd94f3b
Merge pull request #2699 from googlefonts/gpos_8
[subset] Add a more complex layout subsetting test case and fix the issues it exposed.
2021-02-09 20:49:04 -05:00
Behdad Esfahbod 33a0f0b686 [test] Remove fuzzed test font that triggers virus alert
Fixes https://github.com/harfbuzz/harfbuzz/issues/2750
2021-02-09 12:55:45 -07:00
Garret Rieger f94bf9f06f [set fuzzer] limit the total number of set members in a fuzzing input.
Currently the fuzzer can create arbitarily long inputs which once big enough will trigger a timeout.
2021-01-26 10:22:07 -08:00
Garret Rieger a4c3732f59 [ENOMEM] fix set clear() causing corruption if the set is in_error(). 2021-01-21 12:12:05 -07:00
David Corbett b2e7bb2a7c Don’t map BCP 47 to coincidentally similar OT tag 2020-11-22 19:35:47 -08:00
David Corbett 17da41bd06 Update language system tag registry to OT 1.8.4 2020-11-18 11:13:35 -08:00
Khaled Hosny c2cdcd4901 [tests] warning: unused variable 'num_glyphs' 2020-10-17 21:57:27 +02:00
David Corbett 0792690b73 [use] Skip WJ and ZWJ when clustering 2020-10-16 22:39:46 -07:00
Khaled Hosny 84dd65a874 [test] Remove timeout from test runners
See https://github.com/harfbuzz/harfbuzz/issues/2707#issuecomment-707744079

This wasn’t inconsistent as well, HB_TEST_SUBSET_FUZZER_TIMEOUT defaulted
to 12 in the test runner, but it was overridden to 50 in meson.build,
and then meson has its own test timeout.
2020-10-15 00:49:02 -07:00
Khaled Hosny fa771a7f85 [tests] Fix memory leak in test
To make valgrind bot happy.
2020-10-11 13:15:39 -07:00
David Corbett 1d53268dfe Fix two-way mapping of "man" and 'MNK ' 2020-10-11 11:38:40 -07:00
Behdad Esfahbod 540d2cdddb [tests/buffer] Revert unintended whitespace changes
From 9e5538d6a3

Tried squashing into, but too much merge conflict.
2020-10-09 22:27:55 -06:00
Behdad Esfahbod 04658ec48f [tests/buffer] Update tests for previous commit 2020-10-09 22:27:55 -06:00
Simon Cozens 7c0bc0bb92 Serialize invalid buffer to !! (text) or [] (json)
There is no generic deserialize - you have to choose glyphs or unicode - so there is no way to deserialize this buffer.
2020-10-09 22:27:55 -06:00
Simon Cozens 150f391438 Prohibit mixed glyphs/unicode buffers in deserialization 2020-10-09 22:27:55 -06:00
Simon Cozens 3d3c87e7e7 Put the flags back in and serialize clusters.
Note that now JSON glyph buffers and Unicode buffers look very similar, except for the g/u property difference.
2020-10-09 22:27:55 -06:00
Simon Cozens 432a05b2af (Simple) tests for Unicode serialization/deserialization 2020-10-09 22:27:55 -06:00
Garret Rieger be33704c00 Add gpos 5 tests to meson build file. 2020-10-09 16:46:46 -07:00
Qunxin Liu 3a0b05faf1 [subset] GPOS 5 MarkToLigature subsetting support 2020-10-01 15:59:16 -07:00
Garret Rieger 010accb3d5 [subset] Add additional test cases for the Amiri tests. 2020-09-28 17:39:09 -07:00
Garret Rieger 3271a7cdaa [subset] Remove redundant langys from Amiri test font.
FontTools removes these when subsetting but harfbuzz does not yet support redundant langsys removal. So this gets the Amiri tests passing for now.
2020-09-28 16:46:15 -07:00
Garret Rieger 9fad540245 [subset] check that sub rules in ContextFormat 1 and 2 intersect the glyphs set before recursing during closure lookups. 2020-09-28 13:24:25 -07:00
Garret Rieger 7b77ce0507 [subset] Add subsetting integration test using Amiri.
Demonstrates a failure in subsetting GPOS 8/GSUB 6.
2020-09-24 16:35:59 -07:00
Garret Rieger 7a72b20aa2 [subset] Subset GDEF during layout subsetting tests. 2020-09-24 15:58:48 -07:00
ebraminio 1f8b1e7f18
[ENOMEM] Return gracefully if stages isn't initialized correctly (#2639)
This happens if calls to 'm.lookups[table_index].push ()' has been
silently failed due to lack of memory.

This change just returns gracefully instead issuing the assert.

Fixes https://crbug.com/oss-fuzz/24494
2020-09-21 11:39:38 +03:30
Garret Rieger bbbcad0dbb Revert "[ENOMEM] don't perform set process operations if the other set is in an error state."
This reverts commit f3929abafe.
2020-09-16 12:23:38 -06:00
Garret Rieger f3929abafe [ENOMEM] don't perform set process operations if the other set is in an error state.
Running a process while the other set is in an error state can potentially corrupt this sets map map (for example by overwritting all of the major values with 0).
2020-09-16 10:36:30 -07:00
Simon Cozens 584d3a43b2
Merge pull request #2681 from khaledhosny/myanmar-liga
[myanmar] Don’t disable liga feature
2020-09-16 15:08:50 +01:00
Khaled Hosny 7d64b09765 [myanmar] Don’t disable liga feature
This seems to have been carried over from the Indic shaper, but
Uniscribe enables it by default.

See https://github.com/harfbuzz/harfbuzz/issues/2213#issuecomment-686062915
2020-09-12 21:45:19 +02:00
Garret Rieger 8c3d4de796 [subset] Fix integer underflow in ContextFormat2. 2020-09-11 15:52:46 -07:00
David Corbett 91fe20f0f5 Disambiguate OT tags when primary tag is not first 2020-09-08 09:20:00 -04:00
David Corbett e3db84a9d0 [use] Test CGJ and ZWNJ 2020-09-02 15:51:15 -07:00
Garret Rieger 9825e3dd2e [ENOMEM] fix access to unitialized memory.
If the serialize() call fails to write the object then we can't safely read varstore_prime fields. Fixes https://oss-fuzz.com/testcase-detail/5137462782066688.
2020-09-02 11:01:07 -07:00
David Corbett 420a74f772 [USE] Fix assertion failure for joining scripts 2020-08-28 14:11:48 -04:00
ebraminio 1e48225ca3
[ENOMEM] Check whether serialize context isn't in error 2020-08-13 23:22:14 +04:30
Ebrahim Byagowi 6e32145dc9 [meson] Make compatbile with 0.47.0 2020-08-13 18:28:42 +04:30
Garret Rieger 9562239f05 [ENOMEM] check for error in lookup visited set. 2020-08-13 01:43:11 +04:30
Garret Rieger 6f754852c1 [ENOMEM] skip asserts in to_bias if serializer is in an error state. 2020-08-12 11:25:30 +04:30
Ebrahim Byagowi 057769b1a3 [fuzzer] minor 2020-08-12 02:40:55 +04:30
Ebrahim Byagowi 0417938011 [fuzzer] Mark alloc_state as unused
It is really unused when failing-alloc isn't on.
2020-08-12 02:40:55 +04:30
Ebrahim Byagowi 5193357832 Revert "Remove autotools build support"
This reverts commit 01ac32aab2.
2020-08-11 23:51:59 +04:30
Ebrahim Byagowi ffe06c8f04 [glyf] Guard all the public APIs against null pool runs
Fixes https://crbug.com/oss-fuzz/24575 and https://crbug.com/oss-fuzz/24737
2020-08-08 13:43:49 +04:30
Ebrahim Byagowi 01ac32aab2 Remove autotools build support 2020-08-07 23:28:12 +04:30
Ebrahim Byagowi 679fac87df Skip hb_shape if buffer object is immutable 2020-08-06 23:47:35 +04:30
Ebrahim Byagowi ec17b62457
[var] Apply variations on empty glyphs
It was ignoring empty glyphs for no good reason, this fixes it.

Fixes #2618
2020-08-06 20:16:11 +04:30
Garret Rieger 18ab8029d5 [ENOMEM] check vector status in cmap subsetting. 2020-08-02 00:30:17 +04:30
Garret Rieger 06dbb6acbb [ENOMEM] in GSUB ChainContext subsetting check maps for allocation errors. 2020-08-01 09:21:22 +04:30
Garret Rieger fb1477795c [ENOMEM] Check result of vector resize in CBDT subsetting. 2020-08-01 09:20:52 +04:30
Ebrahim Byagowi efd716de3f [cff] Check for scalars array resize result
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24504
2020-07-31 09:27:27 +04:30
Garret Rieger 040ed094ef [ENOMEM] popragate packed/packed_map errors to the serializer.
Will disable further modifications based on a bad state.
2020-07-31 08:39:26 +04:30
Garret Rieger 7f358a55f4 [ENOMEM] unchecked resize in CFF2. 2020-07-31 02:04:06 +04:30
Garret Rieger 32f052b033 [ENOMEM] Fix several instances of not checking resize in CFF. 2020-07-31 02:04:06 +04:30
Garret Rieger 15644ee60e [ENOMEM] fix memory leak if allocation fails during pop_pack(). 2020-07-30 04:15:35 +04:30
Garret Rieger 42237adffc [ENOMEM] make serializer modification operations no-ops if it's in an error state. 2020-07-30 03:59:49 +04:30
Garret Rieger 4ba8e3c6fd [ENOMEM] Fix failure to check calloc return.
Fixes https://oss-fuzz.com/testcase-detail/6246465148813312.
2020-07-30 00:08:08 +04:30
Garret Rieger d307c24abf [ENOMEM] check resize() return.
Fixes https://oss-fuzz.com/testcase-detail/5641892164009984.
2020-07-30 00:08:08 +04:30
Ebrahim Byagowi 48ad745996 [ENOMEM] Fix buffer's content check logic
So now rest of shape fuzzer also can be enabled.

Fixes #2571
2020-07-29 08:09:10 +04:30
Ebrahim Byagowi c33e8006fd [fuzz] Implement failing allocator 2020-07-29 07:35:34 +04:30
Ebrahim Byagowi d38d63319b
[tests] minor 2020-07-27 09:19:29 +04:30
Ebrahim Byagowi 322426f8c8 [tests] Use TTFont of fonttools to avoid temp files 2020-07-27 09:12:43 +04:30
Hamidreza Bayat 08fef15818 Use fonttools's python package instead of cli 2020-07-27 09:09:06 +04:30
Ebrahim Byagowi 5c46683ab8
[fuzz] increase shape fuzzer timeout
as https://circleci.com/gh/harfbuzz/harfbuzz/149203
2020-07-22 17:23:22 +04:30
Ebrahim Byagowi 945bcd7230
minor 2020-07-15 09:54:32 +04:30
Ebrahim Byagowi fa0436ddd1
[ENOMEM][fuzzer/subset] early return if the result is null
I don't see _or_fail APIs idiomatic for the project but since it is there, let's have this
2020-07-15 09:52:40 +04:30
Ebrahim Byagowi 11d583a9ea
[aat] Consume glyph insertion from buffer's max_ops (#2223)
Glyph insertion is an expensive operation and we like to have it limited
based on buffer's input size which is handled by buffer's max_ops.

clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5754958982021120:

Before the change: 0.67s user 0.00s system 99% cpu 0.674 total
 After the change: 0.02s user 0.00s system 98% cpu 0.024 total

Which takes much longer on valgrind and tsan bots.
2020-07-13 18:53:06 -07:00
Ebrahim Byagowi cd6f62d960
[meson] Raise timeout value of subset fuzzer testcases
happens when tsan is enabled
2020-07-12 23:05:11 +04:30
Ebrahim Byagowi e4f9969108 [ci] migrate to meson
two bots, one bot here (distcheck) and one in travis still run autotools and
won't be removed till we decide about autotools
2020-07-08 19:18:31 +04:30
Ebrahim Byagowi e04050e3b8
[meson] split fuzzer_ldflags before use 2020-07-08 01:06:30 +04:30
Ebrahim Byagowi c5def34730 [meson] don't underscorify fuzzers names 2020-07-06 23:51:52 +04:30
Ebrahim Byagowi d608f2ac85 [meson] Add fuzzer_ldflags
As ots, https://github.com/khaledhosny/ots/commit/4d37b9b
2020-07-06 23:51:52 +04:30
Ebrahim Byagowi 694a0c6bbc [meson] Always add icu deps 2020-07-06 22:19:59 +04:30
Ebrahim Byagowi ba810ce83d [tests] Replace space with colon in batch mode 2020-07-06 13:53:19 +04:30
Ebrahim Byagowi 2013babcbf
[tests] Use HAVE_FREETYPE itself instead NO_FT_FUNCS 2020-07-06 11:57:45 +04:30
jfkthame 1e6027e29c
[aat] Correct array indexing when looking up actions in KerxSubTableFormat4 (#2539)
* [aat] Correct array indexing when looking up actions in KerxSubTableFormat4.

- For action_type 0 and 1, there are 2 values per action record; for action_type 2, there are 4. So we need to account for these factors when indexing into the ankrData array.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2531.
2020-07-05 22:44:10 +01:00
Ebrahim Byagowi aa732e454a
[tests] minor, ligcarets is fetched from gdef not gsub 2020-07-06 00:10:16 +04:30
Ebrahim Byagowi 122a2897e4 [aat] Remove lcar support
Very low use, only two distinct font files, Apple Chancery.ttf and Hoefler Text.ttc
have it so it really doesn't worth the size addition and so, but one may argue that
whole ligature caret is low use but guess we better to encourage GDEF one anyway.
2020-07-06 00:05:36 +04:30
Ebrahim Byagowi a3b9b94b63
[style] Remove fdsc support (#2541)
It isn't exposed yet and low use between Apple fonts,
32 fdsc table vs 767 OS/2 tables, even Apple doesn't
support it anymore per Ned.
2020-07-06 00:05:21 +04:30
Ebrahim Byagowi a470b0b205 Minor, disable strict-aliasing warning in set fuzzer
../test/fuzzing/hb-set-fuzzer.cc: In function ‘int LLVMFuzzerTestOneInput(const uint8_t*, size_t)’:
../test/fuzzing/hb-set-fuzzer.cc:38:82: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   38 |   const instructions_t &instructions = reinterpret_cast<const instructions_t &> (data);
      |

And it is already disabled at project level so let's disable it here also.
2020-07-05 10:49:10 +04:30
Ebrahim Byagowi 4db1b4f1a2 [tests] rename no_ft_funcs to NO_FT_FUNCS 2020-07-04 16:21:21 +04:30
Ebrahim Byagowi a07672d353 [py] minor, replace os.environ.get with os.getenv 2020-07-04 16:16:15 +04:30