Commit Graph

300 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 501a364d9b [GPOS] Add TODO item 2018-11-07 15:02:16 -05:00
Behdad Esfahbod 33b006cc51 [ot-layout] Simplify some access 2018-11-05 23:19:04 -05:00
Behdad Esfahbod ca5e5a4979 Port Coverage::Iter off hb_auto_t<> 2018-10-29 22:30:21 -07:00
Behdad Esfahbod 39bd07aed5 Fix bunch of unused parameter warnings
Show up with gcc -O0.

There's a few more but those are functions that need to be filled in.

Maybe this is a lost battle...
2018-10-26 21:22:26 -07:00
Behdad Esfahbod 21ede867df Fix possible overflow in bsearch impls
From bungeman.

Fixes https://github.com/harfbuzz/harfbuzz/pull/1314
2018-10-25 13:19:58 -07:00
Bruce Mitchener 8d1e479d1d Use bool literals instead of 0/1. 2018-10-19 18:05:46 +02:00
Behdad Esfahbod 36f38ea703 [gpos] Protect mark attachment against out-of-bounds
Not sure how can happen, but does...
2018-10-16 16:24:03 -07:00
Behdad Esfahbod bf8469be9a Attach CursivePositioning backwards, not forward
This is how Uniscribe does it.  So, adjust.  This is only relevant
to fonts that apply cursive positioning from a contextual lookup.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1181
2018-10-11 20:45:40 -04:00
Behdad Esfahbod 1622ba5943 [kerx] Implement Format4 'ankr'-based mark attachment
Tested with Kannada MN:

$ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0CCD,0C95,0CD6
[kn_ka.vattu=0+230|kn_ai_length_mark=1@326,0+607]
2018-10-11 01:17:33 -04:00
Behdad Esfahbod dff2c45f1e Port rest from VAR to UnsizedArrayOf<> 2018-09-11 01:01:08 +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 339d3603b9 [subset] Wire up subset() call down to subtables 2018-09-03 17:40:16 -07:00
Behdad Esfahbod 7b2ef551da Templatize Lookup::sanitize() 2018-09-03 17:16:09 -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 7c9cfa2b40 Add intersects() method to GSUB/GPOS lookups 2018-09-02 19:47:50 -07:00
Behdad Esfahbod 3a0b3a29cc Free up hb-ot-face.hh from includes
There might be a better way to do this, but I couldn't find...
2018-08-26 15:11:24 -07:00
Behdad Esfahbod 3999094682 [OT] Use relaxed ops for recursing into GSUB/GPOS lookups again 2018-08-26 09:12:25 -07:00
Behdad Esfahbod c44b0caf0d Fixup 2018-08-26 01:29:30 -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 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
Behdad Esfahbod 1c6b369324 [ot] Rename hb_ot_layout_t to hb_ot_face_data_t 2018-08-23 11:30:21 -07:00
Behdad Esfahbod 0271c7ab3b [ot] Move GSUB/GPOS into tables_t 2018-08-03 16:45:57 -07:00
Behdad Esfahbod bddeb2b10c Minor renamings of internal inline functions 2018-07-10 14:13:21 +02:00
Behdad Esfahbod d3c0980ac2 Adjust MarkBasePos heuristic in presence of MultipleSubst
From the issue:
"In this font, the virama,ya first forms a ligature, then decomposes back to
virama,ya. This causes those two to be marked parts of a MultipleSubst
sequence. When attaching the matra, we look for the first of the MultipleSubst
sequence because that's where we attach to (because of eg #740). In this case,
the first glyph in the MultipleSubst sequence is a mark, so we skip it and
attach to the base char before it."

Font in question is Nirmala UI from Windows 10. Test sequence:

  U+0926,U+094D,U+092F,U+0941

Fixes https://github.com/harfbuzz/harfbuzz/issues/1020
2018-06-30 15:59:25 +04:30
Ebrahim Byagowi eaf649450a Resolve clang's conditional-uninitialize warnings 2018-04-23 11:38:45 -07:00
Ebrahim Byagowi a02c3ee70f Add or update tables specifications links 2018-04-12 13:44:32 +04:30
Behdad Esfahbod e347fb908b Minor 2018-02-26 01:08:50 -08:00
Behdad Esfahbod 1c50a88623 Readjust mark attachment heuristic a bit more
Previously adjusted logic could fail if nothing around was ligated,
and something moved.  This should take care of that.

CC https://github.com/harfbuzz/harfbuzz/issues/740
2018-02-18 15:58:09 -08:00
Behdad Esfahbod 978ace6fbb Improve _hb_popcount()
Support 128bit type.
2018-02-16 16:08:45 -08:00
Behdad Esfahbod 9b5af3ec7f [gpos] Adjust mark attachment heuristic
Hopefully it...
fixes https://github.com/harfbuzz/harfbuzz/issues/740
2018-02-10 21:50:44 -06:00
Behdad Esfahbod fd03449094 Rename hb_apply_context_t to hb_ot_apply_context_t 2018-01-19 16:40:13 -08:00
Behdad Esfahbod 188ee6e5ee Calculate anchor positions in float, then round
Hoping to reduce rounding error, to make tests happier...
No luck.
2018-01-10 05:13:47 +01:00