Commit Graph

13096 Commits

Author SHA1 Message Date
Behdad Esfahbod de053e2efb [cff] Convert subr_subset_param_t to use constructor 2022-05-10 16:17:20 -06:00
Behdad Esfahbod 96140db485 [cff] Convert cff2_extents_param_t to use constructor 2022-05-10 16:17:20 -06:00
Behdad Esfahbod 54544f2a57 [cff] Convert cff1_extents_param_t to use constructor 2022-05-10 16:17:20 -06:00
Behdad Esfahbod 377befd0c7 [cff] Convert get_seac_param_t to use constructor 2022-05-10 16:17:20 -06:00
Behdad Esfahbod 8fd70362fa [cff] Use hb_ubytes_t() instead of Null(hb_ubytes_t) 2022-05-10 16:17:20 -06:00
Behdad Esfahbod 9033c7f99d [cff-common] Optimize INDEX::operator[]
Previous try showed slowdown in benchmarks, suprisingly.

Rewrite it keeping the function, hopefully allowing better optimization.
2022-05-10 14:58:53 -06:00
Behdad Esfahbod 3aace2431b Revert "[cff-common] Optimize INDEX::operator[]"
This reverts commit 9edb03ac7a.
2022-05-10 14:54:04 -06:00
Behdad Esfahbod b31ef081db Revert "[cff] Add an unlikely()"
This reverts commit 9ba9adb7ed.

This shows slowdown in benchmarks.
2022-05-10 14:52:40 -06:00
Behdad Esfahbod 9ba9adb7ed [cff] Add an unlikely() 2022-05-10 14:43:00 -06:00
Behdad Esfahbod 9edb03ac7a [cff-common] Optimize INDEX::operator[] 2022-05-10 14:43:00 -06:00
Garret Rieger 52d59bf150 [perf] Make subset benchmark data driven. 2022-05-10 14:30:08 -06:00
Behdad Esfahbod 0a42410dc8 [cff2] Change extents/shape stack to be just a number
Do the blending immediately.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3559

Benchmark on AdobeVFPrototype shows 35% speedup. Now we're faster
than FreeType:

Benchmark                                                           Time             CPU      Time Old      Time New       CPU Old       CPU New
------------------------------------------------------------------------------------------------------------------------------------------------
BM_Font/glyph_extents/AdobeVFPrototype.otf/hb                    -0.3792         -0.3792          1584           983          1581           982
BM_Font/glyph_extents/AdobeVFPrototype.otf/ft                    +0.0228         +0.0224          1220          1248          1218          1245
BM_Font/glyph_extents/AdobeVFPrototype.otf/var/hb                -0.3513         -0.3518          1616          1048          1613          1046
BM_Font/glyph_extents/AdobeVFPrototype.otf/var/ft                +0.0172         +0.0169          1232          1254          1230          1251
2022-05-10 13:41:12 -06:00
Garret Rieger 5277a5772b [perf] Add benchmarks for CFF subsetting. 2022-05-10 12:16:44 -06:00
Garret Rieger 8f9f0c494b [subset] Enforce cmap12 group ordering constraints in collect_mapping.
Fixes fuzzer issue: https://oss-fuzz.com/testcase-detail/6365271012540416
2022-05-10 12:15:09 -06:00
Behdad Esfahbod c99ad0f015
Merge pull request #3572 from harfbuzz/cff-stack
Cff stack
2022-05-09 18:52:19 -06:00
Behdad Esfahbod 1b14d2ff13 [cff] Fix arg-stack peek() impl 2022-05-09 18:15:31 -06:00
Behdad Esfahbod 6106ef8c0f [cff] Tighten up arg-stack access 2022-05-09 18:15:11 -06:00
Behdad Esfahbod 8c616a6efe [cff] Allocate stack inline instead of using hb_vector_t
Speeds up glyph_extents and glyph_shape benchmarks for CFF by 10
to 16 percent!
2022-05-09 17:50:59 -06:00
Behdad Esfahbod c941ece60f [cff] Use using instead of typedef 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 64d63cebe2 [cff-common] Use existing types for str_buff_vec_t 2022-05-09 17:34:58 -06:00
Behdad Esfahbod e1838ec1f8 [cff-common] Remove unused method 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 8aa54aaca2 [cff] Replace byte_str_t with hb_bytes_t use 2022-05-09 17:34:58 -06:00
Behdad Esfahbod fe1d85a55a [cff] Remove custom byte_str_t impl 2022-05-09 17:34:58 -06:00
Behdad Esfahbod c8a5f1e3c0 [cff-common] Indent 2022-05-09 17:34:58 -06:00
Behdad Esfahbod be7b2905cb [cff-common] Remove unused INDEX::serialize() method 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 60390169b6 [cff-common] Write str_buf_t::total_size() as dagger 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 258afb45b7 [cff-common] Use range-based loop in str_buff_vec_t 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 8bb1a3ce9a [cff-common] Write INDEX offset-size calc using hb_bit_storage() 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 2ccfe84eff [cff-common] Add assert to INDEX::set_offset_at() 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 4bcab9e99a [cff-common] Use byte_str_t() instead of Null(byte_str_t) 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 94f7a26322 [cff-common] Fix get_size() for Null object
The special-casing didn't make sense.
2022-05-09 17:34:58 -06:00
Behdad Esfahbod c9cc7d5d21 [cff-common] Inline once-used method in INDEX 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 11482a3a39 [cff-common] Remove unused method from INDEX 2022-05-09 17:34:58 -06:00
Behdad Esfahbod d1bb3b08f6 [cff-common] Hide more INDEX internals 2022-05-09 17:34:58 -06:00
Behdad Esfahbod d3b21387fd [cff-common] Remove redundant operator implementation 2022-05-09 17:34:58 -06:00
Behdad Esfahbod a96b408d80 [cff-common] Hide INDEX internals 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 335b1d83cf [cff-common] No need to check max-offset in INDEX
The length_at() function makes sure out-of-range offsets
are discarded. We just need to check the last offset.
2022-05-09 17:34:58 -06:00
Garret Rieger b051f3fa83 [subset] Fix cpal subsetting when there are partial palette overlaps.
The existing code doesn't correctly handle the case where palettes partially overlap in the color record array. This changes the subsetting to only share entries in the color record array when palettes have the same first color index. Partially overlapping palettes will be converted to disjoint segments in the color record array.

