Commit Graph

10559 Commits

Author SHA1 Message Date
Behdad Esfahbod 5963cf4469 [gsubgpos] Merge cache_enter and cache_leave entry points
Saves a pointer per subtable
2022-06-07 09:17:14 -06:00
Behdad Esfahbod d4c09e9a87 [gsubgpos] Remove apply_cached() entry point
Just use a bool to apply()
2022-06-07 09:17:14 -06:00
Behdad Esfahbod b96622d15c [layout] Use a cache for main input ClassDef of (Chain)ContextLookupFormat2
This commit adds a per-lookup caching infrastructure to GSUB/GPOS, and
uses it to cache input ClassDef.get_class value for (Chain)ContextLookupFormat2.

For fonts heavy on use of heave class-based2 context matching, this shows
a good speedup. For NotoNastaliqUrdu for example, I observe 17% speedup.

Unfortunately not many other lookups can use a cache like this :(.

https://github.com/harfbuzz/harfbuzz/pull/3636
2022-06-07 09:14:38 -06:00
Xavier Claessens 4266f4e29a Fix check-* scripts when harfbuzz is a subproject
When harfbuzz is a subproject paths are in the form
"subprojects/harfbuzz/src/...". Instead of removing "src/" prefix, take
the absolute path and make it relative to current source dir.

This fix regression introduced in
https://github.com/harfbuzz/harfbuzz/pull/3394.
2022-06-06 16:53:29 +01:00
Behdad Esfahbod 15543f70e0 [indic-like] Move allocation of syllable() buffer var to shapers that use it
In indic, we don't have a pause location release the var.
2022-06-05 08:15:47 -06:00
Behdad Esfahbod 104dc85a22 [buffer] Add try_allocate for buffer variables 2022-06-05 08:15:46 -06:00
Behdad Esfahbod b5f621b08d [cplusplus] Internally allow using hb_unique_ptr with hb_free()
...for arbitrary types.
2022-06-05 08:15:31 -06:00
Behdad Esfahbod f18eb000d3 [buffer] Mark a variable as unused
Weird. Somehow our HB_TINY bot started erring as this var being unused
in non-debug builds. Not sure why now...

    In file included from src/hb-ot-map.hh:32:0,
                     from src/hb-ot-shape.hh:32,
                     from src/hb-aat-layout.hh:32,
                     from src/hb-aat-layout.cc:30,
                     from src/harfbuzz.cc:1:
    src/hb-buffer.hh: In member function ‘void hb_buffer_t::assert_var(unsigned int, unsigned int)’:
    src/hb-buffer.hh:192:18: error: unused variable ‘bits’ [-Werror=unused-variable]
         unsigned int bits = (1u<<end) - (1u<<start);
                      ^~~~
cc1plus: some warnings being treated as errors
Error: Process completed with exit code 1.
2022-06-05 07:06:07 -06:00
Behdad Esfahbod e6409d3905 Revert "[layout] Use a cache for main input ClassDef of (Chain)ContextLookups"
This reverts commit 57d1c08739.

Err. This was an accident.
2022-06-05 06:57:37 -06:00
Behdad Esfahbod 57d1c08739 [layout] Use a cache for main input ClassDef of (Chain)ContextLookups 2022-06-05 06:54:19 -06:00
Behdad Esfahbod 92e81ab1df [indic/khmer/myanmar] Shift category numbers around to avoid overlap
Fixes https://github.com/harfbuzz/harfbuzz/issues/3632
2022-06-05 01:14:32 -06:00
Behdad Esfahbod d6dbc0d175 [gi/ft] Silence warnings
gi doesn't understand that FT_Face is a pointer, and not bare struct.
So it skips these APIs anyway. Mark skip to silense the warning.

../src/hb-ft.cc:242: Warning: HarfBuzz: hb_ft_font_get_face: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip)
../src/hb-ft.cc:264: Warning: HarfBuzz: hb_ft_font_lock_face: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip)
2022-06-05 00:58:53 -06:00
Behdad Esfahbod f78a25098a [gi] Remove Xconstructor annotations 2022-06-05 00:55:35 -06:00
Behdad Esfahbod cb961eac5c [configs] Fix builds with HB_NO_BUFFER_SERIALIZE but not HB_NO_BUFFER_VERIFY
e986c12075 (commitcomment-75339317)
2022-06-05 00:45:29 -06:00
Behdad Esfahbod 67852504f6 [indic/myanmar] No-op update to machines 2022-06-04 09:27:45 -06:00
Behdad Esfahbod 20a61ca447 [myanmar] Fold D category into GB
Trying to free a byte the buffer vars, for caching of lookups.

