Commit Graph

367 Commits

Author SHA1 Message Date
Behdad Esfahbod 1f4d8ccaed [CoverageFormat2] Optimize intersects() 2022-12-03 13:17:15 -07:00
Behdad Esfahbod c482b06108 [gpos] Optimize PairPosFormat1::intersects 2022-12-03 13:14:31 -07:00
Behdad Esfahbod 4d19c724c0 [CoverageFormat1] Speed up intersects()
Speeds up SourceHanSerif/10000 benchmark (not in test suite) by
32%!
2022-12-03 09:57:29 -07:00
Behdad Esfahbod 2a7a1d5a73 [Coverage] Avoid timeout on broken ranges
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53929
2022-12-02 12:33:24 -07:00
Behdad Esfahbod 72fabef0a4 [SingleSubstFormat2] Speed up closure 2022-11-30 11:37:49 -07:00
Behdad Esfahbod d2a2670e54 [iter] Simplify has() interface implementations 2022-11-28 19:43:09 -07:00
Behdad Esfahbod 3e151139a8 [PairPos] Optimize get_effective_value_format
Speeds up BM_subset/subset_glyphs/SourceHanSans-Regular_subset.otf/nohinting/512
12%.
2022-11-28 14:23:49 -07:00
Behdad Esfahbod 26ad7a6022 [gpos] Minor micro-optimize 2022-11-28 14:12:52 -07:00
Behdad Esfahbod c769d7e181 [gpos] Whitespace 2022-11-28 14:03:58 -07:00
Behdad Esfahbod e3cc61838f [PairPos] Adjust kerning buffer messages 2022-11-26 13:58:04 -07:00
Behdad Esfahbod 6aaa16627c [Coverage] Comment 2022-11-24 14:58:42 -07:00
Behdad Esfahbod 6f133ccfde [glyf] Fix build with HB_NO_VERTICAL 2022-11-24 12:59:55 -07:00
Behdad Esfahbod 05aa084e67 [PairPos] Another attempt at fixing unsafe-to-break with ValueFormat2
Fixes https://github.com/harfbuzz/harfbuzz/issues/3888#issuecomment-1326781116

