Commit Graph

342 Commits

Author SHA1 Message Date
Behdad Esfahbod 044d7a06db [indic-like] Add per-lookup per-syllable flag
This allows mix-and-matching per-syllable and other lookups.
In fact, removes the clear-syllables call completely.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3513
2022-03-28 17:39:54 -06:00
Behdad Esfahbod e8f3397f4e [matcher] Simplify syllable initialization 2022-03-28 13:23:37 -06:00
Behdad Esfahbod ccd9161bfd [apply-lookup] Try to fix the logic for contextual lookups
Fixes https://github.com/harfbuzz/harfbuzz/issues/1611

Notably, this fixes Myles's AdditionFont:
https://litherum.blogspot.com/2019/03/addition-font.html

Test with AdditionFont, eg.:
$ util/hb-view AdditionFont.otf =1112112+1113134=
2022-03-25 15:14:40 -06:00
Behdad Esfahbod bf2a845a17 [ot-layout] Comment 2022-03-24 13:09:53 -06:00
Garret Rieger 4e2f409bce [subset] Don't hold references to members of the active_glyph_stack.
These references may get invalidated after the vector for the stack is resized. Fixes: https://oss-fuzz.com/testcase-detail/5422577634377728
2022-01-31 22:58:53 +02:00
Garret Rieger bc899650c7 [subset] Fix for issue #3397.
cur_intersected_glyphs gets modified during recursion leading to incorrect filtering of sub tables in some cases. So don't use cur_intersected_glyphs. Instead just add an additional entry onto the parent_active_glyphs () stack.

Additionaly expands NotoNastaliqUrdu tests to include coverage of the issue from #3397.
2022-01-28 14:20:33 -08:00
Garret Rieger f3c1f4f0da [subset] convert active_glyphs_stack to be a vector of hb_set_t instead of hb_set_t*. 2022-01-28 14:20:33 -08:00
Behdad Esfahbod 60006d3687 [gsubgpos] Adjust chaining unsafe-to-concat application
Fixes three tests.
2022-01-22 11:53:18 -07:00
Behdad Esfahbod 78481b32c0 [gsubgpos] Combine input/backtrack/lookahead unsafe-to-concat
I feel like this is correct logic. Still have to prove.

Errors unchanged at 10.
2022-01-22 11:53:18 -07:00
Behdad Esfahbod 3122c2cdc4 [buffer] Add HB_GLYPH_FLAG_UNSAFE_TO_CONCAT
Fixes https://github.com/harfbuzz/harfbuzz/issues/1463
2022-01-22 11:53:18 -07:00
Behdad Esfahbod ac1bb3e39e [machinery] Move accelerators to constructor/destructor 2022-01-20 12:10:05 -07:00
Behdad Esfahbod e062376ef1 [machinery] Make accelerator lazy-loader call Xinit/Xfini
Instead of init/fini. To isolate those functions. To be turned into
constructor/destructors, ideally one per commit (after some SFINAE
foo.)
2022-01-19 17:09:34 -07:00
Behdad Esfahbod c8195dbc01
Merge pull request #3365 from harfbuzz/gdef-fix
GDEF fix
2022-01-19 06:56:05 -08:00
Behdad Esfahbod 5a91db1135 [map] Remove constexpr invalid items
These were non-workable in the general case, eg std::string.
2022-01-13 12:44:48 -07:00
Behdad Esfahbod fa12f1ae25 Rename method 2022-01-12 15:08:34 -07:00
Behdad Esfahbod 9408e0d6d1 Rename variable 2022-01-12 15:07:34 -07:00
Behdad Esfahbod 96c969c820 Preserve glyph props 2022-01-12 15:06:40 -07:00
Garret Rieger 77507a1d8d [subset] Don't double count visit lookups in closure_lookups
Each recursed lookup was getting counted once in closure_lookups() and then again in hb_closure_lookups_context_t::recurse.
2021-12-10 15:13:49 -07:00
Garret Rieger d67025705f [subset] reset the visited lookup count before each closure iteration. 2021-12-10 15:13:49 -07:00
Qunxin Liu 706014f69d [subset] (Chain)ContextSubst glyph_closure fix
- When pos_glyphs is empty, use current full glyphs set as input for
subsequent recursive closure process
- Also increase max_lookup_visit_count to 35000 cause a real font file hit
previous limit 20000 and some lookups are dropped unexpectedly
2021-12-10 11:08:36 -07:00
Behdad Esfahbod 98fefd5ded
Merge pull request #3301 from harfbuzz/hashmap-classes
Hashmap classes
2021-11-19 13:34:53 -07:00
Qunxin Liu ca418cac74 [subset] keep features that have FeatureParams and the tag is "size" 2021-11-19 13:31:25 -07:00
Qunxin Liu e88fc41ef3 [subset] inputSequence could be empty, change the sanity check 2021-11-19 12:57:43 -07:00
Behdad Esfahbod 394f772937 [map] Allow storing classes in the hashmap
Fixes https://github.com/harfbuzz/harfbuzz/issues/3293

