Commit Graph

217 Commits

Author SHA1 Message Date
Behdad Esfahbod 25dee60977 [sanitize] Revert some from c68a00b92e
That overflow check was already happening in arrayZ.sanitize().
2021-07-28 13:58:24 -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 03cd9c5cba Align lfind() API to match bfind() 2021-07-22 11:38:27 -07:00
Garret Rieger 6269866bdd [subset] Keep bimap consistent if only one of the internal maps is in error. 2021-07-19 13:42:00 -06:00
Garret Rieger 48edbef96f [subset] bail if region_map is in error.
Fixes fuzzer case https://oss-fuzz.com/testcase-detail/5499162606043136.
2021-07-19 13:42:00 -06: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
Garret Rieger be50779cda [subset] correct ClassDef format determination.
It was possible for glyph_min to be a glyph mapped to class zero which threw off the number of glyph calculation.
2021-04-30 14:46:57 -06:00
Qunxin Liu 84dbfacfec [subset] fix collect_variation_idx in PairPosFormat2 2021-04-23 18:52:24 -07:00
Garret Rieger 596f4258d0 [subset] copy Lookup::markFilteringSet when subseting. 2021-04-02 15:33:52 -06:00
Behdad Esfahbod 092094f705 Use as_array() and range loops in a few places 2021-04-01 16:02:54 -06:00
Garret Rieger 55e7f3fe32 [subset] Match FeatureVariationRecord dropping from fontTools.
Only drop records with no matching features that are at the end of the list. See: cab7d13dc0
2021-04-01 15:26:02 -06:00
Garret Rieger f0c78e0282 [subset] don't drop features referenced in a feature variation substitution. 2021-04-01 15:26:02 -06:00
Garret Rieger dae99b7769 [subset] don't keep FeatureVariationRecord's with no subsittutions. 2021-04-01 15:26:02 -06:00
Behdad Esfahbod 4dba749d83 Add SortedArray{16,32}Of<> 2021-03-31 16:09:39 -06:00
Behdad Esfahbod 5639e253f9 Add Array16Of<> 2021-03-31 16:04:43 -06:00
Behdad Esfahbod 2520a82df9 s/LArrayOf/Array32Of/g 2021-03-31 15:41:54 -06:00
Behdad Esfahbod 5efe360986 Rename (Unsized)OffsetListOf 2021-03-31 15:33:22 -06:00
Behdad Esfahbod 6c4e0491d7 s/OffsetArrayOf/Array16OfOffset16To/g 2021-03-31 15:31:32 -06:00
Behdad Esfahbod 2a54c9f744 . 2021-03-31 15:26:42 -06:00
Behdad Esfahbod ad28f973f3 Rename offset types to be explicit about their size
Add Offset16To<>, Offset24To<>, and Offset32To<> for most use-cases.
2021-03-31 13:00:07 -06:00
Behdad Esfahbod bd2950b393 Make VariationStore::get_delta(outer, inner) private 2021-03-31 11:36:36 -06:00
Behdad Esfahbod 934675a429 Use VarIdx in VariationDevice 2021-03-31 11:34:41 -06:00
Behdad Esfahbod 9ed5f04a70 [subset] Simplify recent out-of-memory fixes
By checking return status of map->set().
2021-03-29 18:14:30 -06:00
Garret Rieger 8741914a80 [subset] fix memory leak when map insert fails. 2021-03-29 18:02:32 -06: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
Qunxin Liu 0e1c0fa404 [subset] optimize glyph closure method: step 5
add testcase and some fixes
2021-03-17 15:22:07 -06:00
Qunxin Liu 62423504ee [subset] optimize glyph closure method: step 3
Add function intersects_coverage_glyphs that collects
set of matching glyphs in Coverage table
2021-03-17 15:22:07 -06:00
Qunxin Liu ef78d0f923 [subset] optimize glyph closure method: step 2
Add function intersects_class_glyphs that collects
set of glyphs matching class in ClassDef table
2021-03-17 15:22:07 -06:00
Garret Rieger 2df39bcae7 [subset] don't allocate a set to use as a glyph filter for PairPosFormat2. 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
Behdad Esfahbod 3622120fab [subset] Make ClassDef format2 .intersects() return false if range value 0
We treat Class0 as "doesn't intersect".  That's the only meaningful
interpretation. If one allos Class0 to mean "intersects", then the
intersects() result should be true iff glyphset is non-empty.

