Commit Graph
128 Commits
Author SHA1 Message Date
Behdad Esfahbod 9b043da781 [shape] Use a buffer scratch flag for fraction slash (#5587)
* [shape] Use a buffer scratch flag for fraction slash

* Remove unused non-ascii scratch flag
2025-09-24 14:39:38 -06:00
Behdad Esfahbod 62ec647087 [shape] Use a buffer scratch flag for continuations (#5586)
Use it in form_clusters instead of ascii flag, for speedup.
2025-09-23 23:49:57 -06:00
Behdad Esfahbod 7750fc2cf2 [buffer] Remove HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS (#5583)
It complicated correctness analysis. Remove it and always
propagate flags, which are much faster now anyway.
2025-09-23 18:56:53 -06:00
Behdad Esfahbod e3a5152b0e [buffer] Micro-opt next_glyphs() 2025-09-23 11:55:26 -04:00
Behdad Esfahbod ccfd1ae2d6 [buffer] Retain digest in the buffer
We don't have to reinitialize it for GPOS now, showing some
1.5% speedup on Roboto-Regular benchmark.

Over time we can change the various gsub_pauses to update the digest
in-place instead of returning true.
2025-09-22 16:49:29 -04:00
Behdad Esfahbod 598da8c888 [buffer] Add some buffer op accounting to a few methods (#5522)
Should fix a fuzzer-found issue, now that we have increased
most buffer limits.
2025-09-02 14:21:08 -06:00
Behdad Esfahbod 141df8b97f [buffer] Adjust inlining 2025-08-27 16:09:35 -06:00
Behdad Esfahbod b51de93600 Remove duplicate buffer->leave call (#5487)
* Remove duplicate buffer->leave call

hb-shape.cc does it for us.

* Fail shaping if max len reached

* Increase buffer limits

https://github.com/harfbuzz/harfrust/issues/107

* Remove shaping_failed; fail in buffer.successful
2025-08-20 23:15:46 -06:00
Behdad Esfahbod c6153c738f [buffer] Micro-optimize next_glyph() (#5472) 2025-08-16 16:52:02 -06:00
Behdad Esfahbod 905e8b6bdd [buffer] Fix set_glyph_flags condition
Follow up to https://github.com/harfbuzz/harfbuzz/pull/5315
2025-05-08 13:24:12 -06:00
Behdad Esfahbod 089e73a764 [buffer] Allow unsafe_to_break() whole buffer to succeed
Fixes https://github.com/harfbuzz/harfbuzz/pull/5315
2025-05-07 16:11:37 -06:00
Behdad Esfahbod 0d8717275a [buffer] Limit the extent of set_flags range
We can easily get into O(n^2) otherwise.
2025-04-22 15:40:06 -06:00
Behdad Esfahbod 17c875c309 [buffer] Minor add a function 2025-03-28 16:26:27 -06:00
Behdad Esfahbod 6d95c12871 [buffer] Remove unused includes 2025-02-12 11:12:40 +00:00
Behdad Esfahbod b13017e651 Use HB_ALWAYS_INLINE instead of bare __attribute__
The former works on MSVC too.
2025-02-09 08:00:18 +00:00
Behdad Esfahbod 6091abcc9b [buffer] Avoid a copy in collect_codepoints() 2025-02-06 02:40:24 +00:00
Behdad Esfahbod e5e3bc4080 [buffer] Merge two functions into a template 2025-02-06 02:37:10 +00:00
Behdad Esfahbod 403f12f766 [buffer] A few always-inline's 2025-02-06 02:33:41 +00:00
Behdad Esfahbod d40c079fed [morx] Use hb_bit_set_t instead of hb_set_t directly 2025-02-05 12:30:56 +00:00
Behdad Esfahbod 474bef1cfd [aat] Use exact set for buffer intersection versus subchains 2025-02-04 22:30:42 +00:00
Behdad Esfahbod b94a39d7f3 Follow up to variation-selector-not-found glyph
Addresses https://github.com/harfbuzz/harfbuzz/pull/4529#discussion_r1769638033

I'm not sure if this is an improvement. By leaving the var-selector
as default-ignorable, ligatures can form around it, and the resulting
cluster won't make it clear *which* base+var-selector could not be
resolved... That doesn't quite help font fallback the way we want.
Putting up for review.
2024-09-23 06:30:59 -06:00
Behdad Esfahbod a003890e84 [buffer] Add hb_buffer_[sg]et_not_found_variation_selector_glyph()
Unused.
2024-09-21 12:21:56 -06:00
Behdad Esfahbod f1ac867dee [buffer] Add API for random state
Fixes https://github.com/harfbuzz/harfbuzz/issues/4620

New API:
+hb_buffer_set_random_state()
+hb_buffer_get_random_state()
2024-03-20 14:44:22 -06:00
Behdad Esfahbod b2a73166d4 [buffer] Fix unsafe_to_concat()
Ouch!
2023-07-30 11:25:58 -06:00
Behdad Esfahbod 4e641103d4 [buffer] Inline a method 2023-07-16 07:40:20 -06:00
Behdad Esfahbod ccfd7ef08c Merge pull request #4131 from harfbuzz/wasm
[wasm] WebAssembly shaper
2023-05-17 16:00:33 +02:00
Behdad Esfahbod 7b9832deab [buffer] Whitespace 2023-04-29 12:56:07 -06:00
Behdad Esfahbod c1dc112121 [wasm-api] Bind buffer_set_contents 2023-03-31 17:33:44 -06:00
Behdad Esfahbod 1930760bc2 [buffer] Fix up previous commit
https://github.com/harfbuzz/harfbuzz/commit/85be877925ddbf34f74a1229f3ca1716bb6170dc#commitcomment-99547060
2023-02-06 15:54:09 -07:00
Behdad Esfahbod 30b84faba7 [buffer] Optimize _infos_set_glyph_flags to avoid O(n^2) behavior
https://github.com/harfbuzz/harfbuzz/commit/85be877925ddbf34f74a1229f3ca1716bb6170dc#commitcomment-99547060
2023-02-06 15:27:13 -07:00
Behdad Esfahbod 0b97ac39ac [buffer] Optimize _infos_find_min_cluster for monotone clusters 2023-02-06 15:17:09 -07:00
Behdad Esfahbod ae208963df Add hb-limits.hh 2022-12-26 12:30:39 -07:00
Behdad Esfahbod ed43bc5118 [buffer] Move delete_glyphs_inplace() here 2022-11-20 13:10:19 -07:00
Behdad Esfahbod dff1b809a0 [buffer] Add .digest() and use 2022-11-16 16:19:05 -07:00
Behdad Esfahbod f43dadb8ee Rename kashida -> tatweel 2022-07-30 10:23:03 -06:00
Behdad Esfahbod d277addb2f [buffer] Add HB_BUFFER_FLAG_PRODUCE_SAFE_TO_INSERT_KASHIDA 2022-07-30 10:10:21 -06:00
Behdad Esfahbod 915e12ccbb Prototype glyph flag safe-to-kashida
Fixes https://github.com/harfbuzz/harfbuzz/issues/3721
2022-07-30 10:05:36 -06:00
Behdad Esfahbod 0722b627f4 [buffer] Return delta from sync_so_far 2022-07-24 17:35:44 -06:00
Behdad Esfahbod c55c019771 [buffer] Add assertions of buffer sync status to message_impl 2022-07-24 16:30:33 -06:00
Behdad Esfahbod da9edce84c [buffer] Add sync_so_far()
This removes separate out-buffer, at the cost of possibly changing
idx.
2022-07-24 16:30:19 -06:00
Behdad Esfahbod 31e985d7d1 [buffer] Likely that not messaging 2022-06-27 16:32:02 -06:00
Behdad Esfahbod 148283d0e0 [syllabic] Use a buffer scratch-flag for has-broken-syllable 2022-06-10 07:48:39 -06:00
Behdad Esfahbod 104dc85a22 [buffer] Add try_allocate for buffer variables 2022-06-05 08:15:46 -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 6fbb552156 s/FLAG_COMPLEX/FLAG_SHAPER/g 2022-06-03 10:30:34 +01:00
Behdad Esfahbod f3f9fc1544 [buffer] Mark glyph_flags_t as flags 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 56f11ec938 [buffer] Add HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT
Fixes https://github.com/harfbuzz/harfbuzz/issues/3454
2022-02-18 17:52:27 -06:00
Behdad Esfahbod b263371b09 Merge pull request #3398 from harfbuzz/buffer-verify
Add HB_BUFFER_FLAG_VERIFY
2022-02-12 15:06:47 -06:00
Behdad Esfahbod 8670ffbf4c [buffer] Comment 2022-02-03 11:19:23 -06:00