Commit Graph

334 Commits

Author SHA1 Message Date
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 553ffaf682 [subset] fix for fuzzer testcase: https://oss-fuzz.com/testcase-detail/6382598554255360
avoid writing to null pointer
2021-04-08 09:54:48 -06:00
Garret Rieger 6f98a8ed46 [subset] Anchor should only use format 1 when hints are dropped.
Refactor Anchor to have a subset method instead of copy. This also allows
use to use serialize_subset in several places which simplifies calculating
offset bases.
2021-04-06 11:50:44 -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 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 b14475d2ae [subset] further changes to serializer error handling.
- Rename enum type and enum members.
- in_errors() now returns true for any error having been set. hb-subset now looks for offset overflow only errors to divert to repacker.
- Added INT_OVERFLOW and ARRAY_OVERFLOW enum values.
2021-03-18 10:51:26 -07:00
Garret Rieger 73ed59f7a6 [subset] store errors in the serializer as a flag set.
Make check_assign/check_equal specify the type of error to set.
2021-03-17 15:58:34 -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 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 bb54e1047d [subset] Also filter class1 by coverage when collecting variation indices 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 103ed7da83 [subset] Use dagger
Better fix for https://github.com/harfbuzz/harfbuzz/pull/2858
2021-02-19 16:48:30 -07:00
Garret Rieger 5ca353a2d0 [subset] fix heap buffer overflow found by fuzzer. 2021-02-16 12:43:02 -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
Garret Rieger 1d9801e012 [subset] In AnchorMatrix::subset eliminate the use of dynamically allocated vector. 2020-10-05 14:43:29 -07:00
Garret Rieger 093909b2ff [subset] Fix wrong offset base for subsetting LigatureArray.
Offsets from LigatureArray must be relative to the beginning of the LigatureArray table. For the serialization mechanism to use the correct beginning point the LigatureArray must be created using the push()/pop() mechanism. So convert LigatureArray subsetting to use serialize_subset() instead of a manually called serialize and subset.
2020-10-05 13:14:53 -07:00
Garret Rieger 147e93b910 [subset] Fixes to get GPOS 5 subsetting code compiling. 2020-10-01 16:45:57 -07:00
Qunxin Liu 3a0b05faf1 [subset] GPOS 5 MarkToLigature subsetting support 2020-10-01 15:59:16 -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
Behdad Esfahbod fce64a407d Minor 2020-08-08 14:05:03 -06: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
Behdad Esfahbod 9ef9ac3749 [gpos] Break cycle-of-2 when cursive attaching
Fix thinko this time around.

