Commit Graph

11495 Commits

Author SHA1 Message Date
Behdad Esfahbod d77903db7b [bit-set] Micro-optimize 2022-11-24 14:22:32 -07:00
Behdad Esfahbod 13dd4b464b [bit-set] Micro-optimize access 2022-11-24 14:20:42 -07:00
Garret Rieger a3afa61ce8 [subset] use cached parsed char strings if available. 2022-11-24 21:14:00 +00:00
Garret Rieger 47c125845c [subset] Cache parsed charstrings in the cff accelerator. 2022-11-24 21:14:00 +00:00
Garret Rieger 48b6837074 [subset] add a CFF specific accelerator object.
This allows CFF specific accelerator structures to be isolated to the CFF code.
2022-11-24 21:13:59 +00:00
Behdad Esfahbod d77f346d1a [subset-cff] Minor rename 2022-11-24 14:02:46 -07:00
Behdad Esfahbod 29a0fa089a [subset-cff] Micro-optimize 2022-11-24 14:00:59 -07:00
Behdad Esfahbod d480ae1fac [cff] Remove unused function 2022-11-24 13:53:43 -07:00
Behdad Esfahbod 73046d53e5 [shaper] Disable dumber shaper if no AAT 2022-11-24 13:49:29 -07:00
Behdad Esfahbod e9f964c01a [ot-face] Declare more tables as core 2022-11-24 13:38:53 -07:00
Behdad Esfahbod 5bc27a128d [machinery] Comment 2022-11-24 13:30:12 -07:00
Behdad Esfahbod d21bfb0861 [normalize] Remove an unlikely
Keep unlikely for truely unlikely scenarios.
2022-11-24 13:14:05 -07:00
Behdad Esfahbod 9e1239f443 [config] Define HB_NO_VERTICAL in HB_LEAN and as such in HB_TINY 2022-11-24 13:00:47 -07:00
Behdad Esfahbod 6f133ccfde [glyf] Fix build with HB_NO_VERTICAL 2022-11-24 12:59:55 -07:00
Behdad Esfahbod 76420ef769 [machine.rl] Remove unlikely from what happens 1/16 of the time 2022-11-24 12:52:15 -07:00
Behdad Esfahbod 1248574454 [config] Disable Zawgyi shaper in HB_MINI/HB_TINY 2022-11-24 12:46:04 -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
Behdad Esfahbod 54ae3345b2 [buffer] Improve documentation of hb_buffer_add_codepoints()
Fixes https://github.com/harfbuzz/harfbuzz/issues/3889
2022-11-24 12:00:36 -07:00
Behdad Esfahbod a4a4078632
Merge pull request #3893 from googlefonts/preprocess_test
[subset] Fix testing of preprocess
2022-11-24 11:56:58 -07:00
Behdad Esfahbod 0c70bc7f32 [skippy-iter] Fix two logic errors
First, a signed underflow.

Second, a wrong condition.

Both were introduced in 42681bdb55
2022-11-24 11:48:48 -07:00
Behdad Esfahbod 3b43096ef3 [buffer] Whitespace 2022-11-23 22:04:02 -07:00
Behdad Esfahbod 094f80738a [buffer] Handle null buffer in set_message_func 2022-11-23 22:03:26 -07:00
Behdad Esfahbod 1fa64c0c23 [gsubgpos] Conditionalize skippy on unsafe-to-concat 2022-11-23 21:38:51 -07:00
Behdad Esfahbod 42681bdb55 [gsubgpos] No logic-change minor rewrite 2022-11-23 21:36:43 -07:00
Behdad Esfahbod c15efdec49 [gsubgpos] Comment 2022-11-23 21:14:28 -07:00
Behdad Esfahbod 7ec1c41a55 [gsubgpos] Skippy-iter: Prefer correctness to performance
Prefer unsafe-to-concat correctness, over performance.
2022-11-23 21:12:41 -07:00
Behdad Esfahbod dce3502e10 [array] Add commented-out static asserts
They don't work.
2022-11-23 18:34:54 -07:00
Behdad Esfahbod a7fee43cef [priority-queue] Minor micro-optimize 2022-11-23 17:46:32 -07:00
Garret Rieger ff3cac0ccd [subset] Fix unecessary trailing 0 bytes left by ContextFormat2 pruning.
Uneeded rules where beind removed from the count by the bytes for them was being left in the font.
2022-11-23 23:50:49 +00:00
Behdad Esfahbod f2851e4157 [test-map] Test has() getter with unique-ptr 2022-11-23 16:50:30 -07:00
Behdad Esfahbod 5f3a780614 [font] Protect against div-by-zero 2022-11-23 16:45:46 -07:00
Behdad Esfahbod 060ecac949 [font] Respect subfont slant setting in hb-draw
Fixes https://github.com/harfbuzz/harfbuzz/issues/3890
2022-11-23 16:31:37 -07:00
Garret Rieger 51028e63e6 [subset] Retain all glyphs in preprocessed face. 2022-11-23 22:51:16 +00:00
Behdad Esfahbod 404cb99d86 [buffer-diff] Fix check for glyph flag equality
I'm not sure if the old behavior was intentional, but it was checking
that the glyph flags were a subset of the reference buffer's glyph
flags.  I don't see why that is useful.  Fix that.