Test:
$ hb-shape XBRoya34.ttf  ' الأ' --show-flags --script=arab
2022-11-24 12:14:09 -07:00
Garret Rieger 81640fdffe [subset] fix leaked font in glyf::subset(...) 2022-11-23 13:41:52 -07:00
Behdad Esfahbod 1e8f1ac677 [subset-glyf] Micro-optimize array access 2022-11-23 13:20:48 -07:00
Behdad Esfahbod 356d135ed6 [subset-glyf] Reduce roundf calls
Saves 7% on MPLUS1-Variable/6000 benchmark.
2022-11-23 13:20:48 -07:00
Garret Rieger 463ae07e99 [subset] In the preprocess subset call always use long loca.
Long loca is needed so that we can store the trimmed glyph bytes to allow us to safely skip trimming in the later subset.
2022-11-23 12:52:55 -07:00
Behdad Esfahbod 299ec902eb [glyf] Move instanciation to serialize() 2022-11-22 16:03:02 -07:00
Behdad Esfahbod d8d881f22d [subset-glyf] Don't create a second glyf accelerator 2022-11-22 15:24:16 -07:00
Behdad Esfahbod 7560930070 [glyf] Add _create_font_for_instancing 2022-11-22 15:22:25 -07:00
Behdad Esfahbod 40634ceeb0 [glyf] Adjust data types 2022-11-22 15:07:16 -07:00
Behdad Esfahbod ba0d28ea36 [glyf] Fix font error check 2022-11-22 15:01:48 -07:00
Behdad Esfahbod 04c525019c [glyf] Use a malloc instead of calloc 2022-11-22 14:54:55 -07:00
Behdad Esfahbod 024aa81805 [glyf] Micro-optimize encode_coord 2022-11-22 14:51:42 -07:00
Behdad Esfahbod b6694597f9 [glyf] Micro-optimize encode_flag() 2022-11-22 14:49:01 -07:00
Behdad Esfahbod d47cfe7936 [glyf] Minor use operator ++ 2022-11-22 14:45:04 -07:00
Behdad Esfahbod 03e6bde790 [glyf] Minor adjustment to lastflag handling
No logic change.
2022-11-22 14:40:50 -07:00
Behdad Esfahbod 0ca9fda889 [glyf] Remove misplaced comment 2022-11-22 14:39:10 -07:00
Behdad Esfahbod 4afcdf675b More hb_memcpy 2022-11-22 12:56:48 -07:00
Behdad Esfahbod 58a696d80e More hb_memset 2022-11-22 12:56:05 -07:00
Behdad Esfahbod 1758ee6646 [glyf] Minor write loop more idiomatically 2022-11-22 10:55:16 -07:00
Behdad Esfahbod b567ce51d3 [subset] Don't trim glyf's again if preprocessed
Speeds up M1/10000 benchmark by 30%!
2022-11-22 10:55:08 -07:00
Behdad Esfahbod a0bde1e1ea [open-type] Remove (Sorted)ArrayOf.sub_array() 2022-11-16 21:27:12 -07:00
Behdad Esfahbod f2b5db700f [vector] Remove .sub_array () 2022-11-16 21:22:57 -07:00
Behdad Esfahbod ea63e95e4c [GPOS.PairPos] Adjust unsafe-to-break for non-zero ValueFormat2
Fixes https://github.com/harfbuzz/harfbuzz/issues/3824
2022-11-14 12:36:48 -07:00
Behdad Esfahbod fc935fb81b Fix snprintf use
https://github.com/harfbuzz/harfbuzz/pull/3495#issuecomment-1299107964
2022-11-01 14:40:47 -06:00
Behdad Esfahbod 02b76393ef [config] Re-enable BORING_EXPANSION
Only the non-experimental parts (currently avar2) are
enabled by default.
2022-10-29 11:19:04 -06:00
Behdad Esfahbod 477d71724c [glyf] Limit points in a glyf to 10000 roughly
Only enforced when components are being expanded.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3838
2022-10-26 13:11:47 -06:00
Behdad Esfahbod 9aad3dba8f [SingleSubst] Fix degenerate-lookup test
Part of https://github.com/harfbuzz/harfbuzz/issues/3853
2022-10-26 13:04:02 -06:00
Behdad Esfahbod a756bd1944 [glyf] Use component phantom points after transformation 2022-10-13 17:18:19 -06:00
Behdad Esfahbod 82d19c08fc Revert "[glyf/Composite] Remove phantom points when not needed anymore"
This reverts commit 527e63a3bd.
2022-10-13 17:17:03 -06:00
Behdad Esfahbod 527e63a3bd [glyf/Composite] Remove phantom points when not needed anymore 2022-10-13 17:13:40 -06:00
Behdad Esfahbod 294b1c9f6e Use snprintf instead of sprintf 2022-10-13 11:30:02 -06:00
Garret Rieger 8f1bf23cc9 [subset] optimize glyf subsetting w/ retain gids.
When retain gids is enabled the subset plan may require the output of many empty glyphs. This change optimizes the glyf subsetting code when the number of retained glyphs << number of output glyphs. Unnessecary lookups to the glyph map are reduced by iterating through the glyph map instead of the output glyph set.
2022-09-29 15:44:49 -06:00
Qunxin Liu e94fe2adf3 [instance] minor optimizations to glyf instancing 2022-09-29 12:14:43 -06:00
Qunxin Liu b90ce34a25 [instance] fix for non-empty .notdef glyph metrics update
we need pass in source glyph's outline data to calculate boundaries, and
then drop the outline data if notdef-outline is specified.

