Commit Graph

299 Commits

Author SHA1 Message Date
Khaled Hosny 98e90cc67c [docs] Reduce warnings
Use markdown syntax for inline code blocks instead of %true, %false, and
%NULL.
2022-06-30 08:44:40 +02:00
Behdad Esfahbod 689c77530a [buffer] Actually remove TODO item
In reality, one side is smaller and one side is larger. The existing code
handles that just fine.
2022-06-10 07:37:45 -06:00
Behdad Esfahbod d09e962b9f [buffer] Update a TODO item 2022-06-10 07:36:43 -06:00
Behdad Esfahbod f78a25098a [gi] Remove Xconstructor annotations 2022-06-05 00:55:35 -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 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 f7f61aeb6f [buffer] Add TODO item 2022-06-01 04:48:59 -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 2e186d9f24 [buffer] Improve hash function of segment_properties_t 2022-05-20 13:19:48 -06:00
Behdad Esfahbod d35c73cd37 [buffer] Whitespace 2022-03-22 13:09:50 -06:00
Behdad Esfahbod 03085132ba [buffer] Fix out-buffer under memory-alloc failure
This was broken in July refactoring of the buffer, and exposed to
ReverseChainSingleSubstFormat1 in 3807061d63

Fixes:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38800
https://bugs.chromium.org/p/chromium/issues/detail?id=1303552
2022-03-21 18:09:06 -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
Khaled Hosny 98da330638 3.3.0 2022-01-31 18:39:06 +02:00
Behdad Esfahbod 7c704d8982 [buffer] Make hb_buffer_append() take a const argument 2022-01-28 13:53:44 -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 36e9f467a4 [buffer] Overlay segment-properties in hb_buffer_append()
Part of https://github.com/harfbuzz/harfbuzz/issues/1555
2022-01-03 11:23:14 -07:00
Behdad Esfahbod 6a66992842 Add hb_segment_properties_overlay()
New API:
+ hb_segment_properties_overlay()
2022-01-03 11:21: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
Khaled Hosny 77eeec53a9 3.1.0 2021-11-03 23:31:03 +02: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 4b5a81f13c [buffer] Fix hb_buffer_append() pre/post-context logic
Part of https://github.com/harfbuzz/harfbuzz/pull/3150
2021-08-25 15:20:54 -06:00
Khaled Hosny 430224b1a0 [buffer] Handle pre/post-context in buffer_append
Fixes https://github.com/harfbuzz/harfbuzz/issues/1843
2021-08-24 02:11:17 +02:00
Behdad Esfahbod 09c3b82f5e [buffer] When shifting forward, leave no gap
Trying to see if this fixes the fuzzer issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36236
2021-08-04 11:55:53 -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 10a9960f0a [buffer] Restructure swap_buffers()
Is more of a "commit" operation now. Will rename when ready.
2021-07-12 17:36:22 -06:00
Behdad Esfahbod 05c17787c4 [buffer] Rewind cursor in clear_output() 2021-07-12 16:55:08 -06:00
Behdad Esfahbod 69310f14a6 [buffer] Change nil buffer have_output to false
Seems like a historical artefact that it was true.
2021-07-09 16:45:55 -07:00
Behdad Esfahbod 2337f0d047 Internally use hb_malloc/.../hb_free instead of malloc/.../free
Redefining those stock names as macros was conflicting with gcc 10
headers.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07: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 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 b05e5d9a79 [buffer] HB_NODISCARD next_glyphs() 2021-03-15 14:08:08 -06:00
Behdad Esfahbod 05d2d37f9a [buffer] HB_NODISCARD ensure() 2021-03-15 13:56:46 -06:00
Behdad Esfahbod 906c9928bb [buffer] Return success status from buffer ops that can fail
Previous error-handling philosophy was that user doesn't need to
immediately know whether operation failed. But as can be seen after
we added malloc-failing fuzzing, there's just so many places in the
code that a failure of these operations needs to be mitigated before
further operations. So I'm moving towards returning success here,
and possibly making it nodiscard.
2021-03-15 13:13:45 -06:00
Behdad Esfahbod 2d39031f7b [buffer/set/map] Move immutable check only to C API boundary
The immutable objects are a concept only enforced by the C API.
So move checks only to that region.

This does assume that the rest of the code is careful not getting
into these internal methods on immutable objects, which something
we do, but have no way of enforcing (currently).

.
2021-02-19 18:40:48 -07:00
Behdad Esfahbod 21433fa563 m[buffer] In hb_buffer_append() don't change until allocation success 2021-02-19 18:40:48 -07:00
Behdad Esfahbod 3b91e0b592 m[buffer] Rename internal variable 2021-02-19 18:40:48 -07:00