Then make the buffer-verify code ignore flag differences when verifying
buffers, since our unsafe-to-concat flag at least, is conservative and
not guaranteed to be produced the same in fragments.  See:

https://github.com/harfbuzz/harfbuzz/issues/3888
2022-11-23 15:37:03 -07:00
Garret Rieger 4c49daf7cd [subset] actually use the preprocessed face in hb-subset.
Tests weren't actually using the preprocessed face due to this typo in util/hb-subset.
2022-11-23 22:33:57 +00:00
Garret Rieger 2c0afde737 [subset] add an inprogress accelerator to plan.
This allows subset code to cache information into the accelerator during preprocess subset. Previously the accelerator was created at the end of subsetting.
2022-11-23 13:41:52 -07:00
Garret Rieger 81640fdffe [subset] fix leaked font in glyf::subset(...) 2022-11-23 13:41:52 -07:00
Behdad Esfahbod dcce53ddcb [cff] Micro-optimize fetch_op 2022-11-23 13:20:48 -07:00
Behdad Esfahbod 0bf7d9eb4d [subset-cff] Micro-optimize encode_byte 2022-11-23 13:20:48 -07:00
Behdad Esfahbod a23f820427 [subset-cff] Micro-optimize array access 2022-11-23 13:20:48 -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 44be8ef4ce [gvar] Skip degenerate all-untouched delta-sets 2022-11-22 14:21:25 -07:00
Behdad Esfahbod 656bb223f1 [gvar] Micro-optimize unpack_points 2022-11-22 14:16:40 -07:00
Behdad Esfahbod a383027262 [gvar] Cosmetic 2022-11-22 14:15:17 -07:00
Behdad Esfahbod be89919a70 [gvar] is_valid() remove a check
I don't know why this check was there, but it doesn't make sense
because that function never returns 0 / false.
2022-11-22 13:56:20 -07:00
Behdad Esfahbod e8ddf107d0 [gvar] Optimize a loop 2022-11-22 13:29:32 -07:00
Behdad Esfahbod dd6fcec92c [gvar] Remove a conditional 2022-11-22 13:27:40 -07:00
Behdad Esfahbod a02317238a [gvar] Refactor deltas array access 2022-11-22 13:24:39 -07:00
Behdad Esfahbod c34c77698c [gvar] Don't try IUP if all points are specified 2022-11-22 13:21:01 -07:00
Behdad Esfahbod 27c4037e59 [gvar] Micro-optimize boundary-checking 2022-11-22 13:12:22 -07:00
Behdad Esfahbod ab8346fb6f [gvar] Add an unlikely 2022-11-22 13:07:39 -07:00
Behdad Esfahbod 1e8a342ea2 [gvar] Micro-optimize int types 2022-11-22 13:04:32 -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 59c45f6deb Use hb_memcpy instead of memcpy consistently 2022-11-22 12:54:50 -07:00
Behdad Esfahbod ac0efaf818 Use hb_memset instead of memset consistently 2022-11-22 12:50:36 -07:00
Behdad Esfahbod 44a892a233 [shape] Use hb_memcmp instead of memcmp 2022-11-22 12:48:52 -07:00
Behdad Esfahbod c53c648127 [subset-cff] Another handrolled memcpy 2022-11-22 12:46:25 -07:00
Behdad Esfahbod ae578705c2 [array] Write hash as range for loop again
Now that our range loop is faster than our own iter.
2022-11-22 12:23:17 -07:00
Behdad Esfahbod 13e1ca9eb5 [cff] Micro-optimize memcpy 2022-11-22 12:19:28 -07:00
Behdad Esfahbod 2968dd7844 [gvar] Optimize as_array() access 2022-11-22 11:57:29 -07:00
Behdad Esfahbod bb3bb76450 [gvar] Optimize scalar = 1.0 case 2022-11-22 11:53:35 -07:00
Behdad Esfahbod 2d098d5d7f [gvar] Use memset 2022-11-22 11:51:04 -07:00
Behdad Esfahbod e630a65e60 [gvar] Micro-optize vector extend 2022-11-22 11:29:13 -07:00
Behdad Esfahbod 49d4f62135 [gvar] Micro-optimize 2022-11-22 11:14:56 -07:00
Behdad Esfahbod 1758ee6646 [glyf] Minor write loop more idiomatically 2022-11-22 10:55:16 -07:00
Behdad Esfahbod 16ec9dcc1b [gvar] Whitespace 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 72059a4789 [gvar] Optimize IUP alg 2022-11-22 10:41:37 -07:00
Behdad Esfahbod ee9873b5ed [gvar] Disable initializing vectors when not necessary 2022-11-22 10:23:17 -07:00
Behdad Esfahbod b0d2641186 [vector] Add "initialize" argument to resize() 2022-11-22 10:20:11 -07:00
Behdad Esfahbod a2059f8f55 [gvar] Optimize unpack_points 2022-11-22 10:16:21 -07:00
Behdad Esfahbod 6d7206b68b [gvar] Optimize unpack_deltas 2022-11-22 10:13:14 -07:00
Behdad Esfahbod bca569ae53 [array] Speed up hash() for byte arrays 2022-11-21 23:19:42 -07:00
Behdad Esfahbod d7b492e3f5 Revert "[array] Remove hash specializations for bytes"
This reverts commit 213117317c.
2022-11-21 23:08:51 -07:00
Behdad Esfahbod 1572ba281a [subset-cff] Return in subr closure if already seen subr
Not sure why this was not done before.
2022-11-21 22:26:44 -07:00
Behdad Esfahbod a29ca6efbc [subset-cff] Comment 2022-11-21 22:02:17 -07:00
Behdad Esfahbod 28e767ddea [subset-cff] Really optimize op_str_t / parsed_cs_op_t layout
Now parsed_cs_op_t and op_str_t are both 16 bytes.