Related to https://github.com/harfbuzz/harfbuzz/issues/2703
2021-03-10 12:21:43 -07:00
Behdad Esfahbod 6c4bb60829 Fix narrowing errors with recent changes 2021-02-22 23:05:55 -07:00
Behdad Esfahbod f4f35a4d5f [constexpr] Use initializer instead of assignment 2021-02-22 22:32:42 -07: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 ca0b7afee9 [set] Use hb_fill() 2021-01-21 12:22:00 -07:00
Behdad Esfahbod 6463ee02d6 Speed up ClassDef/Coverage intersect methods
Just avoiding overhead as measured by Garret.
Should rewrite as dagger in the future and confirm that it has the
same benefits. Later on, rewrite as lfind() maybe.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2826
2021-01-21 11:16:04 -08:00
Garret Rieger e583505334 [subset] Use plan->glyphset_gsub instead of plan->glyphset for GSUB/GPOS
This matches fontTools behaviour. glyphset_gsub does not contain gids added from closing over composite glyphs in glyf, since these cannot particpate in GSUB/GPOS processing.
2020-09-29 11:16: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
Ebrahim Byagowi 5a7cc7fd8b minor spacing tweak 2020-07-29 08:33:38 +04:30
Ebrahim Byagowi d0e2addd43 minor 2020-07-18 22:16:02 +04:30
Ebrahim Byagowi a6fb8ce98a Minor, fix -Wrange-loop-analysis warnings
Fixing these complains raised by newer versions of clang,

./hb-ot-layout-common.hh:1720:53: error: loop variable 'gid_klass_pair' is always a copy because the range of type 'hb_map_iter_t<hb_sorted_array_t<OT::HBGlyphID>, (lambda at ./hb-ot-layout-common.hh:1672:29), hb_function_sortedness_t::RETAINS_SORTING, nullptr>' does not return a reference [-Werror,-Wrange-loop-analysis]
    for (const hb_pair_t<hb_codepoint_t, unsigned>& gid_klass_pair : + it)

And

./hb-ot-color-colr-table.hh:177:44: error: loop variable '_' is always a copy because the range of type 'hb_map_iter_t<hb_filter_iter_t<hb_map_iter_t<hb_range_iter_t<unsigned int, unsigned int>, (lambda at ./hb-ot-color-colr-table.hh:209:31), hb_function_sortedness_t::RETAINS_SORTING, nullptr>, (anonymous struct at ./hb-algs.hh:331:1) &, (anonymous struct at ./hb-algs.hh:51:1) &, nullptr>, (anonymous struct at ./hb-algs.hh:338:1) &, hb_function_sortedness_t::RETAINS_SORTING, nullptr>' does not return a reference [-Werror,-Wrange-loop-analysis]
    for (const hb_item_type<BaseIterator>& _ : + base_it.iter ())
2020-07-05 11:18:04 +04:30
Ebrahim Byagowi d38eb49f46 Move the iteration logic to FeatureParamsCharacterVariants
Hopefully I can make members protected also.
2020-06-19 23:46:49 +04:30
Ebrahim Byagowi 407bba3e0d minor
move FeatureParamsCharacterVariants::sanitize method right above members
2020-06-19 23:12:56 +04:30
Behdad Esfahbod 1535440b48 [dispatch] Fix debug builds 2020-06-19 08:32:57 -07:00
Behdad Esfahbod 6fbb59aba6 Use daggers in a few get_array functions
As I review https://github.com/harfbuzz/harfbuzz/pull/2471
2020-06-19 00:05:52 -07:00
Behdad Esfahbod 70d6696cc6 [dispatch] Don't require debug_depth for untraced objects 2020-06-18 17:09:39 -07:00
Behdad Esfahbod 25aec0265c [dispatch] Default return type to hb_empty_t 2020-06-18 16:58:01 -07:00
Behdad Esfahbod 8d0a90ac1b [dispatch] Default debug level to 0 2020-06-18 16:53:54 -07:00
Behdad Esfahbod e47a2ab8f8 Remove unused dispatcher names 2020-06-18 16:48:07 -07:00
Qunxin Liu d7c012a08e [subset] GDEF Variation Store: step 2
do subset based on variation indices collected in step 1
2020-05-21 12:43:24 -07:00