Also disable shifting points for instancing in get_points () API
2022-09-29 12:14:43 -06:00
Qunxin Liu 8f3a7017c3 [instance] support FeatureVariations table 2022-09-29 12:14:43 -06:00
Behdad Esfahbod 4bf9621113 [optical-bounds] Optimize 2022-09-01 13:36:26 -06:00
Behdad Esfahbod 5d6f1a88e4 [layout] Add hb_ot_layout_get_optical_bound() 2022-09-01 13:36:26 -06:00
Qunxin Liu 8f84c58a34 [instance] don't copy phantom points from component
No need to consider USE_MY_METRICS for instancing
2022-09-01 09:44:28 -07:00
Qunxin Liu 58dbc00162 [instance] Fix compiling Composite glyph bytes
The x/y offset encoded with int8 originally might overflow after deltas
are applied. So we cannot just copy and update old values.
2022-09-01 09:44:28 -07:00
Qunxin Liu 8b7e2a1373 [instance] we need to update hmtx/vmtx values even for empty glyphs
Update metrics using the 4 phantom points
2022-09-01 09:44:28 -07:00
Qunxin Liu 6de0a6f0b7 [instance] update GPOS ValueRecord table 2022-09-01 09:43:46 -07:00
Qunxin Liu 61636d4efe [instance] update GPOS AnchorFormat3 table 2022-09-01 09:37:00 -07:00
Qunxin Liu b72995ff16 [instance] GDEF table: collect both varidxes and deltas 2022-09-01 09:33:02 -07:00
Behdad Esfahbod 84d33a1ed8 [glyf] Fix compiler warning 2022-08-23 13:13:13 -06:00
Qunxin Liu ac0e22fa8e [instance] update glyf/hmtx/vmtx tables 2022-08-22 09:29:37 -07:00
Garret Rieger 5ea3c0be8f [repacker] Implement MarkArray::clone. 2022-08-11 22:21:28 +00:00
Behdad Esfahbod f4f7d691af
Merge pull request #3779 from harfbuzz/split_pair_pos_2
[repacker] Add PairPosFormat2 table splitting in the repacker.
2022-08-09 22:23:23 -06:00
Behdad Esfahbod a4e0fd1685 [MultipleSubst] Rewrite serialize signature as single iterator 2022-08-05 15:05:51 -06:00
Behdad Esfahbod 65d28bc5a7 [MultipleSubst] Rewrite serialize() in terms of iterators
Unused still, and hence untested
2022-08-05 14:56:07 -06:00
Behdad Esfahbod b57ea3b053 Revert "[iter] Use && in uses of is_source_of"
This reverts commit ccbba667a9.
2022-08-05 14:29:27 -06:00
Behdad Esfahbod ccbba667a9 [iter] Use && in uses of is_source_of 2022-08-05 11:51:51 -06:00
Behdad Esfahbod 8fb7cc1c63 [iter] Use && in is_sink_of uses 2022-08-05 11:49:29 -06:00
Behdad Esfahbod 914542bd18 Whitespace 2022-08-04 11:40:54 -06:00
Garret Rieger 7f4b2037a5 [repacker] include size of device tables when determining PairPos2 split points. 2022-08-02 18:43:25 +00:00
Garret Rieger 58fdbd8e5d [repacker] begin adding PairPosFormat2 splitting support. 2022-08-02 17:32:13 +00:00
Behdad Esfahbod 6549aec89d [SingleSubstFormat1] Help avoid timeouts in closure() some more
For https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49712
2022-08-01 13:11:14 -06:00
Garret Rieger f6a242b605 [repacker] begin adding PairPos splitting support. 2022-07-29 22:21:30 +00:00
Behdad Esfahbod 149b030520 Fix thinko 2022-07-29 12:41:30 -06:00
Behdad Esfahbod f7677213d7 [SingleSubstFormat1] Don't close glyphs in degenerate cases
Fixes https://oss-fuzz.com/testcase-detail/5145429829877760
2022-07-29 12:00:29 -06:00
Behdad Esfahbod e51526bf06 [CompositeGlyph] Add HB_NO_BEYOND_64K 2022-07-28 09:53:30 -06:00
Behdad Esfahbod e2cc34e190 [subset/GPOS] Fix a fuzzer timeout test
Fixes https://oss-fuzz.com/testcase-detail/5234369031176192
2022-07-26 12:31:40 -06:00
Behdad Esfahbod 59b05359cd [GSUB/GPOS] Add more buffer messages
Behind HB_BUFFER_MESSAGE_MORE.