The trick was to change the type of the invalid key/value to be non-class.
2021-11-19 11:49:23 -07:00
Garret Rieger f51b48c8e7 [subset] Fix fuzzer found memory leak.
Happens because an insert into a map with an invalid key reports successful, but this causes the set being inserted to be lost.
2021-11-02 17:00:07 -07:00
Qunxin Liu 540f19b6fe [subset] fix bug in (Chain)ContextFormat2
Only keep rulesets for glyphs class numbers that survived in coverage
2021-11-02 16:05:55 -07:00
Qunxin Liu 364b6b3989 [subset] Don't assume FeatureList is sorted
Though the spec said FeatureRecords are sorted alphabetically by feature
tag, there're font files with unsorted FeatureList. And harfbuzz is not
able to subset these files correctly because we use binary search in
finding featureRecords when collecting lookups. Also
find_duplicate_features needs to be updated to handle this.
2021-11-02 15:15:02 -07:00
Behdad Esfahbod 6d555ce82e [meta] Use std::forward instead of hb_forward() 2021-11-02 00:18:22 -06:00
Qunxin Liu 36ed56b6e8 [subset] code cleanup
- rename copy() method if it takes extra parameter
- get rid of same code blocks
2021-10-09 13:37:20 -06:00
Garret Rieger c2cc566c9d [subset] Fix subset_offset_array adding unused space to serializer.
ArrayOf.serialize_append allocates space for the new item, but ArrayOf.pop() does not recover the allocated space. So in the case where the revert path was entered the extra space added by serialize_append gets left in the serialization buffer. This moves the snapshot to before ArrayOf.serialize_append is called so that revert cleans up the buffer extend.
2021-09-22 16:07:18 -06:00
Qunxin Liu 8c5c81746d [subset] fix find_duplicate_features
We should check each feature against all other features with the same
tag for duplicates.
2021-09-22 15:35:38 -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
Behdad Esfahbod fad452bffb [set] Move main functionality into hb_bit_set_t
To add inversion on top in hb_invertible_set_t and use that as hb_set_t.
2021-08-17 10:47:18 -06:00
Behdad Esfahbod 30579f5a37 [set] Document & use open-ended del_range() 2021-07-29 11:19:13 -06:00
Behdad Esfahbod 2337f0d047 Internally use hb_malloc/.../hb_free instead of malloc/.../free
Redefining those stock names as macros was conflicting with gcc 10
headers.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07:00
Garret Rieger 085aa65e09 [subset] Convert offset serialization in gsubgpos and gdef to serialize_serialize(). 2021-06-14 16:47:45 -07:00
Behdad Esfahbod bc33b87f5e [set] Use references, not pointers, in internal C++ API 2021-06-09 11:54:12 -06:00
Garret Rieger 8b686afeb5 [subset] add unlikely(). 2021-04-06 12:34:44 -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 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 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
Behdad Esfahbod 5639e253f9 Add Array16Of<> 2021-03-31 16:04:43 -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 9b4b58493b Fixup for recent OffsetTo<> changes 2021-03-31 13:27:21 -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
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 9f77a0c1ff [subset] use hb_set_clear to avoid calling clear() on null pool set. 2021-03-30 15:12:52 -06:00
Garret Rieger 752e393ad2 [subset] avoid calling clear on null pool set. 2021-03-30 15:12:52 -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 52df6b9fd8 [subset] check for set insertion success. 2021-03-29 17:41:07 -06:00
Garret Rieger c6adb90a27 [subset] fix nullptr deref. 2021-03-29 17:41:07 -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 b8a58a0c0b [subset] optimize glyph closure method: step 4
optimize recurse_lookups in Context/ChainContext
glyph closure, only the glyphs that the parent lookup
can apply the recursion to can participate in recursing
the lookup.
2021-03-17 15:22:07 -06:00
Qunxin Liu b4fc593c3c [subset] optimize glyph closure method: step1
Previous GSUB glyph closure is done by recursively visiting
all reachable lookup tables that apply to any glyphs in the
current/input glyph set, but actually only the glyphs that
the parent lookup can apply the recursion to can participate
in recursing the lookup. This is step 1 for glyph closure
optimization:
1. Add stack of currently active glyph set pointers into hb_closure_context_t
2. Update closure() method in simple GSUB tables to use
this stack in order not to change current glyph set at different stages
of recursion
3. Add function may_have_non_1to1() to GSUB tables
2021-03-17 15:22:07 -06:00
Behdad Esfahbod 8450f43ae1 [buffer] HB_NODISCARD next_glyph() 2021-03-15 16:01:35 -06:00
Behdad Esfahbod 34a1204f10 [buffer] HB_NODISCARD output_glyph()
Also, generalize and use replace_glyphs() in morx where output_glyph() was used
in a loop.
2021-03-15 16:01:35 -06:00
Behdad Esfahbod cac6c86d2f [buffer] HB_NODISCARD move_to() 2021-03-15 13:56:46 -06:00
Behdad Esfahbod 3f1998a065 [buffer] HB_NODISCARD replace_glyph() 2021-03-15 13:33:44 -06:00
Behdad Esfahbod 2902529b92 [subset] Fix HB_TINY build
Fixes https://github.com/harfbuzz/harfbuzzjs/issues/34#issuecomment-789247723
2021-03-02 15:05:39 -07:00
Behdad Esfahbod 83b66bfb66 Another try to fix narrowing error
../src/hb-ot-layout-gsubgpos.hh: In instantiation of ‘void OT::ChainRule::serialize_array(hb_serialize_context_t*, OT::HBUINT16, Iterator) const [with Iterator = hb_map_iter_t<hb_array_t<const OT::IntType<short unsigned int> >, const hb_map_t*&, (hb_function_sortedness_t)0, 0>; typename hb_enable_if<hb_is_iterator_of<Lhs, typename Lhs::item_t>::value>::type* <anonymous> = 0; OT::HBUINT16 = OT::IntType<short unsigned int>]’:
../src/hb-ot-layout-gsubgpos.hh:2341:30:   required from here
../src/hb-ot-layout-gsubgpos.hh:2326:15: error: narrowing conversion of ‘(unsigned int)g’ from ‘unsigned int’ to ‘short unsigned int’ inside { } [-Werror=narrowing]
       c->copy (HBUINT16 {g});
       ~~~~~~~~^~~~~~~~~~~~~~