Part of https://github.com/harfbuzz/harfbuzz/issues/3633
2022-06-04 09:27:37 -06:00
Behdad Esfahbod f9b643f6b2 [layout] s/hb_get_subtables_context_t/hb_accelerate_subtables_context_t/g 2022-06-04 09:27:31 -06:00
Behdad Esfahbod d4dfb8c1f1 [arabic] Free up buffer variable earlier 2022-06-04 09:27:23 -06:00
Behdad Esfahbod cc7ebb0ffa Remove remaining mention to complex shapers in the code
https://github.com/harfbuzz/harfbuzz/pull/3628#issuecomment-1146248037
2022-06-04 05:42:58 -06:00
Behdad Esfahbod b39b5f2f31 [name] Implement approximate language matching
Very rudimentary.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3354
2022-06-03 13:00:33 +01:00
Behdad Esfahbod 40d7d56e53 [subset-input] Minor move 2022-06-03 05:40:18 -06:00
Behdad Esfahbod 40193adbfc [subset] Update default features list 2022-06-03 05:35:19 -06:00
Behdad Esfahbod 5bfb0b721c Rename s/shape-complex/shaper/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod 44be1e5dfb s/SHAPE_COMPLEX/SHAPER/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod 6fbb552156 s/FLAG_COMPLEX/FLAG_SHAPER/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod 6d9e94d2b8 s/hb_ot_shape_complex_categorize/hb_ot_shaper_categorize/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod a560182cb3 s/complex_var/ot_shaper_var/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod 13fbed29e4 s/HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS/HB_OT_SHAPE_MAX_COMBINING_MARKS/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod 44a7b3b773 s/ot_complex_shaper/ot_shaper/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod e5161977a4 s/COMPLEX_SHAPER/OT_SHAPER/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod f3a8b7f36b [algs] Test hb_hash() 2022-06-03 02:21:46 -06:00
Behdad Esfahbod 215a0afad1 [algs] Remove unused hb_coerce() 2022-06-03 01:48:46 -06:00
Behdad Esfahbod 5dc12d7d8d [cmap] Rewrite set_for() slightly 2022-06-03 01:37:02 -06:00
Behdad Esfahbod 9552955e08 Add an unlikely 2022-06-03 01:33:01 -06:00
Behdad Esfahbod 88f00ecb84 [map] Fix iter_ref () and test it 2022-06-03 01:30:27 -06:00
Behdad Esfahbod a42c624fca Convert one final use of hashmap to unique_ptr 2022-06-03 01:22:34 -06:00
Behdad Esfahbod f13a79548f [subset] Convert another use of hashmap to unique_ptr 2022-06-03 01:17:20 -06:00
Behdad Esfahbod 25f57230d5 [map] Return references from new iter_ref() 2022-06-03 01:14:35 -06:00
Behdad Esfahbod a7a688616a [cmap] Convert another map use to unique_ptr 2022-06-02 18:59:15 -06:00
Behdad Esfahbod 997d9cc466 [map] Make unique_ptr hashable 2022-06-02 18:47:42 -06:00
Behdad Esfahbod 8bb2a3326e [map] Remove unneeded assignment 2022-06-02 15:18:23 -06:00
Behdad Esfahbod d7785a6da0 [cplusplus] Add unique_ptr 2022-06-02 12:43:04 -06:00
Behdad Esfahbod bca710e8ad [gsubgpos] Use map has() instead of get() when appropriate 2022-06-02 12:06:25 -06:00
Behdad Esfahbod e9407a2bd2 Use shared_ptr<hb_set_t> in one place
See if valgrind is happy...
2022-06-02 12:00:43 -06:00
Behdad Esfahbod a42a703cb6 [shared_ptr] Clear p in destructor 2022-06-02 12:00:43 -06:00
Behdad Esfahbod f0a0dcad70 [test-map] Test hashing shared_ptr 2022-06-02 11:25:56 -06:00
Behdad Esfahbod 4c1b5d9ece Whitespace 2022-06-02 11:25:11 -06:00
Behdad Esfahbod b9230c5425 [map] Fix has() 2022-06-02 11:23:38 -06:00
Behdad Esfahbod 97ea10a63a Remove old nullptr_t hacks
Were used for hashmap before.
2022-06-02 11:23:38 -06:00
Behdad Esfahbod 3f78a71ca0 [map] Finally! Just can usd hb_hashmap_t<obj_t, obj_t>
Yay!
2022-06-02 11:23:37 -06:00
Behdad Esfahbod 0ccab339f9 [map] Remove invalid-key template arguments since unused 2022-06-02 11:23:37 -06:00
Behdad Esfahbod 3f6a8f69a0 [map] Remove invalid-key special-casing
Can override invalid-key value now.
2022-06-02 11:23:37 -06:00
Behdad Esfahbod 5328b73fba [map] Reduce map item size again 2022-06-02 11:23:37 -06:00
Behdad Esfahbod 4f58ae60eb [map] Keep is_used, is_tombstone as booleans 2022-06-02 11:23:37 -06:00
Behdad Esfahbod 7ec3aad20f [shared_ptr] Fix hb_hash() crash on nullptr 2022-06-02 18:22:05 +01:00
Behdad Esfahbod 4d646773cf [cplusplus] Make .reference() return T* 2022-06-02 18:22:05 +01:00
Behdad Esfahbod 7e7a4a8f05 [cplusplus] Fix build 2022-06-02 18:22:05 +01:00
Behdad Esfahbod a089d91fda [hash] Adjust hash for shared_ptr, implement it for std::hash 2022-06-02 18:22:05 +01:00
Behdad Esfahbod e037325efb [hash] Remove custom hash, rely on std::hash 2022-06-02 18:22:05 +01:00
Behdad Esfahbod 0d3d5b62ae [cplusplus] Adjustments 2022-06-02 18:22:05 +01:00
Behdad Esfahbod 0b35940a72 Make hb::shared_ptr hashable 2022-06-02 18:22:05 +01:00
Behdad Esfahbod 3817bdfd7f [hb.hh] Include hb-cplusplus.hh 2022-06-02 18:22:05 +01:00
Behdad Esfahbod e0f3cab246 [cplusplus] Add hb-cplusplus.hh
Fixes https://github.com/harfbuzz/harfbuzz/issues/2152
2022-06-02 18:22:05 +01:00
Garret Rieger 98aaecd397 [subset] fix data race touching Crap() in cff subsetting. 2022-06-01 22:50:35 +01:00
Behdad Esfahbod c88a6a9ec3 [face] Remove const from get_user_data prototype
This was done by mistake.