https://github.com/harfbuzz/harfbuzz/pull/3495
2022-07-24 18:39:30 -06:00
Behdad Esfahbod 9eab3ac72d [CoverageFormat2] Remove hand-written loop
While on a fuzzer-found test case (added) that loop was faster,
on real fonts, including NotoNastaliq in our benchmark, it was
actually slower, which intuitively I would have expected.

Still no idea why on that fuzzer case it's faster though. :(
2022-07-21 12:36:53 -06:00
Behdad Esfahbod bbb4db90dd [Coverage/SingleSubst] Move hand-written loop to Coverage 2022-07-21 12:34:46 -06:00
Behdad Esfahbod 7b95783efb [Coverage] Internal rename 2022-07-21 12:18:51 -06:00
Behdad Esfahbod afa65f2903 [Coverage] Minor type change 2022-07-21 12:17:08 -06:00
Behdad Esfahbod b38587aa0b [Coverage] Internal renames 2022-07-21 12:14:06 -06:00
Behdad Esfahbod 84d38df828 [Coverage] Minor use range-based loop 2022-07-21 12:12:04 -06:00
Behdad Esfahbod b017b73ffe [Coverage] Minor remove a couple unnecessary as_array()'s 2022-07-21 12:06:55 -06:00
Behdad Esfahbod 9e650b4e0c [Coverage] Speedup intersect_set 2022-07-21 12:01:52 -06:00
Behdad Esfahbod efa388074d [subset/SingleSubsetFormat1] Use Coverage.intersect_set 2022-07-21 11:52:36 -06:00
Behdad Esfahbod 00dfbbce1c [Coverage] Rename and templatize intersected_coverage_glyphs 2022-07-21 11:45:05 -06:00
Behdad Esfahbod d0eb273791 [subset/GSUB/GPOS] Use more intersected_coverage_glyphs() 2022-07-21 11:24:56 -06:00
Behdad Esfahbod 450d834679 [subset/PairPosFormat1] Speed up significantly 2022-07-21 11:05:35 -06:00
Behdad Esfahbod 5d7556e184 Revert "[subst/SingleSubstFormat1] Rewrite nicer"
This reverts commit bababe1072.