https://github.com/harfbuzz/harfbuzz/pull/2875
2021-02-23 13:04:38 -07:00
Behdad Esfahbod f4f35a4d5f [constexpr] Use initializer instead of assignment 2021-02-22 22:32:42 -07:00
Behdad Esfahbod 6d94194497 Use auto in range-for-loop more 2021-02-19 17:10:06 -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 dfa9d7acdc [minor] Use serializer->propagate_error() to simplify code 2021-02-11 11:19:51 -07:00
Behdad Esfahbod d7e2a51de2 [minor] Add unlikely() when checking for error 2021-02-11 10:55:03 -07:00
Behdad Esfahbod 1da75afbe8 [minor] Add unlikely() 2021-02-10 00:03:41 -07:00
Behdad Esfahbod 6e1afac64b [minor] Rename internal variable
To address review comment:
https://github.com/harfbuzz/harfbuzz/pull/2699#discussion_r573370781
2021-02-09 18:48:46 -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
Garret Rieger 8f47dd5779 [subset] don't set lookup visited in closure_lookups_context_t::recurse.
- Lookup::closure_lookups also checks if the lookups visited and sets the lookup to visited. If we set visited in 'recurse' then Lookup::closure_lookups will fail to recurse into the children of the lookup.
- Also when copying ChainRule's skip LookupRecord's that point to lookups which aren't retained. This matches FontTool's behaviour.
2021-02-09 20:34:52 -05:00
Behdad Esfahbod 53806e5b83 Tiny improvement on previous commit
Functionally the same.
2020-11-25 11:51:37 -07:00
Dominik Röttsches a5f6f869e8 Drop layout table if layout lookup accelerator allocation failed
If the table is kept, when the table is present but only the accelerator
allocation failed, then we run into nullptr dereferences downstream in
hb_ot_map_t::apply when trying to access proxy.accels[i].

