Commit Graph

87 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 61823838f9 [buffer] Add HB_BUFFER_FLAG_VERIFY
Move buffer verification code inside the library, from util/.

Part of https://github.com/harfbuzz/harfbuzz/issues/3010
2022-01-28 13:53:44 -07:00
Behdad Esfahbod 3324606492 [buffer] Oops 2022-01-22 15:46:13 -07:00
Behdad Esfahbod 6e345f709d Cosmetic 2022-01-22 11:53:18 -07:00
Behdad Esfahbod 14d43d1235 [unsafe-to-concat] Adjust end conditions 2022-01-22 11:53:18 -07:00
Behdad Esfahbod ea1b32c8c1 [unsafe-to-concat] Adjust "interior"ness of "from_out_buffer" 2022-01-22 11:53:18 -07:00
Behdad Esfahbod c0058892be [unsafe-to-concat] Mark entire buffer unsafe-to-concat if kerx format2 2022-01-22 11:53:18 -07:00
Behdad Esfahbod d98a0fc88e [buffer] Consolidate glyph-flags implementation 2022-01-22 11:53:18 -07:00
Behdad Esfahbod f91ce56e08 [buffer] Add default cluster value in find_min_cluster 2022-01-22 11:53:18 -07:00
Behdad Esfahbod 56d081955c [buffer] Rename _unsafe_to_break_set_mask to _infos_set_glyph_flags 2022-01-22 11:53:18 -07:00
Behdad Esfahbod 3122c2cdc4 [buffer] Add HB_GLYPH_FLAG_UNSAFE_TO_CONCAT
Fixes https://github.com/harfbuzz/harfbuzz/issues/1463
2022-01-22 11:53:18 -07:00
Behdad Esfahbod bea5369c6d [buffer] Rename swap_buffers() to sync() 2022-01-04 10:52:05 -07:00
Behdad Esfahbod d1e7df5c3f [buffer] Add enter()/leave() pair around shape() 2022-01-04 07:32:04 -07:00
Behdad Esfahbod 43be5ba442 [buffer] Group shape-related members together 2022-01-04 07:26:53 -07:00
Behdad Esfahbod 52f5711ed0 [buffer] Add hb_buffer_create_similar()
Fixes https://github.com/harfbuzz/harfbuzz/issues/1555
2022-01-03 11:57:42 -07:00
Behdad Esfahbod f643b81ffc [buffer] Clean up internal state bookkeeping
hb_buffer_reset() was NOT resetting cluster_level. Ouch! Fix that.

Part of https://github.com/harfbuzz/harfbuzz/issues/1555
2022-01-03 11:45:31 -07:00
Behdad Esfahbod 5b995526f7 [buffer] Fix reverse_group() to reverse() at the end 2021-12-10 14:59:56 -07:00
Behdad Esfahbod 21c4fc1011 [buffer] Add optional merge_clusters arg to reverse_groups() 2021-12-10 13:02:43 -07:00
Behdad Esfahbod eb96e69d18 [buffer] Add foreach_group() 2021-12-10 12:55:29 -07:00
Behdad Esfahbod 1b78e04c78 [buffer] Add ::reverse_groups() 2021-12-10 12:45:43 -07:00
Behdad Esfahbod 4cd96e73e4 [buffer] Inline revers_range() / reverse() 2021-12-10 12:33:21 -07:00
Behdad Esfahbod 70f8c57e5c [buffer] Rename find_min_cluster 2021-12-04 19:49:23 -08:00
Behdad Esfahbod 94d43c008a [buffer] Merge and rename clear_glyph_flags() 2021-12-04 16:56:39 -08:00
Behdad Esfahbod da500568de [API] Add hb_buffer_[sg]et_not_found_glyph() and --not-found-glyph
Instead of using gid=0 when a character is not found in the font,
client can now set a custom value.  This is useful for shaper-driven
font fallback and to differentiate that from .notdef glyph.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1360
2021-10-26 08:02:29 -06:00
Behdad Esfahbod 95b04f7409 [buffer] Remove unnecessary have_separate_output() 2021-07-12 17:36:38 -06:00
Behdad Esfahbod 3e266e5f64 [buffer] Update comments 2021-07-12 17:36:36 -06:00
Behdad Esfahbod 3807061d63 [ot-layout] Don't remove_output() before reverse substitution
No need anymore, because of new swap_buffers() semantics.

Just assert instead.
2021-07-12 17:36:22 -06:00
Behdad Esfahbod 93e6a9bc4e Revert "Remove unneeded buffer clear_output / remove_output calls"
This reverts commit 06175b7143.

One of the sanitizers is failing. Pushing again as PR to debug.
I have suspicions.
2021-06-15 15:38:49 -06:00
Behdad Esfahbod 06175b7143 Remove unneeded buffer clear_output / remove_output calls
Made sure clear_output is always paired with swap_buffers.
Trying to see if we can move towards RAII-like buffer iterators
instead of the buffer keeping an iterator internally.
2021-06-15 14:33:27 -06:00
Behdad Esfahbod c61ce962cf [buffer] In hb_buffer_get_positions(), return NULL if inside message callback
As discussed in https://github.com/harfbuzz/harfbuzz/issues/2468#issuecomment-645666066

Part of fixing https://github.com/harfbuzz/harfbuzz/issues/2468
2021-06-10 17:36:38 -06:00
Behdad Esfahbod 9e397ff2fb [buffer] Fix order of HB_INTERNAL HB_DISCARD
Sucks that has to be specified in this order. But that is what it is for now.

Was only exhibiting problem on C++>=17 since that's when the [[nodiscard]]
was introduced.
2021-03-15 16:51:17 -06:00
Behdad Esfahbod 8450f43ae1 [buffer] HB_NODISCARD next_glyph() 2021-03-15 16:01:35 -06:00
Behdad Esfahbod f4bc7673db [buffer] Implement copy_glyph() in terms of output_info() 2021-03-15 16:01:35 -06:00
Behdad Esfahbod f73982a699 [buffer] Implement replace_glyph() in terms of replace_glyphs(1,1)
I get exact same binary size with this, suggesting that compiler is
optimizing these as needed.
2021-03-15 16:01:35 -06:00
Behdad Esfahbod 862f913489 [buffer] Implement output_glyph() in terms of replace_glyphs(0,1)
To my surprise, saves ~20kb in my build (non-size-optimized) build.
The output_glyph() method is never used in the fast paths, so doesn't
matter if is not fully optimized for the special case it is.
2021-03-15 16:01:35 -06:00
Behdad Esfahbod 34a1204f10 [buffer] HB_NODISCARD output_glyph()
Also, generalize and use replace_glyphs() in morx where output_glyph() was used
in a loop.
2021-03-15 16:01:35 -06:00
Behdad Esfahbod e6be9eb4fb [buffer] HB_NODISCARD output_info() 2021-03-15 14:12:10 -06:00
Behdad Esfahbod 2a0dbb3ee5 [buffer] HB_NODISCARD copy_glyph() 2021-03-15 14:10:39 -06:00
Behdad Esfahbod b05e5d9a79 [buffer] HB_NODISCARD next_glyphs() 2021-03-15 14:08:08 -06:00
Behdad Esfahbod 4ae8aab83b [buffer] HB_NODISCARD has_separate_output() 2021-03-15 14:01:52 -06:00
Behdad Esfahbod 8d3701f507 [buffer] HB_NODISCARD in_error() 2021-03-15 14:01:32 -06:00
Behdad Esfahbod 41e05479b6 [buffer] HB_NODISCARD shift_forward() 2021-03-15 14:00:00 -06:00