Since the returned user_data can be changed, face should not be marked
const. Other object types follow this parttern.
2022-06-01 09:46:41 -06:00
Behdad Esfahbod bc6ecaa262 [font-funcs] Handle case of null func but non-null destroy or user-data 2022-06-01 16:38:12 +01:00
Behdad Esfahbod 88ccbd2c43 [font-funcs] Optimize user-data/destroy storage
Fixes https://github.com/harfbuzz/harfbuzz/issues/2427
2022-06-01 16:38:12 +01:00
Behdad Esfahbod e421613e8f [sbix] Fix conditional 2022-06-01 09:07:57 -06:00
Behdad Esfahbod 55b911d863 [buffer] Mark getter functions as taking const buffer
Fixes https://github.com/harfbuzz/harfbuzz/issues/2873
2022-06-01 08:13:06 -06:00
Behdad Esfahbod 9e1479b5f0 [morx] Limit context length
Fixes https://github.com/harfbuzz/harfbuzz/issues/3097
2022-06-01 07:54:45 -06:00
Behdad Esfahbod 62e803b361 [sbix] Limit glyph extents
Fixes https://github.com/harfbuzz/harfbuzz/issues/3557
2022-06-01 07:39:20 -06:00
Behdad Esfahbod cd05d187c8 [font] Fix undefined-behavior when scales are negative
Fixes https://github.com/harfbuzz/harfbuzz/issues/3555
2022-06-01 07:27:53 -06:00
Behdad Esfahbod fc4d42ff99 [ft] Add API to notify that hb_font_t changed
New API:
- hb_ft_hb_font_changed()