To fix this, instead of only setting lookup_count of accelerator_t
itself, drop the whole table to avoid hb-ot-map construction assuming
that the lookups will work correctly despite accelerator allocation
having failed.

Fixes:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24490
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24490
2020-11-25 10:18:04 -08:00
Garret Rieger 718bf5aab3 [subset] only keep features reachable from script in the final subset.
Matches fontTools behaviour.
2020-09-29 13:16:01 -07: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 940e1c6f98 [subset] ChainContextFormat3 - don't subset glyph sequences.
The backtrack, input, and lookahead sequence must be matched in their entirety so these sequences should not be subset. If any of the coverage tables in a sequence subsets to empty then the whole subtable should be dropped since it's not possible for this lookup to be activated.
2020-09-28 17:22:01 -07:00
Garret Rieger e31c2690f8 [subset] remove unnecessary returns. 2020-09-28 16:51:25 -07:00
Garret Rieger ad241f9917 [subset] check that sub rules in ChainContextFormat 1 and 2 intersect the glyphs set before recursing during closure lookups. 2020-09-28 15:26:13 -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 a5c0ec7516 [subset] For [Chain]ContextFormat3 make sure the sub table intersects the retained glyphset before recursing to its lookups.
Otherwise the lookup closure will potentially pull in lookups which cannot be accessed via the retained glyph set.
2020-09-25 14:57:20 -07:00
Garret Rieger dc375559fd [subset] shrink the serialize buffer when pruning empty offsets in ChainContextFormat2.
Currently the code reduces the array length, but does not trim back the space allocated in the serializer for those empty offsets.
2020-09-25 13:08:46 -07:00
Garret Rieger 90eb1a40eb [subset] In ChainContextFormat3 don't skip subsetting if backtrack or lookahead are empty.
It's valid to have a ChainContextFormat3 with either an empty backtrack or lookahead. Only drop the lookup if the input sequence is empty.
2020-09-25 12:36:32 -07:00
Garret Rieger 8c3d4de796 [subset] Fix integer underflow in ContextFormat2. 2020-09-11 15:52:46 -07:00
Garret Rieger 1e4fe10b98 [ENOMEM] check for error in visited map during closure features. 2020-08-13 01:43:11 +04:30
Garret Rieger 9562239f05 [ENOMEM] check for error in lookup visited set. 2020-08-13 01:43:11 +04:30
Ebrahim Byagowi 9748ae7299 Revert "Reordering fails when GDEF table is absent #2140"
This reverts commit f4cd99f28e.