The hand-written code is still much faster :(.
2022-07-21 10:58:36 -06:00
Behdad Esfahbod 71ce931e6d [PairPos] Don't compute newFormat
It was wrong, because it would be writing wrong values.

Test suite doesn't seem to catch any.
2022-07-21 10:41:29 -06:00
Behdad Esfahbod 02ca025443 [layout] Add large_int to Types 2022-07-21 10:30:23 -06:00
Behdad Esfahbod bababe1072 [subst/SingleSubstFormat1] Rewrite nicer 2022-07-21 10:25:27 -06:00
Behdad Esfahbod cf123e6a0d [Coverage] Add get_population () 2022-07-21 10:24:04 -06:00
Behdad Esfahbod fa471043fc [subset] Fix previous commit 2022-07-20 22:42:18 -06:00
Behdad Esfahbod c4d2ef9004 [subset] Speed up subsetting of SingleSubstFormat1_3 2022-07-20 22:36:35 -06:00
Behdad Esfahbod d01e6babe6 [subset] Speed up SingleSubstFormat1_3 closure 2022-07-20 22:17:33 -06:00
Behdad Esfahbod aae8c74e05 [>64k:layout:SingleSubstFormat3] Fix masking
https://github.com/be-fonts/boring-expansion-spec/issues/31
2022-07-20 11:51:27 -06:00
Behdad Esfahbod 3c137ef041 [GPOS/CursivePos] Fix unsafe-to-break marking
Fixes test.
2022-07-20 11:29:30 -06:00
Behdad Esfahbod 54e9ab4a91 [GPOS/Cursive] Fix breaking of parent-child attachment
Mostly fixes https://github.com/harfbuzz/harfbuzz/issues/2469
2022-07-18 18:57:14 -06:00
Behdad Esfahbod 89de8c700f [CoverageFormat2] Another fix for broken tables
Fixes https://oss-fuzz.com/testcase-detail/6005342714068992
2022-07-18 13:07:29 -06:00
Behdad Esfahbod d8574b44cc [CoverageFormat2] Fix iterator to avoid infinite loop
on invalid data.

Fixes https://oss-fuzz.com/testcase-detail/5304497047470080
2022-07-17 18:44:27 -06:00
Behdad Esfahbod af84680f23 [GSUB] Remove a reinterpret_cast 2022-07-17 12:00:04 -06:00
Garret Rieger d82ace5c6f [reorg] add TODO to RangeRecord. 2022-07-13 20:25:13 -06:00
Garret Rieger c1e280ea78 [reorg] Move Coverage, RangeRecord into new namespace layout. 2022-07-13 20:25:13 -06:00
Behdad Esfahbod a2f0723148 [GPOS] Adjust mark attachment on multiple substitution some more
Fixes https://github.com/harfbuzz/harfbuzz/issues/1545
2022-07-13 16:02:39 -06:00
Behdad Esfahbod 7549d447ba [>64k:glyf] Implement composites for >64k
Implements https://github.com/be-fonts/boring-expansion-spec/issues/42
2022-07-12 13:42:52 -06:00
Behdad Esfahbod 09de94788b [>64k:glyf] Hid composite glyphIndex 2022-07-12 13:42:52 -06:00
Behdad Esfahbod cc83b0b8fd [>64k:layout:MarkBasePos/MarkMarkPos/MarkLigPos] Implement format 2
Implements https://github.com/be-fonts/boring-expansion-spec/issues/40

Subset does NOT lower format.
2022-07-12 13:42:52 -06:00
Behdad Esfahbod 4b43070e2f [>64k:layout] Templatize MarkBasePos/MarkMarkPos/MarkLigPos 2022-07-12 13:42:52 -06:00
Behdad Esfahbod f0d6dda5a6 [>64k:layout:PairPos] Implement format 3
Implements rest of https://github.com/be-fonts/boring-expansion-spec/issues/38

Subset does NOT lower format.
2022-07-12 13:42:52 -06:00
Behdad Esfahbod 298ee47c55 [>64k:layout] Templatize PairPosFormat1 2022-07-12 13:42:52 -06:00
Behdad Esfahbod e9f8010fd0 [>64k:layout:PairPos] Templatize & implement format 4
Implements part of https://github.com/be-fonts/boring-expansion-spec/issues/38

Subset does NOT lower format.
2022-07-12 13:42:52 -06:00
Behdad Esfahbod ecd8bc5a9c [>64k:layout:LigatureSubst] Implement format 2
Implements https://github.com/be-fonts/boring-expansion-spec/issues/33

Subset does NOT lower format.
2022-07-12 13:42:52 -06:00
Behdad Esfahbod 704e696ad0 [>64k:layout] Templatize LigatureSubst 2022-07-12 13:42:52 -06:00
Behdad Esfahbod 27d24212db [>64k:layout:AlternateSubst] Implement format 2
Implements rest of https://github.com/be-fonts/boring-expansion-spec/issues/32

Subset does NOT lower format.
2022-07-12 13:42:52 -06:00
Behdad Esfahbod c53d3ad51e [>64k:layout] Templatize AlternateSet 2022-07-12 13:42:52 -06:00
Behdad Esfahbod a58a48622a [>64k:layout:MultipleSubst] Implement format 2
Implements part of https://github.com/be-fonts/boring-expansion-spec/issues/32

Subset is NOT updated to lower format.
2022-07-12 13:42:52 -06:00
Behdad Esfahbod 684c8fcea7 [>64k:layout] Templatize MultipleSubst 2022-07-12 13:42:52 -06:00
Behdad Esfahbod 8775e9b4a4 [>64k:layout:SingleSubst] Implement format 3/4
Implements https://github.com/be-fonts/boring-expansion-spec/issues/31
2022-07-12 13:42:52 -06:00
Behdad Esfahbod e3caf8d50a [>64k:layout] Templatize SingleSubst 2022-07-12 13:42:52 -06:00
Behdad Esfahbod d15041be7d [GSUB/GPOS] Trace toplevel sanitize 2022-07-12 11:11:22 -06:00
Behdad Esfahbod 5192294f83 . 2022-07-08 14:09:04 -06:00
Behdad Esfahbod 8a107125a5 [layout] Make SubstLookup:serialize_single take iterators 2022-07-08 12:02:11 -06:00
Behdad Esfahbod ea11029a6e [GPOS] Split LigatureArray.hh 2022-07-08 11:58:43 -06:00
Behdad Esfahbod 68b2742fe4 [GPOS] Move code around 2022-07-07 16:11:15 -06:00
Behdad Esfahbod 6a3043a0c1 Fix tests 2022-07-07 14:51:37 -06:00
Behdad Esfahbod 0b0e3b30ce [GPOS] Break down PairPosFormat1 into new layout 2022-07-07 14:06:44 -06:00
Kleis Auke Wolthuizen 79eb0f7486 [GSUB] Fix build on GCC < 7 2022-07-06 14:00:16 +02:00
Kleis Auke Wolthuizen 3238cb744b [GPOS] Fix build on GCC < 7 2022-07-06 14:00:16 +02:00
Behdad Esfahbod d9ab805e61 Fix LookupFlag negation
Fixes https://github.com/harfbuzz/harfbuzz/issues/3703
2022-07-05 11:45:10 -06:00
Behdad Esfahbod b0cb9a1a63 Make get_leading_bearing return bool
Fixes https://github.com/harfbuzz/harfbuzz/issues/3496

Part of supporting >64k glyphs correctly.
2022-07-03 15:32:32 -06:00
Behdad Esfahbod 115e1a03e7 [glyf] Relax condition for matching number of coords 2022-07-03 14:45:12 -06:00
Behdad Esfahbod 800760c5bd [glyf] Rename get_extents functions for clarity 2022-07-03 13:21:06 -06:00
Behdad Esfahbod ab327f93b7 [glyf] Fix another bug with scaling
Of advances this time.

That codepath is never exercised though, if font has HVAR table.
2022-07-03 13:17:03 -06:00
Behdad Esfahbod f46ddeba48 [hmtx/glyf] Rename side-bearing functions for clarity 2022-07-03 13:12:49 -06:00
Behdad Esfahbod b2d60cbd6e [glyf] Rename advance functions for clarity 2022-07-03 12:56:48 -06:00
Behdad Esfahbod 35c00c1216 [hmtx] Rename advance functions for clarity 2022-07-03 12:54:17 -06:00
Behdad Esfahbod 6b82d4faa1 [glyf] Make an optional argument non-optional 2022-07-03 12:45:27 -06:00
Behdad Esfahbod 3ef590808f [glyf] Internal flip a variable 2022-07-03 12:44:24 -06:00
Behdad Esfahbod 78b4f39821 [glyf] Fix confusion between scaled vs unscaled lsb
Was always broken.
2022-07-03 12:39:55 -06:00
Behdad Esfahbod 6665881c7d [glyf] Change side-bearing rounding 2022-07-03 12:39:55 -06:00
Garret Rieger 900476c635 Move GSUB.hh GPOS.hh back into the GPOS/GSUB sub directories. 2022-06-30 15:33:20 -06:00
Garret Rieger 5fdae68481 [reorg] Move GSUB.hh up one level and change GSUB namespace to GSUB_impl. 2022-06-30 15:33:20 -06:00
Garret Rieger 910a137f4e [reorg] Fix propagate_attachment_offsets definition. 2022-06-28 18:47:50 -06:00
Garret Rieger 3fbf2dece7 [reorg] Move OT::Layout::GPOS_impl::GPOS to OT::Layout::GPOS. 2022-06-28 18:47:50 -06:00
Garret Rieger 88ef3c5a9a [reorg] Change OT::Layout::GPOS to OT::Layout::GPOS_impl. 2022-06-28 18:47:50 -06:00
Garret Rieger 49ddf069e0 [reorg] Move GPOS reverse_cursive_minor_offset implementation into new directory layout. 2022-06-28 18:47:50 -06:00
Garret Rieger 74f45f7c2a [reorg] Move remaining GPOS lookup types to new directory. 2022-06-28 18:47:50 -06:00
Garret Rieger 197d9a5c99 [reorg] Move more GPOS lookups to new directory. 2022-06-28 18:47:50 -06:00
Garret Rieger c7307ca06a [reorg] Begin moving GPOS into the new directory layout. 2022-06-28 18:47:50 -06:00
Behdad Esfahbod 34c6c0193c [glyf] Fix byterange check again 2022-06-27 20:26:57 -06:00
Behdad Esfahbod 20572f914c [glyf] Move read_flags into a function 2022-06-27 20:22:09 -06:00
Behdad Esfahbod 6e72c2e3fa [glyf] Add an assertion 2022-06-27 15:09:25 -06:00
Behdad Esfahbod 3a0e27e794 [glyf] Move comment 2022-06-27 13:07:39 -06:00
Behdad Esfahbod d0836dee7a [glyf] Minor typo change 2022-06-27 13:05:58 -06:00
Behdad Esfahbod 5cca25e5d0 [glyf] Accumulate points as int
Everything is int at this stage.
Doesn't seem to matter for performance though.
2022-06-27 13:03:06 -06:00
Behdad Esfahbod d6f60b3c19 [glyf] Minor optimization 2022-06-27 13:00:08 -06:00
Behdad Esfahbod b30a3dcba3 [glyf] Another bounds check
Very unlikely that is needed but technically possible.
2022-06-27 12:56:54 -06:00
Behdad Esfahbod 2e9dbdcbbe [glyf] Protect against an unlikely overflow 2022-06-27 12:55:13 -06:00
Behdad Esfahbod f1fb8c4489 [glyf] Optimize Glyph layout 2022-06-27 12:41:46 -06:00
Behdad Esfahbod 34e3f561b5 [glyf] Fix a bug I introduced recently
Pass gid to Glyph in trim_padding codepath.
2022-06-27 12:39:35 -06:00
Behdad Esfahbod 19cbfb9ce9 [glyf] Relax a condition that font num_coords be equal to gvar's
gvar itself still checks the same.
2022-06-27 12:32:18 -06:00
Behdad Esfahbod d5cfbaa068 [glyf] Optimize composite points loading 2022-06-27 12:24:20 -06:00
Behdad Esfahbod 32dc0641e1 [glyf] Remove an unnecessary condition 2022-06-27 12:22:06 -06:00
Behdad Esfahbod 3c49a6a60a [glyf] Fix an allocation error
Try fixing assertion failure found by fuzzers:

hb-draw-fuzzer: ../../src/harfbuzz/src/OT/glyf/glyf.hh:175: bool OT::glyf_accelerator_t::get_points(hb_font_t *, hb_codepoint_t, T) const [T = OT::glyf_impl::path_builder_t]: Assertion `count >= glyf_impl::PHANTOM_COUNT' failed.
2022-06-27 10:57:51 -06:00
Behdad Esfahbod a1c45bbb55 [glyf] Minor simplify 2022-06-26 17:30:16 -06:00
Behdad Esfahbod a21a9bb855 [glyf] Optimize flags decoding byte range checking 2022-06-26 17:24:29 -06:00
Behdad Esfahbod 0f1fdf461c [glyf] Optimize points decoding byte range checking 2022-06-26 17:22:45 -06:00
Behdad Esfahbod 51cfcf2957 [glyf] Optimize points decoding 2022-06-26 17:04:47 -06:00
Behdad Esfahbod 86b7022503 [glyf] Optimize flag decoding 2022-06-26 17:02:32 -06:00
Behdad Esfahbod 2bb0fa878a [glyf] Remove unneeded point init() 2022-06-26 16:43:05 -06:00
Behdad Esfahbod fc72a1d22d [glyf] Add a pre-allocation for phantom points 2022-06-26 16:42:01 -06:00
Behdad Esfahbod 8d242aaa8b [glyf] Rewrite a loop harmlessly
I hope...
2022-06-26 16:36:08 -06:00
Behdad Esfahbod cf57f04ddb [glyf/path-builder] Optimize scaling code
Scale each point once upon entry to function.

This makes our shape fetching code as fast as FreeType for all
benchmark cases now.
2022-06-26 16:26:17 -06:00
Behdad Esfahbod b095df1343 [glyf/path-builder] Use operator bool for style 2022-06-26 16:12:50 -06:00
Behdad Esfahbod abb433d0f4 [glyf] Avoid a copy of points in shape fetching for simple glyphs
Matches performance with freetype now.
2022-06-26 16:09:32 -06:00
Behdad Esfahbod 7eac779abf Revert "Revert "[glyf] Optimize shape loading""
This reverts commit 164bd288cf.
2022-06-26 16:02:27 -06:00
Behdad Esfahbod 164bd288cf Revert "[glyf] Optimize shape loading"
This reverts commit f0819301b7.

Broke tests. To be debugged and redone.
2022-06-26 16:01:15 -06:00
Behdad Esfahbod f0819301b7 [glyf] Optimize shape loading
Do away with a copy for simple glyph load.
2022-06-26 15:52:54 -06:00
Behdad Esfahbod 65b066f18e [glyf/path-builder] Simplify initialization 2022-06-26 13:18:00 -06:00
Behdad Esfahbod 2d4557fe04 [glyf/SimpleGlyph] Use member pointer instead of lambda 2022-06-26 13:08:37 -06:00
Behdad Esfahbod 9ce9773040 [glyf/SimpleGlyph] Minor use constructor for contour_point_t 2022-06-26 13:08:37 -06:00
Behdad Esfahbod f897978f21 [glyf] Adjust a check-range 2022-06-26 13:08:37 -06:00
Behdad Esfahbod db039d97ff [glyf/Composite] Make glyphIndex public 2022-06-26 13:08:37 -06:00
Behdad Esfahbod 1b14bf8aa8 [glyf] Rename CompositeGlyphChain to CompositeGlyphRecord 2022-06-26 13:08:37 -06:00
Behdad Esfahbod a5ac7f2ea6 [glyf/composite_iter_t] Renames 2022-06-26 13:08:37 -06:00
Behdad Esfahbod 449bdeed5f [glyf] Rename get_iterator() to iter()
That's the standard name.
2022-06-25 18:32:30 -06:00
Behdad Esfahbod 11d2670676 [glyf] Split off glyf-helpers.hh 2022-06-25 18:19:09 -06:00
Behdad Esfahbod 7c4b8c9bf4 [glyf] path-builder minor header guards fix test 2022-06-25 18:14:42 -06:00
Behdad Esfahbod 499c637922 [glyf] Split off path-builder.hh 2022-06-25 18:07:49 -06:00
Behdad Esfahbod 13aadc8961 [glyf] Split off CompositeGlyph.hh 2022-06-25 18:03:15 -06:00
Behdad Esfahbod f0ec2b728e [glyf] Split off SimpleGlyph.hh 2022-06-25 17:55:16 -06:00
Behdad Esfahbod 8ed78627f0 [glyf] Split off GlyphHeader.hh 2022-06-25 17:53:13 -06:00
Behdad Esfahbod 81315a3016 [glyf] Namespace implementation in glyf_impl
Part of https://github.com/harfbuzz/harfbuzz/issues/3677
2022-06-25 17:50:44 -06:00
Behdad Esfahbod be1d4bcf29 [glyf] Add fast __end__ to composite iterator 2022-06-25 17:45:21 -06:00
Behdad Esfahbod ef250eea7e [glyf] Move a few structs out of Glyph{} 2022-06-25 17:37:59 -06:00
Behdad Esfahbod ae75f066b5 [glyf] Split SubsetGlyph 2022-06-25 17:12:10 -06:00
Behdad Esfahbod 0031069f47 [glyf] Fix includes 2022-06-25 17:05:18 -06:00
Behdad Esfahbod 36373ee15c [glyf] Move add_gid_and_children to subset-plan where it belongs 2022-06-25 16:55:26 -06:00
Behdad Esfahbod ba1c9eda38 [glyf] Use a range for loop 2022-06-25 16:51:33 -06:00
Behdad Esfahbod e4f2bc9342 [glyf] Split Glyph.hh 2022-06-25 16:47:06 -06:00
Behdad Esfahbod 3f9c6bf3fc [glyf] Minor in _write_loca() 2022-06-25 14:46:26 -06:00