Behdad Esfahbod
75112098ac
[VarStore] Implement reading 32bit var-store
...
Untested.
Part of https://github.com/harfbuzz/harfbuzz/issues/2965
Serializing is incomplete.
2022-05-31 03:58:29 -06:00
Behdad Esfahbod
e5d6da7905
[varStore] rename shortCount to wordCount
2022-05-30 07:48:58 -06:00
Behdad Esfahbod
371e14d99c
Combine uses of map has() then get() with has(.., &..)
2022-05-28 13:40:30 -06:00
Behdad Esfahbod
6010feeeb5
[varStore] Rename variable as per review
...
https://github.com/harfbuzz/harfbuzz/pull/3605
2022-05-24 09:01:02 -06:00
Behdad Esfahbod
d9acc045f1
[VarStore] Sprinkle cache_t type around
...
It's available so no need to use void*.
2022-05-21 15:12:14 -06:00
Behdad Esfahbod
da38312e42
[VarStore] Pepper cache with likely()
2022-05-21 15:12:14 -06:00
Behdad Esfahbod
cf8f00e354
[VarStore] Don't use NAN
...
Is faster.
With this, I'm seeing 25 to 28% speedup in glyph_h_advances benchmark
of benchmark-font for var/hb tests.
2022-05-21 15:12:14 -06:00
Behdad Esfahbod
880f50f7e4
Refactor varstore cache
2022-05-21 15:12:14 -06:00
Behdad Esfahbod
f2a2fb91a3
[GPOS] Cache VarStore region scalars
2022-05-21 15:12:14 -06:00
Behdad Esfahbod
5fbc70c59b
[VarStore] Add cache API
2022-05-21 15:12:14 -06:00
Garret Rieger
3ab2c7935f
[subset-perf] Signficiantly speed up ClassDef*::subset.
...
Eliminates the usage of a glyph -> klass hash map and replaces it with a vector storing the mapping. This allows us to use the vector directly as the iterator driving the serialize. Approximately 1% speedup for Noto Nastaliq.
2022-05-19 12:37:28 -06:00
Garret Rieger
0b1c2ff96a
[subset-perf] Remove extra map lookup in ClassDef subset methods.
2022-05-18 18:25:36 -06:00
Garret Rieger
13ace77f1d
[subset-perf] Use glyph_map instead of set in ClassDefFormat.
2022-05-18 18:25:36 -06:00
Garret Rieger
adae2f2272
[subset-perf] Cache a glyph map for gsub.
...
This allows us in some cases to avoid using glyph_set_gsub as a filter.
2022-05-18 18:25:36 -06:00
Behdad Esfahbod
cedf739646
Add some commented-out code
2022-05-18 16:53:26 -06:00
Garret Rieger
48dfbd54a3
[subset] minor cleanup.
2022-05-18 15:24:54 -06:00
Garret Rieger
482c6e5dc4
[subset-perf] Speed up Coverage::serialize by caching iterator.
2022-05-18 15:24:54 -06:00
Behdad Esfahbod
14b18725f0
In Coverage::iter_t, assume iterators are from same Coverage object
...
No need to support otherwise.
2022-05-18 15:14:32 -06:00
Behdad Esfahbod
27141735c3
[subset] Add Coverage::__end__ implementation
2022-05-18 15:12:49 -06:00
Behdad Esfahbod
c476f58adb
[subset] Write CoverageFormat2::intersects_coverage() as bsearch()
2022-05-18 14:20:23 -06:00
Behdad Esfahbod
63c6695108
[ot-layout] Cosmetic
...
The implementation of HBUINT16 operator == is slower than just
comparing to ints.
2022-05-18 13:53:52 -06:00
Behdad Esfahbod
777debd748
[subset] Rewrite CoverageFormat2::intersects as dagger
2022-05-18 13:46:06 -06:00
Behdad Esfahbod
cf5001fac7
[subset] Optimize CoverageFormat2::intersected_coverage_glyphs
2022-05-18 13:38:29 -06:00
Behdad Esfahbod
6f37c20798
[subset] Minor rewrite in CoverageFormat2::serialize()
2022-05-18 13:25:42 -06:00
Behdad Esfahbod
175319cd89
[gsubgpos] Clean up OT::ClassDefFormat2::intersected_class_glyphs 0 case
2022-05-11 13:47:17 -06:00
Behdad Esfahbod
137af3612b
[gsubgpos] Simplify OT::ClassDefFormat2::intersected_class_glyphs()
2022-05-11 13:39:30 -06:00
Behdad Esfahbod
3261e05bdb
[subset] Optimize ClassDef1::intersected_class_glyphs() for class0
2022-05-11 13:16:31 -06:00
Behdad Esfahbod
a792e16e48
[ot-layout] Change max nesting level of lookups from 6 to 64
2022-03-24 13:08:51 -06:00
Qunxin Liu
7cb002cb58
[subset] bug fix in prune_langsys
...
we should not cache visited langsys cause 2 different Record<Langsys>
could have different Tag while pointing to the same Langsys, a langsys
is redundant in Record<Langsys> A does not mean it's redundant in Record
B. Same thing for visited_script.
Also adding the number of features in the LangSys's feature list to the
visited langsys count so it's more accurate.
Plus some improvement in langsys compare()
2022-03-16 13:08:13 -06:00
Behdad Esfahbod
de2cef42b4
[bimap] Remove init/fini
2022-01-18 09:21:31 -07:00
luz paz
e2e305066a
Fix various typos
...
Found via `codespell -q 3 -S ./perf/texts -L actualy,ba,beng,fo,gir,inout,nd,ot,pres,ro,te,teh,timne`
2022-01-16 05:39:03 -08:00
Garret Rieger
067f90a820
[subset] Fix for fuzzer timeout.
...
Fixes https://oss-fuzz.com/testcase-detail/5549945449480192
In prune_langsys: move LangSys visited check up before any work is done for a LangSys. In this particular case the compare() method is responsible for the majority of the time spent and wasn't being guarded with a visisted check.
2021-12-14 17:34:21 -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
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
a75b96f7e5
[sanitize] In lookup sanitize don't try to access subtable 0 if it isn't there.
2021-11-16 15:00:50 -08: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
Behdad Esfahbod
6d555ce82e
[meta] Use std::forward instead of hb_forward()
2021-11-02 00:18:22 -06:00
Qunxin Liu
ca7b9daef0
[subset] subset MATH table
2021-09-22 18:08:30 -04: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
Behdad Esfahbod
14a2df7bc2
Add stub HBUINT15
2021-09-19 23:06:09 -04:00
Behdad Esfahbod
c852b86841
Rename HBGlyphID to HBGlyphID16
2021-09-19 16:30:12 -04:00
Garret Rieger
b63ac57174
[subset] bail if collection region indices is in error.
2021-07-29 18:30:37 -07:00
Behdad Esfahbod
30579f5a37
[set] Document & use open-ended del_range()
2021-07-29 11:19:13 -06:00
Behdad Esfahbod
2d54c34680
[subset/VarStore] Fix OOM in fuzzer test
...
The test in question is the one added in c68a00b92e
.
Culprit is that it's allocating lots of memory because of region_indices that
are out-of-range anyway. So, try to filter those out first.
2021-07-29 00:49:36 -06:00
Behdad Esfahbod
ff1fe25a5d
[VarStore] Rename internal get_scalars() to get_region_scalars()
2021-07-29 00:49:36 -06:00
Behdad Esfahbod
f0a1892ff9
[serialize] Remove unnecessary pointer indirection
2021-07-28 17:36:22 -06:00
Behdad Esfahbod
1c511ed6f6
[subset] Simplify VarStore serialization
2021-07-28 17:33:26 -06:00
Behdad Esfahbod
ad4c692492
[subset] Simplify VarStore serialize
2021-07-28 17:22:14 -06:00
Behdad Esfahbod
25dee60977
[sanitize] Revert some from c68a00b92e
...
That overflow check was already happening in arrayZ.sanitize().
2021-07-28 13:58:24 -06:00
Behdad Esfahbod
c68a00b92e
[subset] Fix possible overflows in VarRegionList serialize
...
Fixes https://oss-fuzz.com/testcase-detail/5362189182566400
2021-07-27 13:28:09 -06:00