src/hb-buffer.cc

Branch


Log

Author Commit Date CI Message
Behdad Esfahbod 12ec6682 2025-09-02T14:21:57 [buffer] Micro-optimize set_masks Somehow this specialization loop was in HarfRust / RustyBuzz.
Behdad Esfahbod 598da8c8 2025-09-02T14:21:08 [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.
Behdad Esfahbod 6c42e2d7 2025-08-21T00:04:56 [buffer] Consume ops in shift_forward (#5488) Makes failing infinite-recursion fonts and stuff much faster.
Behdad Esfahbod b51de936 2025-08-20T23:15:46 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
Behdad Esfahbod 17c875c3 2025-03-28T16:26:27 [buffer] Minor add a function
Behdad Esfahbod 75187186 2025-02-12T11:39:14 [buffer] Add HB_BUFFER_CLUSTER_LEVEL_GRAPHEMES https://github.com/harfbuzz/harfbuzz/discussions/5026#discussioncomment-12168668
Behdad Esfahbod 3e50a8df 2025-02-04T13:05:34 [buffer] Use UINT_MAX instead of wrong macro
Khaled Hosny d5261f72 2024-09-23T23:07:55 10.0.0
Behdad Esfahbod 287046f7 2023-12-15T10:24:03 [buffer] Hook up not-found-variation-selector-glyph Fixes https://github.com/harfbuzz/harfbuzz/issues/4398
Behdad Esfahbod a003890e 2024-09-21T11:30:56 [buffer] Add hb_buffer_[sg]et_not_found_variation_selector_glyph() Unused.
Khaled Hosny 63973005 2024-03-29T16:26:17 8.4.0
Behdad Esfahbod f1ac867d 2024-03-14T13:30:21 [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()
Bruce Mitchener f380a328 2023-08-25T14:01:01 Fix some typos.
Behdad Esfahbod a41368bd 2023-07-30T17:04:02 [buffer] Minor micro-optimize
Han Seung Min - 한승민 e768754b 2023-04-29T17:51:04 [buffer] fix `hb_buffer_t::similar` setting `replacement` to `src.invisible` ```cpp void hb_buffer_t::similar (const hb_buffer_t &src) { hb_unicode_funcs_destroy (unicode); unicode = hb_unicode_funcs_reference (src.unicode); flags = src.flags; cluster_level = src.cluster_level; replacement = src.invisible; // <- this should be src.replacement invisible = src.invisible; not_found = src.not_found; } ```
Behdad Esfahbod 48f8ed7e 2023-04-22T10:11:22 Docs
Behdad Esfahbod ce6440fc 2023-02-06T16:12:03 [buffer] Speed up merge_clusters_impl
Behdad Esfahbod e6bbf112 2023-01-03T12:35:48 [buffer] Better document set_content_type Fixes https://github.com/harfbuzz/harfbuzz/issues/4000
Behdad Esfahbod f2297e69 2022-11-25T11:33:00 [buffer] Documentation Fixes https://github.com/harfbuzz/harfbuzz/issues/3889
Behdad Esfahbod 54ae3345 2022-11-24T11:59:50 [buffer] Improve documentation of hb_buffer_add_codepoints() Fixes https://github.com/harfbuzz/harfbuzz/issues/3889
Behdad Esfahbod 3b43096e 2022-11-23T22:04:02 [buffer] Whitespace
Behdad Esfahbod 094f8073 2022-11-23T22:03:26 [buffer] Handle null buffer in set_message_func
Behdad Esfahbod 404cb99d 2022-11-23T15:35:14 [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
Behdad Esfahbod 59c45f6d 2022-11-22T12:54:50 Use hb_memcpy instead of memcpy consistently
Behdad Esfahbod ac0efaf8 2022-11-22T12:50:36 Use hb_memset instead of memset consistently
Behdad Esfahbod 4c14043b 2022-11-21T12:56:33 [algs] Add output argument to hb_unsigned_mul_overflows()
Behdad Esfahbod ed43bc51 2022-11-20T13:10:19 [buffer] Move delete_glyphs_inplace() here
Behdad Esfahbod 1945b400 2022-07-25T10:45:55 [cpluscplus] Wrap hb-subset types as well Also changes signature of get_user_data of hb.h types to take const object. This is safe.
Behdad Esfahbod 0722b627 2022-07-24T17:35:44 [buffer] Return delta from sync_so_far
Behdad Esfahbod c55c0197 2022-03-21T19:11:17 [buffer] Add assertions of buffer sync status to message_impl
Behdad Esfahbod da9edce8 2022-03-21T18:51:01 [buffer] Add sync_so_far() This removes separate out-buffer, at the cost of possibly changing idx.
Khaled Hosny 98e90cc6 2022-06-30T08:43:57 [docs] Reduce warnings Use markdown syntax for inline code blocks instead of %true, %false, and %NULL.
Behdad Esfahbod 689c7753 2022-06-10T07:37:45 [buffer] Actually remove TODO item In reality, one side is smaller and one side is larger. The existing code handles that just fine.
Behdad Esfahbod d09e962b 2022-06-10T07:35:16 [buffer] Update a TODO item
Behdad Esfahbod f78a2509 2022-06-05T00:55:35 [gi] Remove Xconstructor annotations
Behdad Esfahbod 55b911d8 2022-06-01T08:13:06 [buffer] Mark getter functions as taking const buffer Fixes https://github.com/harfbuzz/harfbuzz/issues/2873
Behdad Esfahbod e246723f 2022-06-01T04:54:18 [shape] Fail shaping internally if buffer ops exceeded
Behdad Esfahbod 9c0c31df 2022-05-31T09:35:49 [buffer] When deleting glyphs, check cluster backwards as well
Behdad Esfahbod f7f61aeb 2022-05-31T09:37:38 [buffer] Add TODO item
Behdad Esfahbod 9a2a8570 2022-05-31T04:25:20 [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.
Behdad Esfahbod 2e186d9f 2022-05-20T13:15:52 [buffer] Improve hash function of segment_properties_t
Behdad Esfahbod d35c73cd 2022-03-22T10:20:28 [buffer] Whitespace
Behdad Esfahbod 03085132 2022-03-21T18:06:33 [buffer] Fix out-buffer under memory-alloc failure This was broken in July refactoring of the buffer, and exposed to ReverseChainSingleSubstFormat1 in 3807061d634b60bd6235d6e1d8c47a034377f924 Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38800 https://bugs.chromium.org/p/chromium/issues/detail?id=1303552
Behdad Esfahbod b263371b 2022-02-12T15:06:47 Merge pull request #3398 from harfbuzz/buffer-verify Add HB_BUFFER_FLAG_VERIFY
Khaled Hosny 98da3306 2022-01-31T18:12:01 3.3.0
Behdad Esfahbod 7c704d89 2022-01-28T12:38:32 [buffer] Make hb_buffer_append() take a const argument
Behdad Esfahbod d98a0fc8 2021-12-04T20:43:27 [buffer] Consolidate glyph-flags implementation
Behdad Esfahbod f91ce56e 2021-12-04T20:07:05 [buffer] Add default cluster value in find_min_cluster
Behdad Esfahbod 56d08195 2021-12-04T19:59:55 [buffer] Rename _unsafe_to_break_set_mask to _infos_set_glyph_flags
Behdad Esfahbod 3122c2cd 2021-12-04T19:50:33 [buffer] Add HB_GLYPH_FLAG_UNSAFE_TO_CONCAT Fixes https://github.com/harfbuzz/harfbuzz/issues/1463
Behdad Esfahbod bea5369c 2022-01-04T10:52:05 [buffer] Rename swap_buffers() to sync()
Behdad Esfahbod d1e7df5c 2022-01-04T07:32:04 [buffer] Add enter()/leave() pair around shape()
Behdad Esfahbod 43be5ba4 2022-01-04T07:26:53 [buffer] Group shape-related members together
Behdad Esfahbod 52f5711e 2022-01-03T11:57:42 [buffer] Add hb_buffer_create_similar() Fixes https://github.com/harfbuzz/harfbuzz/issues/1555
Behdad Esfahbod f643b81f 2022-01-03T11:45:31 [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
Behdad Esfahbod 36e9f467 2022-01-03T11:23:14 [buffer] Overlay segment-properties in hb_buffer_append() Part of https://github.com/harfbuzz/harfbuzz/issues/1555
Behdad Esfahbod 6a669928 2022-01-03T11:21:29 Add hb_segment_properties_overlay() New API: + hb_segment_properties_overlay()
Behdad Esfahbod 1b78e04c 2021-12-10T12:45:43 [buffer] Add ::reverse_groups()
Behdad Esfahbod 4cd96e73 2021-12-10T12:33:21 [buffer] Inline revers_range() / reverse()
Behdad Esfahbod 70f8c57e 2021-12-04T19:49:23 [buffer] Rename find_min_cluster
Khaled Hosny 77eeec53 2021-11-03T23:31:03 3.1.0
Behdad Esfahbod da500568 2021-10-26T08:02:29 [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
Behdad Esfahbod 4b5a81f1 2021-08-25T15:20:54 [buffer] Fix hb_buffer_append() pre/post-context logic Part of https://github.com/harfbuzz/harfbuzz/pull/3150
Khaled Hosny 430224b1 2021-08-16T15:40:47 [buffer] Handle pre/post-context in buffer_append Fixes https://github.com/harfbuzz/harfbuzz/issues/1843
Behdad Esfahbod 09c3b82f 2021-07-29T17:49:10 [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
Behdad Esfahbod 3e266e5f 2021-07-12T17:30:26 [buffer] Update comments
Behdad Esfahbod 3807061d 2021-07-12T17:02:03 [ot-layout] Don't remove_output() before reverse substitution No need anymore, because of new swap_buffers() semantics. Just assert instead.
Behdad Esfahbod 10a9960f 2021-07-12T17:09:03 [buffer] Restructure swap_buffers() Is more of a "commit" operation now. Will rename when ready.
Behdad Esfahbod 05c17787 2021-07-12T16:55:08 [buffer] Rewind cursor in clear_output()
Behdad Esfahbod 69310f14 2021-07-09T17:24:29 [buffer] Change nil buffer have_output to false Seems like a historical artefact that it was true.
Behdad Esfahbod 2337f0d0 2021-07-08T10:58:50 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
Behdad Esfahbod 93e6a9bc 2021-06-15T15:38:49 Revert "Remove unneeded buffer clear_output / remove_output calls" This reverts commit 06175b71433bc42edc07d342e6354035e37fb5fd. One of the sanitizers is failing. Pushing again as PR to debug. I have suspicions.
Behdad Esfahbod 06175b71 2021-06-15T14:33:27 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.
Behdad Esfahbod c61ce962 2021-06-10T17:33:29 [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
Behdad Esfahbod 34a1204f 2021-03-15T14:39:06 [buffer] HB_NODISCARD output_glyph() Also, generalize and use replace_glyphs() in morx where output_glyph() was used in a loop.
Behdad Esfahbod b05e5d9a 2021-03-15T14:08:08 [buffer] HB_NODISCARD next_glyphs()
Behdad Esfahbod 05d2d37f 2021-03-15T13:43:29 [buffer] HB_NODISCARD ensure()
Behdad Esfahbod 906c9928 2021-03-15T13:13:45 [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.
Behdad Esfahbod 2d39031f 2020-06-28T20:48:48 [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). .
Behdad Esfahbod 21433fa5 2020-06-28T20:46:02 m[buffer] In hb_buffer_append() don't change until allocation success
Behdad Esfahbod 3b91e0b5 2020-06-28T20:33:54 m[buffer] Rename internal variable
Behdad Esfahbod 9fcba109 2020-06-28T20:30:39 [buffer] Make swap_buffers() copy rest
Khaled Hosny 9936490c 2020-12-31T00:19:29 [docs] Invalid use of "optional" annotation It is valid only for out and inout parameters. Fixes https://github.com/harfbuzz/harfbuzz/issues/1787
Khaled Hosny 2fdab788 2020-12-30T23:44:30 [docs] Complete hb-buffer docs a bit
Khaled Hosny cb319f0d 2020-12-24T21:47:05 [docs] Add some missing annotations to hb-buffer.cc
Khaled Hosny f88e845f 2020-12-24T21:28:37 [docs] Minor fixes
Nathan Willis e8de26e1 2019-04-21T20:31:54 [docs] Add gtkdoc comments to hb-buffer
Khaled Hosny 71a3b54f 2020-12-23T15:33:15 2.7.3
Behdad Esfahbod 77e704d1 2020-10-15T02:02:04 [buffer] Add assert_unicode()/assert_glyphs() and use internally
Behdad Esfahbod 3232e6f2 2020-10-15T00:20:17 [buffer] Add hb_buffer_has_positions() Fixes https://github.com/harfbuzz/harfbuzz/issues/2716
Ebrahim Byagowi 48ad7459 2020-07-29T08:09:08 [ENOMEM] Fix buffer's content check logic So now rest of shape fuzzer also can be enabled. Fixes #2571
Ebrahim Byagowi d0e2addd 2020-07-18T22:14:52 minor
Ebrahim Byagowi 2dda6dd7 2020-04-20T14:12:45 minor, tweak spacing turn 8 spaces to tab, add space before Null/Crap
Garret Rieger 14a7b6f1 2020-02-26T15:09:04 Set hb_buffer_t to use array_t.reverse().
Evgeniy Reizner b79ceac3 2019-12-15T16:50:01 Prefer UINT_MAX instead of uint overflow. Also, prefer HB_FEATURE_GLOBAL_START and HB_FEATURE_GLOBAL_END.
Evgeniy Reizner b618e0ae 2019-12-15T16:26:50 Remove non-breaking spaces from comments. `0xC2A0` was used, for some reasons. It's not really a problem, but Qt Creator constatly trying to replace them with regular spaces, so I have to edit those files separately.
Evgeniy Reizner 780d640c 2019-12-15T16:11:37 Remove unnecessary check in hb_buffer_t::set_masks. Bounds are already checked by the caller. Closes #2073
Behdad Esfahbod 5fddc5f1 2019-11-20T13:07:26 Use foreach_cluster
Behdad Esfahbod 029775bc 2019-10-09T11:00:09 [buffer] Minor; improve HB_NO_BUFFER_MESSAGE
Ebrahim Byagowi 670fec23 2019-10-10T09:21:08 Minor, add a zero length tolerant memset, hb_memset