Mostly reverts 56e0ff9ea1

Related https://github.com/harfbuzz/harfbuzz/issues/2270

Fixes https://github.com/harfbuzz/harfbuzz/issues/3619
2022-06-01 14:12:38 +01:00
Behdad Esfahbod e246723f0c [shape] Fail shaping internally if buffer ops exceeded 2022-06-01 05:00:06 -06:00
Behdad Esfahbod 9c0c31dfaa [buffer] When deleting glyphs, check cluster backwards as well 2022-06-01 04:52:10 -06:00
Behdad Esfahbod 0384f80e78 [buffer-verify] If shaping buffers failed during verification, pass the test 2022-06-01 04:50:15 -06:00
Behdad Esfahbod eba626ff6a [shape-plan] Return empty plan if buffer direction is invalid
Happens if buffer creation failed.
2022-06-01 04:49:46 -06:00
Behdad Esfahbod a441c6c16b [shape] Only verify if text_buffer is successful 2022-06-01 04:49:39 -06:00
Behdad Esfahbod f7f61aeb6f [buffer] Add TODO item 2022-06-01 04:48:59 -06:00
Behdad Esfahbod d72d37008d [shape] Allow null buffer
Ouch!
2022-06-01 04:48:40 -06:00
Behdad Esfahbod 45a2252607 [flags] Fix undefined-behavior
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/hb-buffer.hh:60:1 in
failure on clusterfuzz-testcase-minimized-hb-subset-get-codepoints-fuzzer-5736539338833920
2022-05-31 06:35:42 -06:00
Behdad Esfahbod f3f9fc1544 [buffer] Mark glyph_flags_t as flags 2022-05-31 06:35:42 -06:00
Behdad Esfahbod ab143e85c3 [buffer] Add HB_BUFFER_FLAG_DEFINED and HB_BUFFER_SERIALIZE_FLAG_DEFINED
New API:
+ HB_BUFFER_FLAG_DEFINED
+ HB_BUFFER_SERIALIZE_FLAG_DEFINED
2022-05-31 06:35:42 -06:00
Behdad Esfahbod 9a2a857043 [ot-shape] Don't verify buffer if shaping failed
Fixes all of fuzzing verify failures, which were result of buffer failure
on super-long results, which fails unsafe-to-break because shorter strings
don't fail shaping.
2022-05-31 06:35:42 -06:00
Behdad Esfahbod f8b26f43ec
Merge pull request #3606 from harfbuzz/32bit-varstore
32bit varstore
2022-05-31 11:22:32 +01:00
Behdad Esfahbod 5af5a56593 [VarStore] Implement writing 32bit var-store
Untested.