Saves another 7% in SourceHanSans/10000 benchmark.
2022-11-21 21:59:51 -07:00
Behdad Esfahbod 2d5ee23731 [subset-cff] Readjust parsed_cs_op_t
Now it doesn't matter anymore since op_str_t is adjusted and
is 16 bytes with 8byte alignment.
2022-11-21 21:55:21 -07:00
Behdad Esfahbod 4f056b923a [subset-cff] Optimize op_str_t layout 2022-11-21 21:37:57 -07:00
Behdad Esfahbod a750cb0128 Simplify rvalue creation 2022-11-21 21:03:32 -07:00
Behdad Esfahbod 86a763c651 [map] Make keys moveable 2022-11-21 20:53:44 -07:00
Behdad Esfahbod cf20d2ec5d [map] Take const key 2022-11-21 20:47:17 -07:00
Behdad Esfahbod 3d1c76f713 [serializer] Don't hash objects twice 2022-11-21 19:40:32 -07:00
Behdad Esfahbod 35878df215 [algs] Implement swap() for pair_t
Helps priority_queue::pop_minimum and friends, which help subsetter
repacker. Shows a few percentage improvement on NotoNastaliq benchmark.
2022-11-21 19:14:03 -07:00
Behdad Esfahbod a2984a2932 [cff] Remove unnecessary namespacing 2022-11-21 18:40:52 -07:00
Behdad Esfahbod dc3bb5e0ed [subset-cff] Pre-allocate values array for subroutines as well 2022-11-21 18:18:48 -07:00
Behdad Esfahbod c6279224db [cff] Adjust pre-allocation
This better matches actual usage, given that ops are one or two
bytes, and vector also allocates 50% extra.
2022-11-21 18:01:50 -07:00
Behdad Esfahbod bab8ec58b0 [subset-cff] Disable sharing when packing charstring INDEXes
Saves another 8%ish.
2022-11-21 17:46:32 -07:00
Behdad Esfahbod 2cadacad6c [cff] Simplify str_encoder_t error handling 2022-11-21 17:17:15 -07:00
Behdad Esfahbod f263e3fe2e [cff] Manually copy short strings instead of memcpy() 2022-11-21 17:04:55 -07:00
Behdad Esfahbod 38efd1862f [cff] Add a likely() 2022-11-21 17:02:11 -07:00
Behdad Esfahbod 191025cc96 [cff] Adjust buffer pre-allocation
Most ops take one or two bytes, so allocate count*2, not count*3.
Shows minor speedup in subsetting benchmark (around 2%).
2022-11-21 16:58:19 -07:00
Behdad Esfahbod 4b2caafea2 [subset-cff] Optimize parsed_cs_op_t size
Shows 5% speedup on SourceHanSans-Regular/10000 benchmark.
2022-11-21 16:46:20 -07:00
Behdad Esfahbod e0b06bd1b1 [subset] Cache has_seac in accelerator
Speeds up SourceHanSans-Regular/10000 benchmark by %25.
2022-11-21 16:30:34 -07:00
Garret Rieger dd1ba328a8 [repacker] fix fuzzer timeout.
For https://oss-fuzz.com/testcase-detail/5845846876356608. Only process the set of unique overflows.
2022-11-21 16:24:48 -07:00
Behdad Esfahbod 59451502e9 [cff] Optimize env error checking 2022-11-21 15:23:16 -07:00
Behdad Esfahbod b238578a9c [cff] Optimize INDEX operator[] 2022-11-21 14:36:57 -07:00
Behdad Esfahbod d9de515a38 [cff] Optimize byte_str_ref_t array access 2022-11-21 14:23:07 -07:00
Behdad Esfahbod a81ec9b2b6 [cff] Optimize byte_str_ref_t inc()
Shows a couple percent speedup.
2022-11-21 14:03:28 -07:00
Behdad Esfahbod 3ff75411bd [algs] Fix bot fail 2022-11-21 13:08:55 -07:00
Behdad Esfahbod b81e3989f8 Try fixing arm-eabi build after a10cfe3f32 2022-11-21 13:02:40 -07:00
Behdad Esfahbod 4c14043b06 [algs] Add output argument to hb_unsigned_mul_overflows() 2022-11-21 12:56:33 -07:00
Behdad Esfahbod 25adbb3825 [algs] Use __builtin_mul_overflow
Compiles to smaller binary.
2022-11-21 12:47:53 -07:00
Behdad Esfahbod a10cfe3f32 [algs] Write hb_in_ranges() recursively 2022-11-21 12:37:59 -07:00
Behdad Esfahbod 2e86700e30 [gvar] Add memory-barrier as in ArrayOf 2022-11-21 12:28:10 -07:00
Behdad Esfahbod b00a911fa7 [sorted-array] Add faster iterator implementation here as well 2022-11-21 12:11:30 -07:00
Behdad Esfahbod 7cc79a8a86 [vector] Adjust comment 2022-11-21 12:09:24 -07:00
Behdad Esfahbod e82a3c69dd [array/vector] Optimize range-based for-loop
Avoid bounds-checking.
2022-11-21 12:00:10 -07:00
Behdad Esfahbod 0387182c2a [ot-map] Minor refactor features[i] access 2022-11-21 11:05:47 -07:00
Behdad Esfahbod 5ee6d5d77e [cff] Add memory-barrier to INDEX
Like we do for ArrayOf.
2022-11-21 11:00:29 -07:00
Behdad Esfahbod 6905d36d73 [cff] Fix fetch_op() bounds-checking 2022-11-21 10:51:33 -07:00
Behdad Esfahbod b51ab1a9e5 [cff] Optimize byte_str_ref_t
Make it 16 bytes instead of 24.  This struct is used in the subroutine
call stack heavily.