Updates one of the color tests to use multiple palettes.

Also fixes fuzzer: https://oss-fuzz.com/testcase-detail/5568200165687296.
2022-05-09 12:25:05 -06:00
Behdad Esfahbod 2884eb97bf [cff-common] Remove special-casing of count=0 in INDEX serialize
The generic code-path now can handle count=0.
2022-05-06 13:33:13 -06:00
Behdad Esfahbod fc7f51aece [cff-common] Reduce iterator calls 2022-05-06 13:33:13 -06:00
Behdad Esfahbod c857b8e3c6 [cff-common] Set INDEX min_size to 2
That is what it is, for an empty INDEX.
2022-05-06 13:33:13 -06:00
Behdad Esfahbod dd71d2c1c3 [gvar] Protect against offset underflow 2022-05-06 13:02:26 -06:00
Behdad Esfahbod 9a6dabd61a [gvar] Remove sanitize check for data array
We are not checking in sanitize that offset array is ascending,
so this check was bogus.
2022-05-06 12:43:45 -06:00
Behdad Esfahbod 38478d1061 [gvar] DEFINE_SIZE_ARRAY instead of DEFINE_SIZE_MIN 2022-05-06 12:43:45 -06:00
Behdad Esfahbod 90d278c92e [gvar] Remove requirement that num_glyphs matches the font's 2022-05-06 12:43:45 -06:00
Behdad Esfahbod ca8a0f3ea3 [gvar] Protect against out-of-range access
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47281
Fixes https://oss-fuzz.com/testcase-detail/5508865908670464
2022-05-06 11:54:38 -06:00
Behdad Esfahbod f10ddb8dd8 [cmap] Use -1 as Unicode sentinel, not U+FFFF in Format12 serialize 2022-05-05 11:21:24 -06:00
Behdad Esfahbod 8a19968c8b [cmap] Use iterator bool operator 2022-05-05 11:17:23 -06:00
Behdad Esfahbod 8bfeea4828 [subset] Compute set max using previous() 2022-05-05 11:13:57 -06:00
Behdad Esfahbod 00cb8c629d [subset] Don't go into glyf table if it's empty 2022-05-05 11:13:57 -06:00