Finishes fixing https://github.com/harfbuzz/harfbuzz/issues/2965
2022-05-31 03:58:35 -06:00
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
Xavier Claessens 334bd013d9 Skip warning when building as subproject and ragel is missing
It is unlikely to be a developer build in that case.
2022-05-30 18:27:33 +02:00
Behdad Esfahbod e5d6da7905 [varStore] rename shortCount to wordCount 2022-05-30 07:48:58 -06:00
Behdad Esfahbod d11455f285 [blob] Fix strncpy() use in Mac resource opening code
Fixes https://github.com/harfbuzz/harfbuzz/issues/3616
2022-05-30 06:59:03 -06:00
Behdad Esfahbod ea2dd54b68 [map] Place item hash between key and value, not after them
This way if only one of key and value is 64bit (eg. pointer), and other is 32bit,
the whole item will fit in 128bit, whereas before it would have been bumped up to
196 if only value was 64bit (a common use-case for us.)
2022-05-30 05:54:20 -06:00
Behdad Esfahbod ec6cefc46a [repacker] Simplify map types 2022-05-30 05:54:20 -06:00
Behdad Esfahbod cbcdf442c5 [map] Speed up map's own hash() 2022-05-30 05:54:20 -06:00
Behdad Esfahbod de33ef61b7 [map] Add TODO item 2022-05-30 05:54:20 -06:00
Behdad Esfahbod fc5739ea90 [test-map] Whitespace 2022-05-30 05:54:20 -06:00
Behdad Esfahbod 3e64abd5d6
Merge pull request #3613 from harfbuzz/threads-test
Threads test
2022-05-30 05:52:21 -06:00
Behdad Esfahbod efa4385b16
Merge pull request #3615 from harfbuzz/gir-freetype
[gi] Add freetype2-2.0 for g-i-r includes
2022-05-30 05:40:56 -06:00
Behdad Esfahbod f4a8b70016 More member initialization 2022-05-30 05:30:37 -06:00
Behdad Esfahbod 484cc18732 [test-shape-threads] Set language 2022-05-30 05:09:53 -06:00
Behdad Esfahbod 315ef83b4e Revert "Revert "[ot-lang] Use atomic int for cache""
This reverts commit c56ce8681c.

The revert was not intentional. Ouch!
2022-05-30 05:09:26 -06:00
Khaled Hosny 3427511988 [gi] Add freetype2-2.0 for g-i-r includes
Fixes the warnings:
../src/hb-ft.cc:810: Warning: HarfBuzz: hb_ft_face_create: argument ft_face: Unresolved type: 'FT_Face'
../src/hb-ft.cc:886: Warning: HarfBuzz: hb_ft_face_create_cached: argument ft_face: Unresolved type: 'FT_Face'
../src/hb-ft.cc:855: Warning: HarfBuzz: hb_ft_face_create_referenced: argument ft_face: Unresolved type: 'FT_Face'
../src/hb-ft.cc:920: Warning: HarfBuzz: hb_ft_font_create: argument ft_face: Unresolved type: 'FT_Face'
../src/hb-ft.cc:1029: Warning: HarfBuzz: hb_ft_font_create_referenced: argument ft_face: Unresolved type: 'FT_Face'
../src/hb-ft.cc:240: Warning: HarfBuzz: hb_ft_font_get_face: return value: Unresolved type: 'FT_Face'
../src/hb-ft.cc:262: Warning: HarfBuzz: hb_ft_font_lock_face: return value: Unresolved type: 'FT_Face'
2022-05-30 04:48:22 +02:00
Behdad Esfahbod 97aa1ce6ba [gsubgpos] Move some member initialization 2022-05-29 10:56:41 -06:00
Behdad Esfahbod 0bb4c1f021 [cache] Set default values for cache template parameters 2022-05-29 10:23:19 -06:00
Behdad Esfahbod 3957d2927d [layout] Remove stale comment 2022-05-29 07:30:58 -06:00
Behdad Esfahbod b6fed6f711 [set-digest] Minor don't use !! when auto bool conversion happens 2022-05-29 06:33:34 -06:00
Behdad Esfahbod 371e14d99c Combine uses of map has() then get() with has(.., &..) 2022-05-28 13:40:30 -06:00
Behdad Esfahbod b99efa6c8d [map] Minor: use const reference in has() 2022-05-28 05:16:34 -06:00
Behdad Esfahbod 24d5a11dcb [bimap] Add unlikely and minor optimization in is_empty() 2022-05-28 05:14:16 -06:00
Behdad Esfahbod c56ce8681c Revert "[ot-lang] Use atomic int for cache"
This reverts commit d61b207491.
2022-05-28 04:25:51 -06:00
Behdad Esfahbod 63bc6be0cf
Merge pull request #3603 from harfbuzz/font-serial
Add font serial API
2022-05-27 08:25:22 -06:00
Behdad Esfahbod e2aa29907d [set] Use relaxed atomic ops for last_page_index
Since iterating a set from multiple threads is supported.
2022-05-27 07:06:02 -06:00
Behdad Esfahbod d61b207491 [ot-lang] Use atomic int for cache
Fixes(?) https://github.com/harfbuzz/harfbuzz/issues/3612
2022-05-26 18:24:43 -06:00
Behdad Esfahbod 67bd147c73
Merge pull request #3610 from googlefonts/subset_create_tables_face
[subset] fix subsetting of faces created via hb_face_create_for_tables.
2022-05-26 05:16:07 -06:00
Behdad Esfahbod a719e67887 [ot-font] Use atomic ops for cache serial number
This guarantees the cache is coherent.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 5248b2567b [ot-font/h-advance] Adjust varStore cache condition
This gives best performance for short strings, now that we have a h-advance cache as well.
The en-words benchmark in particular, now ot-font is faster than ft.