This change makes the HB AdobeVFPrototype benchmark to become faster
than FT one, with about 6% speedup as a result of this change.
2022-11-21 10:27:07 -07:00
Behdad Esfahbod 7a39464b18 [cff] Hide members of byte_str_ref_t 2022-11-21 09:48:54 -07:00
Behdad Esfahbod 18141f0007 [cff] Move a sub_array call
No logic change.... I hope?!
2022-11-21 09:47:03 -07:00
Behdad Esfahbod f66415cdd1 [cff] Move initialization of a type to constructor 2022-11-21 09:40:16 -07:00
Behdad Esfahbod 70a5cd53f6 [algs] Assert trivial copy assignable in stable_sort 2022-11-21 08:52:33 -07:00
Behdad Esfahbod 9bb39423f5 [algs] Simplify stable_sort signatures 2022-11-20 17:40:54 -07:00
Behdad Esfahbod d119568df6 [cbdt] Use vector tail() 2022-11-20 14:11:51 -07:00
Behdad Esfahbod 87a88117c8 [object] Use vector tail() 2022-11-20 14:10:39 -07:00
Behdad Esfahbod 76ce390b5a [ucd] Document algorithms 2022-11-20 13:54:56 -07:00
Behdad Esfahbod ed43bc5118 [buffer] Move delete_glyphs_inplace() here 2022-11-20 13:10:19 -07:00
Behdad Esfahbod dd88dae8a9 [unicode] Simplify set_funcs a bit more 2022-11-19 15:23:53 -07:00
Behdad Esfahbod 2d8ff3bcbe [unicode] Destroy user_data in set_funcs fail paths
This is what the font_funcs / draw_funcs do.
2022-11-19 15:23:44 -07:00
Behdad Esfahbod 527823ccac [unicode] Destroy user_data in set_funcs fail paths
This is what the font_funcs / draw_funcs do.
2022-11-19 15:19:08 -07:00
Behdad Esfahbod 56d6b6992b [font/draw] Remove unneeded branch
The preamble sets user_data/destroy to nullptr if func is nullptr.
2022-11-19 15:11:59 -07:00
Behdad Esfahbod 976bb26cc1 [draw] Optimize set_func functions 2022-11-19 15:06:23 -07:00
Behdad Esfahbod 114167a933 [font] Optimize set_func functions 2022-11-19 14:47:45 -07:00
Behdad Esfahbod f9d7b303ed [thai] Use smaller type for arrays
No logic change.
2022-11-19 14:20:36 -07:00
Behdad Esfahbod 72c4e431af [use-table] Add a OPTIMIZE_SIZE version 2022-11-19 13:40:33 -07:00
Behdad Esfahbod 83c3a91dc6 [gen-use-table] Report fullCost 2022-11-19 13:34:58 -07:00
Behdad Esfahbod ba08de624e [ucd] Change OPTIMIZE_SIZE to compression level 9
Also changes default compression level from 3 to 5, but that shows
no change in the generated table size.
2022-11-19 13:25:19 -07:00
Behdad Esfahbod b68f9f3cfe [machinery] Adjust comment 2022-11-18 21:36:01 -07:00
Behdad Esfahbod a47ba1dc0e [lazy-pointer] Hide instance 2022-11-18 21:14:07 -07:00
Behdad Esfahbod 281b4705b4 [pool] Rewrite a loop as dagger 2022-11-18 20:25:05 -07:00
Behdad Esfahbod 3ff8abf272 Revert "[map] Allow std::move-ing keys into the map"
This reverts commit f657ef7e57.

This breaks many compilers with messages like this:

hb-subset-plan.hh:226: undefined reference to `OT::head::tableTag'

I'm out of my depth re how to fix it.
2022-11-18 19:38:12 -07:00
Behdad Esfahbod 039e476bac [test-vector] Test sink-move'ing 2022-11-18 19:26:02 -07:00