Fixes https://github.com/harfbuzz/harfbuzz/issues/2469
2020-06-17 22:59:10 -07:00
Behdad Esfahbod 3fe7195713 Revert "[gpos] Break cycle-of-2 when cursive attaching"
This reverts commit 7090707de6.
2020-06-17 17:51:08 -07:00
Behdad Esfahbod 7090707de6 [gpos] Break cycle-of-2 when cursive attaching
Fixes https://github.com/harfbuzz/harfbuzz/issues/2469
2020-06-17 17:41:48 -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 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
Behdad Esfahbod 5cf53c06e6 Rename add_coverage to collect_coverage 2020-04-24 08:16:03 -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 c8cc1e378d fix issues in ClassDefFormat1 serialize:
glyph ids in Iterator may be non-consecutive,
so the number in classValue might be larger than length of the Iterator
2020-04-03 12:31:48 -07:00
Garret Rieger 2f556c38c0 [subset] Fix crash when serializer runs out of room during gpos subsetting. 2020-03-14 00:55:47 +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
Qunxin Liu eb7849a806 [subset] GPOS6 MarkToMark subsetting support 2020-02-06 10:46:05 -08:00
Qunxin Liu 82afc75835 [subset] GPOS4 MarkBase subsetting support 2020-02-06 10:46:05 -08:00
ariza 1ab3924b31 refix PR #2087 subset PairPos1
also added oss-fuzz 20211 data fixed by this
2020-01-23 10:50:52 -08:00
ariza 72cbfb9059 remove empty lookup subtables
Added a variant of subset_offset_array which takes an extra arg passed to serialize_subset for this impl.
Added a new api test "test-subset-gpos" for this.
2020-01-21 16:53:19 -08:00
Michiharu Ariza c828d7bf76
[subset] fixed GPOS device table sanitize & serialize (#2087) 2020-01-15 15:32:44 -08:00
Qunxin Liu e565d1f9bc [subset] subset lookup/feature/script lists for GSUB/GPOS 2020-01-15 14:04:33 -08:00
Qunxin Liu 0b39c48064 [subset] closure lookups for GSUB/GPOS 2020-01-10 13:11:06 -08:00
Behdad Esfahbod a061e47fcc Change a few HB_INTERNAL static methods to static inline 2019-12-10 13:31:50 -06:00
Behdad Esfahbod dd3972a364 [GSUB] Simplify Extension is_reverse()
We don't allow extension lookups to chain to another extension lookup.
Simplify code for that.
2019-12-10 13:28:39 -06:00
Behdad Esfahbod 858b627984 [machinery] Remove CastR<>() 2019-12-10 13:18:32 -06:00
Behdad Esfahbod b84ceb2fcf [machinery] Remove CastP 2019-12-10 13:02:48 -06:00
Behdad Esfahbod 39afe608b4 [algs] Fold one more custom bsearch() in
One more to go.
2019-12-10 12:13:40 -06:00
Ebrahim Byagowi 486754a888 [serialize] Extract iterable copy, copy_all 2019-10-31 13:31:11 -07:00
Qunxin Liu defe9b6da0 crash fix : Heap-buffer-overflow READ 2
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18513
2019-10-25 13:09:47 -07:00
Qunxin Liu 1f0a9d9be9 [subset] GPOS Lookup Type 2: PairPos 2019-10-21 12:35:28 -07:00
Ebrahim Byagowi 0558413f27 Minor, tweak spaces 2019-10-01 13:50:11 +03:30
Qunxin Liu b0c3eb06b6 [subset] GPOS Lookup Type 3: CursivePos 2019-09-25 05:43:25 +09:00
Ebrahim Byagowi 68d39ea486 Revert previous change and fix -Wrange-loop-analysis complains 2019-09-24 13:52:46 +03:30
Ebrahim Byagowi cbc0646a6c Minor, normalize for each calls 2019-09-24 12:09:20 +03:30
Ebrahim Byagowi f0a7677993
[gpos] minor 2019-09-23 21:09:39 +03:30
Ebrahim Byagowi c1a585fab0 [gpos] minor 2019-09-21 23:36:29 +04:30
Ebrahim Byagowi d87d38998a Fix clang -Wrange-loop-analysis complains
./hb-ot-layout-gpos-table.hh:674:43: error: loop variable '_' is always a copy because the range of type 'hb_zip_iter_t<hb_iter_type<hb_array_t<const OT::IntType<unsigned short, 2> > &>, hb_iter_type<hb_array_t<const OT::IntType<unsigned short, 2> > &> >' (aka 'hb_zip_iter_t<hb_array_t<const OT::IntType<unsigned short, 2> >, hb_array_t<const OT::IntType<unsigned short, 2> > >') does not return a reference [-Werror,-Wrange-loop-analysis]
      for (const hb_pair_t<Value, Value>& _ : hb_zip (val_iter, first_val_iter))
                                          ^
./hb-ot-layout-gpos-table.hh:674:12: note: use non-reference type 'hb_pair_t<OT::Value, OT::Value>' (aka 'hb_pair_t<IntType<unsigned short, 2>, IntType<unsigned short, 2> >')
      for (const hb_pair_t<Value, Value>& _ : hb_zip (val_iter, first_val_iter))

and

In file included from hb-subset.cc:44:
./hb-ot-vorg-table.hh:87:34: error: loop variable '_' is always a copy because the range of type 'hb_map_iter_t<hb_filter_iter_t<hb_sorted_array_t<const OT::VertOriginMetric>, const hb_set_t *, OT::HBGlyphID OT::VertOriginMetric::*, nullptr>, (lambda at ./hb-ot-vorg-table.hh💯15), hb_function_sortedness_t::NOT_SORTED, nullptr>' does not return a reference [-Werror,-Wrange-loop-analysis]
    for (const VertOriginMetric& _ : it)
                                 ^
./hb-ot-vorg-table.hh:113:17: note: in instantiation of function template specialization 'OT::VORG::serialize<hb_map_iter_t<hb_filter_iter_t<hb_sorted_array_t<const OT::VertOriginMetric>, const hb_set_t *, OT::HBGlyphID OT::VertOriginMetric::*, nullptr>, (lambda at ./hb-ot-vorg-table.hh💯15), hb_function_sortedness_t::NOT_SORTED, nullptr>, nullptr>' requested here
    vorg_prime->serialize (c->serializer, it, defaultVertOriginY);
                ^
./hb-ot-vorg-table.hh:87:10: note: use non-reference type 'OT::VertOriginMetric'
    for (const VertOriginMetric& _ : it)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-09-21 17:52:01 +04:30
Ebrahim Byagowi 6e42a418c8 Minor, turn more of hb_apply to for each 2019-09-21 17:52:01 +04:30
Ebrahim Byagowi d512087e4d Rename GlyphID to HBGlyphID
Avoid collision with macOS's ATSUnicodeTypes.h GlyphID
2019-09-14 11:55:53 +04:30
Behdad Esfahbod 3c81246f66 [subset] Use newer iter tools in SinglePosFormat1 2019-09-04 11:28:40 -04:00
Behdad Esfahbod e0e0c8c109 Minor 2019-08-29 14:58:16 -07:00
Ebrahim Byagowi a0b4ac4dce Turn 8 spaces to tab across the project
According to the current code style of the project
2019-08-27 02:40:41 +04:30
Qunxin Liu 321d5588d4 [subset] Add subsetting for GPOS Lookup Type 1: Single Adjustment Positioning Subtable 2019-08-06 14:06:35 -07:00
Ali Javadi c184180228 Fix C++20 compile warning on implicit capture of this with '=' default capture (#1833)
Happens when compiled with -std=c++2a, the fix just makes the captures explicit to resolve the issue. Just adding this in addition to = doesn't work in C++11.

src/hb-ot-layout-gpos-table.hh:737:18: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
              { return (this+_).intersects (glyphs, valueFormat); })
                        ^
src/hb-ot-layout-gpos-table.hh:736:16: note: add an explicit capture of 'this' to capture '*this' by reference
    | hb_map ([=] (const OffsetTo<PairSet> &_)
               ^
                , this
2019-07-16 22:10:24 +04:30
Behdad Esfahbod 7dcf8e126e [config] Fix build with HB_NO_OT_LAYOUT 2019-06-26 13:44:23 -07:00
Behdad Esfahbod c8f529a07e [config] Add HB_NO_HINTING, enabled by HB_TINY
Disables HintingDevice tables and Anchors addressing contour points.

Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-06-19 19:33:15 -07:00
Behdad Esfahbod 78d35f0e78 Reduce captures of lambdas 2019-05-15 18:15:05 -07:00
Behdad Esfahbod dfc5780245 Fix more double-promotion errors
WHy do only some of the clang bots catch this I have no idea :(.
2019-05-07 23:26:09 -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 36bb24f7b4 [dispatch] Forward arguments in all dispatch multiplexers 2019-05-05 10:14:17 -07:00
Behdad Esfahbod b10f65933a [dispatch] Use functionality from previous commit
To remove a couple of unwanted wrapper methods
2019-05-05 09:23:35 -07:00
Behdad Esfahbod 88a4147240 [serializer] Accept exact type in serialize_subset/copy() 2019-05-02 14:22:31 -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 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 9d8c72042b Whitespace 2019-03-29 21:59:28 -07:00
Behdad Esfahbod f5ef8a7347 [iter] Port one more function to dagger 2019-03-29 21:57:17 -07:00
Behdad Esfahbod 090fe56dc6 Merge branch 'master' into iter 2019-01-25 16:06:52 +01:00
Behdad Esfahbod ef00654962 Convert tag enum class consts to static constexpr
Part of https://github.com/harfbuzz/harfbuzz/issues/1553
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 0d1fdf939d Use hb_zip() some mooore 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 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 f39b5603ff Comment 2019-01-17 17:50:01 -05:00
Behdad Esfahbod b9a51f5310 Minor 2018-12-21 15:05:00 -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 2cc993e035 [dispatch] Minor 2018-12-12 10:07:38 -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 5c4fead734 Convert "static const hb_tag_t" constants to enum 2018-11-29 15:05:47 -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
Ebrahim Byagowi 11aa0468ac [subset] minor, adjust spaces 2018-11-16 00:02:47 +03:30
Behdad Esfahbod e014405a21 Rename check_array(array, a, b) to check_range() 2018-11-12 14:23:31 -05:00
Behdad Esfahbod 1d66cdcf77 Better fix for MSVC 2008
Follow up on b4c6113032

Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-10 19:57:51 -05:00
Behdad Esfahbod 385f78b312 [aat] Remove deleted-glyhs after applying kerx/kern
Finally:  Fixes https://github.com/harfbuzz/harfbuzz/issues/1356

Test case:
$ ./hb-shape GeezaPro.ttc -u U+0628,U+064A,U+064E,U+0651,U+0629
[u0629.final.tehMarbuta=4+713|u064e_u0651.shaddaFatha=1@0,-200+0|u064a.medial.yeh=1+656|u0628.initial.beh=0+656]

The mark positioning (kern table CrossStream kerning) only works if deleted
glyph (as result of ligation) is still in stream and pushed through the
state machine.
2018-11-07 17:20:47 -05:00
Behdad Esfahbod 6ee6cd93d8 [GPOS] Only mark unsafe-to-break if kerning happened
Fixes https://github.com/harfbuzz/harfbuzz/issues/1365
2018-11-07 15:40:55 -05:00