Second to last line is of interest:

Before:
-----------------------------------------------------------------------------------------------------
Benchmark                                                           Time             CPU   Iterations
-----------------------------------------------------------------------------------------------------
BM_Shape/en-words.txt/Roboto-Regular.ttf/hb                      29.8 ms         29.8 ms           23
BM_Shape/en-words.txt/Roboto-Regular.ttf/ft                      30.4 ms         30.4 ms           23
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/hb           16.3 ms         16.3 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/ft           16.5 ms         16.5 ms           42
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/hb       18.0 ms         18.0 ms           39
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/ft       17.8 ms         17.8 ms           39

After:
behdad@Behdads-MacBook-Pro harfbuzz % ninja -Cbuild && build/perf/benchmark-shape --benchmark_filter=en-words
-----------------------------------------------------------------------------------------------------
Benchmark                                                           Time             CPU   Iterations
-----------------------------------------------------------------------------------------------------
BM_Shape/en-words.txt/Roboto-Regular.ttf/hb                      30.0 ms         30.0 ms           23
BM_Shape/en-words.txt/Roboto-Regular.ttf/ft                      30.3 ms         30.3 ms           23
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/hb           16.3 ms         16.3 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/ft           16.4 ms         16.4 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/hb       17.6 ms         17.6 ms           40
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/ft       17.8 ms         17.8 ms           39
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 12fff976b6 [ot-var] Use atomic int for cached-serial 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 0919eaa6e8 [ot-font] Remove lock around cache
Not needed.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 3548b6025f [ot-font] Cache h-advances for variable fonts 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 39a07bf3eb [ot-font] Rename cache to varStore_cache 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 970e03ecae [ot-font] Add a hb_ot_font_t struct 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 80c49933c6 [hb-ft] Adjust serial signature 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 56e0ff9ea1 [ft] If hb_font changed, update FT_Face
Fixes https://github.com/harfbuzz/harfbuzz/issues/2270

Rather untested.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod d0de389de8 [font] Fix test 2022-05-26 05:02:50 -06:00
Behdad Esfahbod a2015cd300 [font] Add a separate serial_coords 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 8629df188a [ft] Discard advance cache if font changed
Uses newly added font serial API.

Part of https://github.com/harfbuzz/harfbuzz/issues/2270