As requested in https://github.com/harfbuzz/harfbuzz/issues/2516#issuecomment-670969185
2020-08-11 22:51:48 +04:30
Garret Rieger 06dbb6acbb [ENOMEM] in GSUB ChainContext subsetting check maps for allocation errors. 2020-08-01 09:21:22 +04:30
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
Behdad Esfahbod 26111a11ad [dagger] Minor cleanup using hb_enumerate 2020-06-28 13:26:38 -07:00
Behdad Esfahbod 1535440b48 [dispatch] Fix debug builds 2020-06-19 08:32:57 -07:00
Behdad Esfahbod 70d6696cc6 [dispatch] Don't require debug_depth for untraced objects 2020-06-18 17:09:39 -07:00
Behdad Esfahbod dc492d7c8a [dispatch] Comment 2020-06-18 17:03:05 -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 d7d8604ec8 Remove excessive trace routes 2020-06-18 16:51:24 -07:00
Behdad Esfahbod e47a2ab8f8 Remove unused dispatcher names 2020-06-18 16:48:07 -07:00
Behdad Esfahbod b2a1acccd9 Simplify get_glyph_alternates() dispatcher
Trying to make it **very simple** to add a specialized dispatcher for
one API to be routed to just a few objects (one in this case).
2020-06-18 16:41:31 -07:00
Behdad Esfahbod ffe8d3f39d Use dispatch for get_glyph_alternates_t
First time we do this in a way that if target object doesn't have the matching
function we basically "ignore".  Risky but I feel like is the right decision
for this case.

