Commit Graph

342 Commits

Author SHA1 Message Date
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
Behdad Esfahbod d0df996cdc Use implicit lambda return type 2019-05-15 00:32:41 -07:00
Behdad Esfahbod 7df3ecfb40 [meta] hb_void_t -> hb_empty_t 2019-05-10 20:43:26 -07:00
Behdad Esfahbod 4d67743ffd [subset] Use more auto typing 2019-05-10 18:43:48 -07:00
Behdad Esfahbod 5d773ec600 Minor 2019-05-10 13:53:15 -07:00
Behdad Esfahbod ac737f8c9e Minor again 2019-05-10 13:51:12 -07:00
Behdad Esfahbod cd9bc732a7 [gsubgpos] Minor 2019-05-10 13:17:41 -07:00
Behdad Esfahbod 83e3eabd84 Whitespace 2019-05-07 20:58:43 -07:00
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Behdad Esfahbod e33ad25222 [serialize] FeatureVariations subset->copy 2019-05-07 15:46:24 -07:00
Behdad Esfahbod 36bb24f7b4 [dispatch] Forward arguments in all dispatch multiplexers 2019-05-05 10:14:17 -07:00
Behdad Esfahbod c14efb8e68 Fix previous commit
Priority should be given to specific over dispatch.  Broke sanitize before.
This fixes it, by moving prioritization to the context implementation, since
the correct priority cannot be done in the dispatch implementation.  Done
for subset and sanitize only, which need it.
2019-05-05 09:54:58 -07:00
Behdad Esfahbod ac350c92fd [dispatch] Try obj.dispatch(c) before trying c->dispatch(obj) 2019-05-05 09:10:46 -07:00
Ebrahim Byagowi 92588782d7
Remove space between right angle brackets now that we have C++11 (#1689) 2019-04-30 13:05:10 -07:00
Behdad Esfahbod 085793d6cd Remove wrong TODOs 2019-04-24 10:15:59 -04:00
Behdad Esfahbod 95df00aec1 Hide a few static methods
Looks like static methods that do not get inlined end up exported.
We have a lot more.  Need to protect all at some point.  Wish there
was an easier way, like the visibility flag we pass that automatically
hides all inline methods.

Was exposed by check-symbols.sh when compiling on OS X 10.14 with:

$ make CPPFLAGS=-Oz CXXFLAGS=-flto=thin LDFLAGS=-lc++
2019-04-12 17:51:14 -04:00
Behdad Esfahbod e530692799 [iter] Fix bug in hb_any() and hb_none() 2019-03-29 23:31:39 -07:00
Behdad Esfahbod f505b5d5c9 [iter] Port remaining "for (auto" instances to daggers 2019-03-29 22:55:02 -07:00
Behdad Esfahbod 668d2d562f [iter] One more dagger 2019-03-29 22:48:38 -07:00
Behdad Esfahbod 05f2130a1c [iter] More daggers 2019-03-29 22:43:12 -07:00
Behdad Esfahbod 22ec4c3aa5 [iter] More daggers 2019-03-29 22:29:00 -07:00
Behdad Esfahbod 90b60bd690 Remove HB_DEBUG_WOULD_APPLY
Not that useful.
2019-03-29 22:12:42 -07:00
Behdad Esfahbod 11456b2d9c WHitespace 2019-02-15 16:58:43 -08:00
Behdad Esfahbod b8b3b3e38b [iter] Add hb_enumerate() and use it 2019-02-15 16:05:36 -08:00
Behdad Esfahbod 5b99c92d4c [iter] Use more 2019-02-14 17:10:04 -08:00
Behdad Esfahbod 72c1b59588 [iter] Use in more places 2019-02-14 15:43:20 -08:00
Behdad Esfahbod 40cce41eae [iter] Use in a couple more intersects() calls 2019-02-14 15:14:37 -08:00
Behdad Esfahbod bafdf1829d [iter] Use in a couple more closure() calls 2019-02-14 15:13:16 -08:00
Behdad Esfahbod 090fe56dc6 Merge branch 'master' into iter 2019-01-25 16:06:52 +01:00
Behdad Esfahbod 3d9a6e6266 Whitespace 2019-01-22 12:17:26 +01:00
Behdad Esfahbod 934d3fa2a7 Use more iter pipelines 2019-01-20 20:12:12 -05:00
Behdad Esfahbod ede1a71b31 Minor rename 2019-01-20 20:12:12 -05:00
Behdad Esfahbod af6c190235 Use hb_zip() some moore 2019-01-20 20:12:12 -05:00
Behdad Esfahbod a46874f1ab [iter] Revert back uses of C++11 auto type deduction 2019-01-20 20:12:12 -05:00
Behdad Esfahbod d6024794fb Change hb_void_t implementation 2019-01-20 20:12:12 -05:00
Behdad Esfahbod e16884248f [iter] Port Coverage iterator to hb_iter_t 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 89bcfb204c Remove TRACE_COLLECT_GLYPHS 2019-01-18 14:59:18 -05:00
Behdad Esfahbod 0772c06f96 Remove tracing from closure 2019-01-18 12:53:47 -05:00
Behdad Esfahbod fa333e34d6 [vector] Remove static_array
Was good idea, but with C++ types with constructor/destructor, was getting in
the way as compiler was destructing those items where it was not desired.
Since C++ does not allow zero-sized arrays, just remove it...
2018-12-27 17:56:22 -05:00
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Behdad Esfahbod 1b6d0c44b3 [subset] Sketch GDEF subsetting 2018-12-13 18:10:48 -05:00
Behdad Esfahbod c78e4784fb [dispatch] Minor 2018-12-12 09:50:18 -05:00
Behdad Esfahbod fb05908213 Revert ugly fixes
Now that we have 6daf45e0, revert cryptic hacks...

This reverts commit abd81ed4f5.
This reverts commit 9c6921c08c.
This reverts commit d39760cabf.
This reverts commit fedd8e6c17.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-30 20:56:15 -05:00
Behdad Esfahbod 9c6921c08c More...
hb-ot-layout-gsubgpos.hh:1707: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
...
2018-11-30 15:16:57 -05:00
Behdad Esfahbod 574d888c8a [aat] Ignore GSUB table of Muthu Foundry if they have morx table
Fixes https://github.com/harfbuzz/harfbuzz/issues/1410
2018-11-25 16:51:22 -05:00
Behdad Esfahbod aa06574823 Minor 2018-11-16 14:31:05 -08:00
Ebrahim Byagowi 11aa0468ac [subset] minor, adjust spaces 2018-11-16 00:02:47 +03:30
Behdad Esfahbod da6aa3b033 Add hb_blob_ptr_t.destroy() 2018-11-11 11:40:57 -05:00
Behdad Esfahbod 5d0078a48b Add hb_blob_ptr_t
Use in a couple of places.  Push to bots to see how many unhappy before
I convert the rest.
2018-11-10 23:52:15 -05:00
Behdad Esfahbod 33b006cc51 [ot-layout] Simplify some access 2018-11-05 23:19:04 -05:00
Behdad Esfahbod 0b0b38ec1e Fix null accelerator's
Fixes all except for cmap.  To be done separately.

Part of https://github.com/harfbuzz/harfbuzz/issues/1146
2018-11-03 16:16:31 -04:00
Behdad Esfahbod 0382b7184a Use as_array in more places 2018-11-02 12:23:26 -04:00
Ebrahim Byagowi f7a08cd41d
Fix extra semicolon issues and test that on CI (#1330) 2018-10-30 11:29:09 +03:30
Behdad Esfahbod ca5e5a4979 Port Coverage::Iter off hb_auto_t<> 2018-10-29 22:30:21 -07:00
Behdad Esfahbod 3a4e5dd425 Remove a few unnecessary hb_auto_t<>'s
See a85641446c30247c4e948263f0f8c1147ed4efb9
2018-10-29 22:27:20 -07:00
Bruce Mitchener 5a24ea15e0 Make more 'coords' params const. 2018-10-19 19:15:42 -07:00
Bruce Mitchener 4594730f64 Remove redundant return at end of void-returning function. 2018-10-19 18:17:18 +02:00
Bruce Mitchener 257d0e5aa3 Fix typos. 2018-10-19 19:24:05 +03:30
Ebrahim Byagowi 63109432cf Cosmetic and minor changes 2018-10-13 07:23:33 -04:00
Behdad Esfahbod b3390990f5 Add per-subtable set-digests
This speeds up Roboto shaping by ~10%.  I was hoping for more.
Still, good defense against lookups with many subtables.
2018-10-10 12:13:25 -04:00
Behdad Esfahbod e78549edfb Move apply down into subtables accel 2018-10-10 11:54:48 -04:00
Behdad Esfahbod 78c09bf213 Move subtable array into lookup accel 2018-10-10 11:50:46 -04:00
Behdad Esfahbod 97e5913d5a Move more code 2018-10-10 11:41:05 -04:00
Behdad Esfahbod c8f2d9334c Move code
In preparation to move add per-subtable set digests...
2018-10-10 11:36:28 -04:00
Behdad Esfahbod 9efddb9de8 Treat a base+mark... ligature as base, not ligature
Fixes https://github.com/harfbuzz/harfbuzz/issues/746
2018-10-02 16:05:26 +02:00
Behdad Esfahbod 3cca978723 Move code around 2018-10-02 15:02:35 +02:00
Behdad Esfahbod d748dc7664 More iter inits 2018-09-24 18:30:50 -04:00
Behdad Esfahbod 3583fb03b1 Simplify ZWJ-skipping a bit
Towards disabling ZWJ-skipping in certain GPOS contexts.

Part of https://github.com/flutter/flutter/issues/16886
2018-09-23 22:33:38 -04:00
Behdad Esfahbod 9516cbd3df Reinit skippy iters when auto_zwj / auto_zwnj change
Ouch.  How did we not hit this bug before...
2018-09-23 22:00:34 -04:00
Behdad Esfahbod effc7ced72 Rename HeadlessArrayOf::len to lenP1
So it doesn't accidentally match our templates, etc.
2018-09-13 20:21:54 +02:00
Behdad Esfahbod cfdea88475 [random] Switch to 32bit RNG 2018-09-11 10:57:48 +02:00
Behdad Esfahbod 08260c708a [random] Shuffle 2018-09-11 10:51:19 +02:00
Behdad Esfahbod 71c9f84e7c Make --features rand=1 available to the user
Use rand=255 to mean "randomize".

Part of https://github.com/harfbuzz/harfbuzz/pull/803
2018-09-11 10:47:59 +02:00
Behdad Esfahbod 80de4bcd26 Minor clean up of 'rand' patchset 2018-09-11 10:47:59 +02:00
David Corbett b545e27d88 Don't seed the RNG from the contents of the buffer 2018-09-11 10:47:59 +02:00
David Corbett c2a75e07e5 Implement 'rand' 2018-09-11 10:47:59 +02:00
Behdad Esfahbod 9507b05a7a Simplify sanitize->check_array()
Fix a bug in CBDT sanitize, and redundant check in avar.
2018-09-10 23:18:23 +02:00
Behdad Esfahbod bc485a9812 Port some VAR arrays to UnsizedArrayOf<>
Fix avar sanitize().
2018-09-10 23:08:18 +02:00
Behdad Esfahbod 5dfd6e0762 Fix sanitize or Context Rule
Fixes https://github.com/harfbuzz/harfbuzz/issues/1110
2018-09-10 15:45:32 +02:00
Behdad Esfahbod 339d3603b9 [subset] Wire up subset() call down to subtables 2018-09-03 17:40:16 -07:00
Behdad Esfahbod 9c3747c5e5 [subset] More 2018-09-03 16:53:03 -07:00
Behdad Esfahbod 6d618522d6 Templatize GSUBGPOS::sanitize() 2018-09-03 16:41:28 -07:00
Behdad Esfahbod 49c44b58f6 [subset] Fix serialize_subset() calls
Ouch.
2018-09-03 16:37:17 -07:00
Behdad Esfahbod 7c9cfa2b40 Add intersects() method to GSUB/GPOS lookups 2018-09-02 19:47:50 -07:00
Behdad Esfahbod 61ce62e554 [subset] Minor
Remove Lookup::subset().
2018-09-02 17:00:39 -07:00
Behdad Esfahbod bfa72a9a72 [subset] Towards GSUB/GPOS subsetting
Add subset() call for GSUBGPOS struct and its dependencies.
Not hooked up anywhere.
2018-09-01 18:34:50 -07:00
Behdad Esfahbod 453e0c60b1 Add template keyword
I swear I have no idea why this is needed, but it is...
2018-08-26 01:30:52 -07:00
Behdad Esfahbod b929100f87 [ot-face] Unify GSUB/GPOS accelerators in the table accelerator framework 2018-08-26 01:15:47 -07:00
Behdad Esfahbod 963413fc54 WIP 2018-08-26 00:47:55 -07:00
Behdad Esfahbod 1c48a7ef06 [ot-font] Cache tables on face, not font 2018-08-25 23:57:16 -07:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00