But doesn't set new coords on the FT_Face. That's a lot more
work :(.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 48db1c9583 [font] Add serial API
New API:
+ hb_font_get_serial()
+ hb_font_changed()

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

Unused internally as of now.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod efa2a5796e [map] Add hb_map_copy()
New API:
+ hb_map_copy()
2022-05-26 05:01:57 -06:00
Behdad Esfahbod 3b28cff9c0 [cff1] Fix null dereference on memory alloc failure 2022-05-26 04:42:17 -06:00
Behdad Esfahbod 8df9aba997 Actually try to fix null-size undefined behavior
Related to:
https://github.com/harfbuzz/harfbuzz/pull/2067
https://bugzilla.mozilla.org/show_bug.cgi?id=1577584
2022-05-26 03:59:21 -06:00
Garret Rieger e00c7358a0 [subset] special case table presence check for hb_face_create_from_tables faces. 2022-05-25 22:39:00 +00:00
Garret Rieger 6a149a09e7 [subset] fix use of lazy static constructor. 2022-05-25 22:22:35 +00:00
Garret Rieger d4c7939eb7 [subset] use a list of known tables instead of handled tables. 2022-05-25 22:11:32 +00:00
Garret Rieger 3472f73b79 [subset] also include no subset tables when guessing which tables are present. 2022-05-25 21:52:48 +00:00
Garret Rieger 9564d98739 [subset] fix subsetting of faces created via hb_face_create_for_tables.
Fixes #3609.
2022-05-25 21:16:37 +00: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 3eb7eff487 Remove varstore cache use if HB_NO_VAR 2022-05-21 15:25:53 -06:00
Behdad Esfahbod 099482a37a [ot-font] Cache v_advance varstore as well 2022-05-21 15:24:23 -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 5336ba70f6 [HVAR] Cache VarStore region scalars 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
Behdad Esfahbod 05e82aa12e [ft] Add missing lock to kerning function 2022-05-20 17:36:59 -06:00
Behdad Esfahbod 4ea2725704 [set/map] Expose hash API publicly
New API:
+ hb_set_hash()
+ hb_map_hash()
2022-05-20 13:19:48 -06:00
Behdad Esfahbod 2e186d9f24 [buffer] Improve hash function of segment_properties_t 2022-05-20 13:19:48 -06:00
Khaled Hosny aee123fc83 4.3.0 2022-05-20 21:07:25 +02:00
Behdad Esfahbod 975a5f9194 [array] Use hb_memcmp instead of memcmp
Fixes ubsan error.
2022-05-20 12:34:49 -06:00
Behdad Esfahbod 55804e8d68 [hb-ft] Minor rearrange of struct members
To make clear what members the lock protects.
2022-05-20 11:40:44 -06:00
Garret Rieger cbf8f44c9b [subset-perf] swap instead of copying vertice's when reordering during sort. 2022-05-20 09:41:18 -06:00
Garret Rieger b32ca2a292 [subset-perf] remove sort_kahn from repacker.
Without an optimized FIFO queue implementation it's nearly as slow as the now optimized sort_shortest_distance.
2022-05-20 09:41:18 -06:00
Behdad Esfahbod 4266cf3be2 [array] Specialize operator== for bytes_t and ubytes_t 2022-05-19 18:16:54 -06:00
Behdad Esfahbod 6eaa22e9d7 [serialize] Reduce link_t size from 16 to 12 2022-05-19 18:16:54 -06:00
Behdad Esfahbod 30ba9a39e2 [vector] Add emplacing push implementation 2022-05-19 18:16:48 -06:00
Garret Rieger 73b8360dcf [subset] fix fuzzer found underflow when heap push fails.
Fixes https://oss-fuzz.com/testcase-detail/5148625505746944.
2022-05-19 17:02:34 -06:00
Behdad Esfahbod f1bf14ea89 Revert "[set] Cache hash value"
This reverts commit 44952bcc25.

While we investivate https://github.com/harfbuzz/harfbuzz/issues/3599
2022-05-19 16:49:27 -06:00
Behdad Esfahbod b4d1ec310c [algs] Declare coerce() as constexpr 2022-05-19 16:06:21 -06:00
Behdad Esfahbod 2fdb7616f5 [map Further adjust hash function 2022-05-19 16:00:43 -06:00
Behdad Esfahbod 01fc90b68c [map] Adjust hash function 2022-05-19 16:00:06 -06:00
Behdad Esfahbod a47b0aebf5 [vector] Fix remove() implementation
test-vector under valgrind happy now.
2022-05-19 15:52:16 -06:00
Behdad Esfahbod 3bd755c32d [test-vector] Test remove()
Currently buggy. Valgrind confirms.
2022-05-19 15:51:18 -06:00
Behdad Esfahbod 58f848daa8 [set/map] Adjust hash function return type 2022-05-19 15:43:19 -06:00
Behdad Esfahbod 6544fc284f [vector] Add further copy implementation 2022-05-19 15:43:15 -06:00
Behdad Esfahbod c19f116952 [meta] Remove non-existing gcc4 trait implementation 2022-05-19 15:43:15 -06:00
Behdad Esfahbod 679b900e9b [meta] Fix gcc4 trait implementation 2022-05-19 15:43:15 -06:00
Behdad Esfahbod fb77f48ffd [vector] Optimize vector copy 2022-05-19 15:43:15 -06:00
Behdad Esfahbod 28b44ac46a [set] Switch set copy to vector operator =
Slows it down currently.
2022-05-19 15:43:15 -06:00
Behdad Esfahbod 37d3275dec [test-vector] Enable disabled test
This seems to work already.
2022-05-19 15:43:15 -06:00
Behdad Esfahbod 544ffb913e [set] Adjust grow_vector condition 2022-05-19 15:43:15 -06:00
Behdad Esfahbod 0623aa598b [benchmark-set] Add benchmark for set copy 2022-05-19 15:43:15 -06:00
Behdad Esfahbod 44952bcc25 [set] Cache hash value 2022-05-19 14:02:48 -06:00
Behdad Esfahbod 844ac328e4 [set] Fix hb_set_t hash stability 2022-05-19 13:54:31 -06:00
Behdad Esfahbod 2d0b1248b2 [test-map] Test hb_set_t hash stability
Fails currently.
2022-05-19 13:53:53 -06:00
Behdad Esfahbod 561e02fefb [map] Make hb_map_t hashable 2022-05-19 13:41:53 -06:00
Behdad Esfahbod ad17699089 [map] Add is_equal() / towards making hb_map_t hashable
New API:
+ hb_map_is_equal()
2022-05-19 13:36:12 -06:00
Behdad Esfahbod 14a24d8e3f [vector] Make hb_vector_t hashable 2022-05-19 13:04:06 -06:00
Behdad Esfahbod 124f9aeb9b [set] Make hb_set_t hashable 2022-05-19 12:58:02 -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
David Corbett e3e685e5ee [ot-tags] Fix `min_subtag_len` calculations 2022-05-18 18:30:01 -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 202e6c4699 [subset] Remove unnecessary test 2022-05-18 17:12:43 -06:00
Behdad Esfahbod cedf739646 Add some commented-out code 2022-05-18 16:53:26 -06:00
Behdad Esfahbod 6b62c10f02 [priority-queue] Remove old init/fini 2022-05-18 16:27:54 -06:00
Behdad Esfahbod bff8248a9d [repacker] Pre-alloc vertices 2022-05-18 16:25:03 -06:00
Behdad Esfahbod 39a424caf0 [priority-queue] Optimize heap access 2022-05-18 16:19:44 -06:00
Behdad Esfahbod 9308659fd7 [priority-queue] Optimize swap() 2022-05-18 16:14:25 -06:00
Behdad Esfahbod c7317ef761 [repacker] Avoid destroying and recreating objects 2022-05-18 16:03:41 -06:00
Behdad Esfahbod 864e09a0c4 [repacker] Reuse allocated vector 2022-05-18 15:59:29 -06:00
Behdad Esfahbod ca77f16470 [repacker] Remove unnecessary vector .fini() calls 2022-05-18 15:55:49 -06:00
Behdad Esfahbod 4cfc2d668e [subset] Use a std::move on set_t when feasible 2022-05-18 15:32:19 -06:00
Behdad Esfahbod 1f578b5a32 [set] Add pre-allocation internal API 2022-05-18 15:25:00 -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