I'm going to put back the template varargs and use those, which would make
the dispatcher be just that: "dispatcher", and wouldn't need to carry the
call context.  That would be a refreshing change I think.
2020-06-18 16:31:39 -07:00
Qunxin Liu 973c47f6c9 [subset] Move 2 experimental public api methods to be private methods in GSUB/GPOS.
2 methods are: hb_ot_layout_closure_lookups and hb_ot_layout_closure_features
2020-06-12 01:20:30 +04:30
Behdad Esfahbod 56719474c2 s/blacklist/blocklist/g 2020-06-05 12:57:23 -07:00
Qunxin Liu 593e58c842 [subset] ChainContext subsetting fix: add lookup index remapping 2020-05-27 16:58:15 -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
Qunxin Liu 8200e48ffc [subset] GDEF Variation Store: step 1
closure device variation indexes, create old->new variation idx mapping
and store them in subset-plan
2020-05-21 12:43:24 -07:00
Ebrahim Byagowi a79d0e405b
[subset] minor, use a better type in iteration
In file included from hb-ot-face.cc:34:
In file included from ./hb-ot-kern-table.hh:30:
In file included from ./hb-aat-layout-kerx-table.hh:31:
In file included from ./hb-kern.hh:32:
In file included from ./hb-ot-layout-gpos-table.hh:32:
./hb-ot-layout-gsubgpos.hh:1878:63: error: loop variable '_' binds to a temporary value produced by a range of type 'decltype((hb_forward<hb_filter_iter_factory_t<hb_map_t &, const (anonymous struct at ./hb-algs.hh:331:1) &>>(rhs)(hb_forward<hb_zip_iter_t<hb_iota_iter_t<unsigned int, unsigned int>, hb_array_t<const OT::OffsetTo<OT::RuleSet, OT::IntType<unsigned short, 2>, true>>>>(lhs))))' (aka 'hb_filter_iter_t<hb_zip_iter_t<hb_iota_iter_t<unsigned int, unsigned int>, hb_array_t<const OT::OffsetTo<OT::RuleSet, OT::IntType<unsigned short, 2>, true>>>, hb_map_t &, const (anonymous struct at ./hb-algs.hh:331:1) &>') [-Werror,-Wrange-loop-bind-reference]
    for (const hb_pair_t<unsigned, const OffsetTo<RuleSet>&>& _ : + hb_enumerate (ruleSet)
                                                              ^
./hb-ot-layout-gsubgpos.hh:1878:10: note: use non-reference type 'hb_pair_t<unsigned int, const OffsetTo<OT::RuleSet> &>'
    for (const hb_pair_t<unsigned, const OffsetTo<RuleSet>&>& _ : + hb_enumerate (ruleSet)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-05-21 07:32:58 +04:30
Qunxin Liu 8b5d3ebd96 [subset] GSUB5/GPOS7 Contextual Subst/Pos Subtbale Subsetting support 2020-05-20 15:12:54 -07:00
Qunxin Liu 44d88cff95 [subset] fix intersects () for Context/ChainContext tables
return true only when all values in array are intersected with input
2020-05-11 15:25:17 -07:00
Ebrahim Byagowi 08428a15c3 minor, spacing 2020-04-24 23:45:17 +04:30
Behdad Esfahbod 89ad3c6cc5 Rename add_class to collect_class 2020-04-24 08:16:03 -07:00
Behdad Esfahbod 5cf53c06e6 Rename add_coverage to collect_coverage 2020-04-24 08:16:03 -07:00
Ebrahim Byagowi 0c65a232fa
minor, add unlikely around lookup_limit_exceeded checks
addresses https://github.com/harfbuzz/harfbuzz/pull/2294#issuecomment-618022488
2020-04-23 11:23:54 +04:30
Behdad Esfahbod f4cd99f28e Reordering fails when GDEF table is absent #2140
Preserve glyph class if there's no GDEF and no guess.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2140
2020-04-22 14:45:57 -07:00
Ebrahim Byagowi 2dda6dd744 minor, tweak spacing
turn 8 spaces to tab, add space before Null/Crap
2020-04-20 16:18:29 +04:30
Qunxin Liu e0c3979af1 typo fix 2020-04-02 12:05:57 +04:30
Garret Rieger 014e038b2c [subset] Bail out of context lookup expansion once the lookup limit is encountered. 2020-04-01 11:14:41 +04:30
Ebrahim Byagowi 2e1bf61dd5 [gsubgpos] Use FeatureVariations::NOT_FOUND_INDEX instead Index::
As noted by https://github.com/harfbuzz/harfbuzz/issues/2280#issuecomment-604386389

Added on b143e34, fixed on 2571891

Closes #2280
2020-03-26 22:59:28 +04:30
Ebrahim Byagowi 25718913d4 [gsubgpos] minor build fix 2020-03-26 14:04:37 +04:30
Ebrahim Byagowi b143e34ee1 [gsubgpos] Initialize variation index on HB_NO_VAR
hb_shape_plan_key_t::equal expects hb_ot_shape_plan_key_t be initialized by
hb_ot_layout_table_find_feature_variations calls but it won't get initialized
when HB_NO_VAR build config is used.

Related to https://github.com/harfbuzz/harfbuzz/issues/2280
2020-03-26 12:06:12 +04:30
Ebrahim Byagowi 071e2e345f minor 2020-03-26 12:03:07 +04:30
Ebrahim Byagowi cc977b6e5c [gsubgpos] Minor simplification
Just changed the order, no functional change
2020-03-26 11:19:43 +04:30
Ebrahim Byagowi 1a48278511 [gsubgpos] Minor style improve 2020-03-26 11:15:09 +04:30
Garret Rieger 4ad686b9c0
[subset] fix fuzzer timeout in layout closure
Bail out of chain context lookup expansion once the lookup limit is encountered.
2020-03-26 06:32:28 +00:00
Garret Rieger 834a224a50
[subset] Put a limit on the number of lookup indices that can be visited during closures
Fixes https://crbug.com/oss-fuzz/21025
2020-03-12 13:32:36 +03:30
Ebrahim Byagowi ba22df36ad minor
makes search for sanitize calls easier for me
2020-03-10 10:43:27 +03:30
Ebrahim Byagowi 07acd1a042 [subset] Rename src_base args to base to match sanitize methods
So it will become easier to follow that serialize methods signatures should
match with their sanitize methods counterparts.
2020-03-08 23:39:26 +03:30
ariza 188a0a47c2 removed default base; replaced w/ bias if required 2020-03-08 22:59:43 +03:30
Ebrahim Byagowi f745777c60 minor, debug bit, ops 2020-03-03 19:14:41 +03:30
Ebrahim Byagowi f253f06cf3 [fuzz] Add another fixed case
https://crbug.com/oss-fuzz/14626

another numerous subtables count which is fixed by d38360397
2020-03-03 19:12:04 +03:30
Garret Rieger 414529e45a [subset] Limit the number of feature indices processed during script subsetting. 2020-02-28 16:10:14 -08:00
Garret Rieger 75622b0d24 [subset] Limit the number of features processed in the feature closure. 2020-02-28 16:10:14 -08:00
Michiharu Ariza ff5223ba60
remove invalid glyphs from closure (#2188)
fix issue #2186
2020-02-23 15:53:21 -08:00
Qunxin Liu e565d1f9bc [subset] subset lookup/feature/script lists for GSUB/GPOS 2020-01-15 14:04:33 -08:00
Qunxin Liu 8ffc9add22 [subset] layout closure_features and store them in subset-plan 2020-01-14 07:24:48 +03:30
Qunxin Liu 0b39c48064 [subset] closure lookups for GSUB/GPOS 2020-01-10 13:11:06 -08:00
Ebrahim Byagowi ce114d6b27 minor, tweak spaces 2019-12-31 15:53:02 +03:30
Behdad Esfahbod a061e47fcc Change a few HB_INTERNAL static methods to static inline 2019-12-10 13:31:50 -06:00
Behdad Esfahbod 858b627984 [machinery] Remove CastR<>() 2019-12-10 13:18:32 -06:00
Ebrahim Byagowi 64a45be519
[ubsan] Don't decrease pointer if match_glyph_data is null (#2048)
Similar to fix on https://github.com/harfbuzz/harfbuzz/pull/2022

Fixes https://crbug.com/1023070
2019-11-09 12:25:33 +03:30
Ebrahim Byagowi aca6390281 [gpos] Don't move pointer when match_glyph_data is not set 2019-10-28 22:17:48 +03:30
Qunxin Liu b2fcca6e14 fuzzer crash fix
https://oss-fuzz.com/testcase-detail/5643107869917184
2019-10-24 16:11:30 -07:00
Garret Rieger 05bcdb39d8 Add a specialization of array_t:hash for hb_bytes_t and hb_ubytes_t. 2019-10-22 13:33:50 -07:00
Garret Rieger 95ab110cd9 Optimize intersects_array to fix fuzzer timeout. 2019-10-22 13:33:50 -07:00
Qunxin Liu b66094ada0 [subset] GSUB Lookup Type 6: ChainContextSubst 2019-10-18 16:52:55 -07:00
Behdad Esfahbod 7dcf8e126e [config] Fix build with HB_NO_OT_LAYOUT 2019-06-26 13:44:23 -07:00
Behdad Esfahbod 8e3cde67df Fix MSVC build
MSVC warning:

c:\projects\harfbuzz\src\hb-ot-layout-gsubgpos.hh(2732): error C2121: '#': invalid character: possibly the result of a macro expansion [C:\projects\harfbuzz\build\harfbuzz.vcxproj]

Clang warning for it:

./hb-ot-layout-gsubgpos.hh:2729:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
2019-06-19 19:59:26 -07:00
Behdad Esfahbod a849873124 [config] Add HB_NO_VAR to disable variations support, enabled by HB_TINY
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-06-19 19:26:22 -07:00
Behdad Esfahbod 1834cf86d4 [serialize] Pass offset to serialize_subset() 2019-05-31 14:39:32 -07:00
Behdad Esfahbod 9260441624 [serialize] Pass offset to serialize_copy() 2019-05-31 14:35:01 -07:00
Behdad Esfahbod 2376867649 Use hb_map(hb_add(this)) to dereference OffsetTo<>'s 2019-05-15 22:01:44 -07:00
Behdad Esfahbod 78d35f0e78 Reduce captures of lambdas 2019-05-15 18:15:05 -07:00