src/hb-ot-map.cc

Branch


Log

Author Commit Date CI Message
Khaled Hosny cf336f17 2025-02-10T14:15:25 [shape-plan] Rename hb_ot_shape_plan_get_features to get_feature_tags Simplify the API by returning only feature tags. The users of this API would be interested only in feature enabled by default and whether the feature is globally or partially enabled wouldn’t be of much interest in that case. For user features, the user of the API already have full access to them.
Khaled Hosny a7d7715f 2025-02-02T23:06:11 [shape-plan] Add hb_ot_shape_plan_get_features This should get the features on a shape plan after executing it. Initially I wanted to return an array of tags, but then there can be user features that are not enabled globally, so I thought returning hb_feature_t with value and range would be better. There is a TODO since I couldn’t figure out how to get the value and range from the feature mask. But also it may be overkill and a simple boolean indicating wither it is a global feature or not would be enough. I wounder also what should happen to non-user features that are applied selectively, like init or medi, does ot make sense to indicate whether they are global or not? This is inspired by the discussion in: https://github.com/fontforge/fontforge/pull/5522#pullrequestreview-2574321449, but it might be useful to other HarfBuzz users.
Behdad Esfahbod dc35a0fb 2023-07-30T16:32:11 [ot-map] Speed up feature finding New API: - hb_ot_layout_collect_feature_map()
Behdad Esfahbod de2c1073 2023-07-02T16:44:48 [ot-map] Speed up for default shaper Sort late, the reduced number of features.
Behdad Esfahbod 8156c5a6 2023-07-02T16:35:32 [ot-map] Minor micro-optimize
Behdad Esfahbod 42615561 2022-11-26T17:10:58 Optimize a couple array references
Behdad Esfahbod 93f3a9db 2022-11-26T14:19:00 [ot-map] Micro-optimize more Another 500 bytes.
Behdad Esfahbod f39f0498 2022-11-26T14:16:15 [ot-map] Micro-optimize Weird that shrinks size by 500 bytes.
Behdad Esfahbod 60bb32c4 2022-11-26T14:12:57 [ot-map] Minor refactor
Behdad Esfahbod 56e3868b 2022-11-26T13:14:23 [layout/buffer-message] Print feature name in lookup buffer messages
Behdad Esfahbod ac0efaf8 2022-11-22T12:50:36 Use hb_memset instead of memset consistently
Behdad Esfahbod e82a3c69 2022-11-21T12:00:10 [array/vector] Optimize range-based for-loop Avoid bounds-checking.
Behdad Esfahbod 0387182c 2022-11-21T11:05:47 [ot-map] Minor refactor features[i] access
Behdad Esfahbod f2b5db70 2022-11-16T21:22:43 [vector] Remove .sub_array ()
Behdad Esfahbod c7d57dcf 2022-11-16T21:21:31 [vector/array] Simplify qsort()
Behdad Esfahbod d57ce300 2022-07-17T21:56:56 [ot-shape] Pass reference to props instead of pointer Since cannot be nullptr.
Behdad Esfahbod d68507d0 2022-07-14T11:20:00 [arabic] Pause after calt only if no rclt Fixes https://github.com/harfbuzz/harfbuzz/issues/1573
Behdad Esfahbod 044d7a06 2022-03-28T12:38:56 [indic-like] Add per-lookup per-syllable flag This allows mix-and-matching per-syllable and other lookups. In fact, removes the clear-syllables call completely. Fixes https://github.com/harfbuzz/harfbuzz/issues/3513
Behdad Esfahbod 10da9fd2 2021-08-23T23:32:02 [ot-map] Whitespace
Behdad Esfahbod a150baf3 2021-08-04T11:53:27 [ot-map] Allocate top mask bit as global bit Avoids undefined-shift of 32 in the following line: map->mask = (1u << (next_bit + bits_needed)) - (1u << next_bit) Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1219263
Ebrahim Byagowi c7621cf2 2019-10-08T13:24:26 Minor, replace hb_set_add with private API
Ebrahim Byagowi bbe87800 2019-09-18T22:22:01 Avoid bitwise negate of enum value Fixes this -fno-sanitize-recover=undefined fail, hb-ot-map.hh:188:1: runtime error: load of value 4294967294, which is not a valid value for type 'hb_ot_map_feature_flags_t' #0 0x7f62bfa9b227 in operator&=(hb_ot_map_feature_flags_t&, hb_ot_map_feature_flags_t) /home/ebrahim/Desktop/harfbuzz/src/./hb-ot-map.hh:188:1 #1 0x7f62bfa9b227 in hb_ot_map_builder_t::compile(hb_ot_map_t&, hb_ot_shape_plan_key_t const&) /home/ebrahim/Desktop/harfbuzz/src/hb-ot-map.cc:194 #2 0x7f62bface650 in hb_ot_shape_planner_t::compile(hb_ot_shape_plan_t&, hb_ot_shape_plan_key_t const&) /home/ebrahim/Desktop/harfbuzz/src/hb-ot-shape.cc:108:7 #3 0x7f62bfacec1e in hb_ot_shape_plan_t::init0(hb_face_t*, hb_shape_plan_key_t const*) /home/ebrahim/Desktop/harfbuzz/src/hb-ot-shape.cc:225:11 #4 0x7f62bfae1318 in hb_shape_plan_create2 /home/ebrahim/Desktop/harfbuzz/src/hb-shape-plan.cc:232:7 #5 0x7f62bfae1d2a in hb_shape_plan_create_cached2 /home/ebrahim/Desktop/harfbuzz/src/hb-shape-plan.cc:489:33 #6 0x7f62bfae2527 in hb_shape_full /home/ebrahim/Desktop/harfbuzz/src/hb-shape.cc:135:33 #7 0x55ed360b6588 in shape_options_t::shape(hb_font_t*, hb_buffer_t*, char const**) /home/ebrahim/Desktop/harfbuzz/util/./options.hh:242:10 #8 0x55ed360b5d9c in shape_consumer_t<output_buffer_t>::consume_line(char const*, unsigned int, char const*, char const*) /home/ebrahim/Desktop/harfbuzz/util/./shape-consumer.hh:67:19 #9 0x55ed360b549f in main_font_text_t<shape_consumer_t<output_buffer_t>, 2147483647, 0>::main(int, char**) /home/ebrahim/Desktop/harfbuzz/util/./main-font-text.hh:81:16 #10 0x55ed360b4e23 in main /home/ebrahim/Desktop/harfbuzz/util/hb-shape.cc:189:17 #11 0x7f62bf104ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2) #12 0x55ed3608f7ad in _start (/home/ebrahim/Desktop/harfbuzz/util/.libs/lt-hb-shape+0xd7ad)
Ebrahim Byagowi a0b4ac4d 2019-08-24T17:57:14 Turn 8 spaces to tab across the project According to the current code style of the project
Behdad Esfahbod bb4bbe61 2019-06-26T13:29:58 [config] Add HB_NO_OT_LAYOUT Part of https://github.com/harfbuzz/harfbuzz/issues/1652
Behdad Esfahbod 41248cce 2019-05-07T20:54:31 Remove MIN/MAX in favor of hb_min/hb_max
Behdad Esfahbod 42f4bd6b 2019-04-18T19:04:59 Minor warning fix again
Behdad Esfahbod 518e6e07 2019-04-18T12:21:25 Minor
Behdad Esfahbod 474a1205 2018-12-21T18:46:51 [array/vector] Rename len to length
Ebrahim Byagowi e4120085 2018-12-17T21:31:01 Remove redundant void from C++ sources (#1486)
Behdad Esfahbod cc842875 2018-11-12T18:48:10 [shape-plan] Cache shape plans with variations based on variation indices
Behdad Esfahbod f33ad6d6 2018-10-23T14:31:51 [aat] Fix up previous commit and add files
Behdad Esfahbod 8be0e5fd 2018-10-23T13:39:50 [ot-map] Minor
David Corbett 7f1fbfe2 2018-07-23T21:19:23 Add hb_ot_tags_to_script_and_language
David Corbett 91067716 2017-12-08T11:21:14 Refactor the selection of script and language tags The old hb-ot-tag.cc functions, `hb_ot_tags_from_script` and `hb_ot_tag_from_language`, are now wrappers around a new function: `hb_ot_tags`. It converts a script and a language to arrays of script tags and language tags. This will make it easier to add new script tags to scripts, like 'dev3'. It also allows for language fallback chains; nothing produces more than one language yet though. Where the old functions return the default tags 'DFLT' and 'dflt', `hb_ot_tags` returns an empty array. The caller is responsible for using the default tag in that case. The new function also adds a new private use subtag syntax for script overrides: "x-hbscabcd" requests a script tag of 'abcd'. The old hb-ot-layout.cc functions,`hb_ot_layout_table_choose_script` and `hb_ot_layout_script_find_language` are now wrappers around the new functions `hb_ot_layout_table_select_script` and `hb_ot_layout_script_select_language`. They are essentially the same as the old ones plus a tag count parameter. Closes #495.
Behdad Esfahbod f048ead8 2018-09-24T18:01:53 Some more
Behdad Esfahbod 606bf574 2018-09-16T19:33:48 Revert forcing use of single-parameter static_assert() Some clang versions define static_assert as a macro apparently, so we cannot redefine it... This reverts commit 94bfea0ce6a7b4d5641c198d50751748a353df11. This reverts commit 4e62627831e7457ed60ff87712570065b14b200a.
Behdad Esfahbod 4e626278 2018-09-16T18:09:36 Enforce single-param static_assert() only So we don't accidentally break it again.
Behdad Esfahbod 71c9f84e 2018-09-10T22:37:19 Make --features rand=1 available to the user Use rand=255 to mean "randomize". Part of https://github.com/harfbuzz/harfbuzz/pull/803
David Corbett c2a75e07 2018-01-25T14:22:03 Implement 'rand'
David Corbett f05df643 2018-01-26T21:36:15 Allow requesting a specific glyph for 'rand' Randomization only happens by default. If the user specifies a value for 'rand', that value is respected.
Behdad Esfahbod c77ae408 2018-08-25T22:36:36 Rename hb-*private.hh to hb-*.hh Sorry for the noise, downstream custom builders. Please adjust.
Behdad Esfahbod bddeb2b1 2018-07-10T14:12:37 Minor renamings of internal inline functions
Behdad Esfahbod f9abbf83 2018-06-02T15:30:59 Fix fallout from 975bdd5ef562e37655067b703b2b9ca7481f4985 Ouch!
Behdad Esfahbod f7515769 2018-06-01T17:48:37 [vector] Use Crap pool in push() as well
Behdad Esfahbod 90869e69 2018-05-07T14:04:01 [ot] Apply langsys's required feature even if no other feature exists
Behdad Esfahbod 978ace6f 2018-02-16T16:06:17 Improve _hb_popcount() Support 128bit type.
Behdad Esfahbod 12757b69 2018-01-26T18:14:05 Misc warning fixes Fixes https://github.com/harfbuzz/harfbuzz/issues/712
Behdad Esfahbod dbdbfe3d 2017-10-15T12:11:08 Use nullptr instead of NULL
Behdad Esfahbod c3448e8d 2017-10-15T12:02:00 Use static_assert instead of custom ASSERT_STATIC
Behdad Esfahbod 5287ccc9 2017-08-10T14:25:53 [unsafe-to-break] Allocate public bits from 0
Behdad Esfahbod 40bd7e9a 2016-05-02T14:47:45 [unsafe-to-break] Add UNSAFE_TO_BREAK flag Not all shapers code is updated to set this properly. GSUB and Arabic shaper are updated. GPOS and other shapers are NOT. Fixes https://github.com/behdad/harfbuzz/issues/224
Behdad Esfahbod cdf1fd06 2017-07-14T12:43:34 [indic] Add infrastructure to disable ZWNJ-skipping in context-matching Not used yet.
Behdad Esfahbod 7ceadbe9 2016-09-10T02:44:20 Shuffle code around
Behdad Esfahbod bde5e395 2016-09-10T02:43:20 Move add_lookups from map to map-builder In prep for more changes.
Behdad Esfahbod 72ada4f0 2016-09-10T03:57:24 [GX] Hook up feature variations Shape-plan caching is not implemented.
Behdad Esfahbod 09c7a2d6 2016-08-08T17:28:54 Limit bits-per-feature to eight Limits number of alternatives per glyph per feature to 255, so be it. That's better than possibly breaking shaping because of one bad feature value.
Behdad Esfahbod 33317310 2016-08-08T17:24:04 Fix sign of shift operators This one: map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit); before the fix, the shift was done as an int, causing overflow if it ever got to 1 << 31. Sprinkle 'u's around. Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=634805
Behdad Esfahbod 731a430c 2016-03-02T13:32:42 Fix requiredFeature stage handling logic Originally the way Jonathan had written this was correct in "continue"ing: https://github.com/jfkthame/harfbuzz/commit/35e28c7a733eaffcd9f062b18d7db9fbb3d990fc#diff-ead86a33a5cc9ad7f6e6381031a0baddR199 When I rewrote his patch, I messed it up: https://github.com/behdad/harfbuzz/commit/da132937989acb4d8ca9bd41c79f98750e7dda30#diff-ead86a33a5cc9ad7f6e6381031a0baddR209 the intended behavior was NOT to set found=TRUE and NOT to continue. This was resulting in feature_index[table_index] being left unset. Oops!
Behdad Esfahbod ea512f71 2015-11-26T19:22:22 Use C-style casts instead of compare to 0, to convert hb_bool_t to bool
ThePhD 5c99cf93 2015-08-14T01:02:00 Merge branch 'master' into vc++-fixes
Behdad Esfahbod 0f98fe88 2015-07-23T11:52:11 [ot] Search globally for 'vert' feature if not found in specified script/lang Fixes https://github.com/behdad/harfbuzz/issues/63
ThePhD 8e545d59 2015-06-22T22:29:04 Fix all VC++ warnings and errors in the current commit's builds.
Jonathan Kew da132937 2014-04-27T14:05:24 Rework handling of requiredFeature to solve problem with rlig in arial.ttf from winxp https://bugzilla.mozilla.org/show_bug.cgi?id=986802 Fixes https://github.com/behdad/harfbuzz/pull/39 API Change: -hb_ot_layout_language_get_required_feature_index +hb_ot_layout_language_get_required_feature New API takes an extra pointer argument. Pass NULL in to get behavior of previous API. Reworked by behdad
Behdad Esfahbod fb8cc86f 2014-06-19T15:30:18 Rename sort() to qsort() In an effort to make the algorithm used clear.
Behdad Esfahbod 176fd17d 2013-10-30T17:27:24 Bug 70971 - Signed/unsigned compiler warnings on windows Patch from Emil Eklund.
Behdad Esfahbod 27674b4b 2013-10-03T14:54:50 [OTLayout] Protect against out-of-range lookup indices Filter them out when compiling map.
Behdad Esfahbod d2c96819 2013-05-02T18:18:24 Move code around
Behdad Esfahbod 2265be0a 2013-05-02T14:25:09 Minor
Behdad Esfahbod 3276c354 2013-05-02T15:16:59 [OTLayout] Minor refactoring
Behdad Esfahbod 893f57b3 2013-04-21T15:21:49 Minor renaming
Behdad Esfahbod 8ac3c9c0 2013-04-21T15:19:38 Rename "pause" to "stage" The compile() function is starting to become illegible...
Behdad Esfahbod dd0641a4 2013-04-21T15:13:57 Minor
Behdad Esfahbod 06a44e85 2013-04-21T15:13:08 Remove unneeded code We always push a pause at the end such that each lookup falls in exactly one pause_map_t. Now, only if I can find a better name for that...
Behdad Esfahbod a8cf7b43 2013-03-19T05:53:26 [Indic] Futher adjust ZWJ handling in Indic-like shapers After the Ngapi hackfest work, we were assuming that fonts won't use presentation features to choose specific forms (eg. conjuncts). As such, we were using auto-joiner behavior for such features. It proved to be troublesome as many fonts used presentation forms ('pres') for example to form conjuncts, which need to be disabled when a ZWJ is inserted. Two examples: U+0D2F,U+200D,U+0D4D,U+0D2F with kartika.ttf U+0995,U+09CD,U+200D,U+09B7 with vrinda.ttf What we do now is to never do magic to ZWJ during GSUB's main input match for Indic-style shapers. Note that backtrack/lookahead are still matched liberally, as is GPOS. This seems to be an acceptable compromise. As to the bug that initially started this work, that one needs to be fixed differently: Bug 58714 - Kannada u+0cb0 u+200d u+0ccd u+0c95 u+0cbe does not provide same results as Windows8 https://bugs.freedesktop.org/show_bug.cgi?id=58714 New numbers: BENGALI: 353689 out of 354188 tests passed. 499 failed (0.140886%) DEVANAGARI: 707305 out of 707394 tests passed. 89 failed (0.0125814%) GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%) GURMUKHI: 60706 out of 60747 tests passed. 41 failed (0.067493%) KANNADA: 951030 out of 951913 tests passed. 883 failed (0.0927606%) KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%) LAO: 53611 out of 53644 tests passed. 33 failed (0.0615167%) MALAYALAM: 1048102 out of 1048334 tests passed. 232 failed (0.0221304%) ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%) SINHALA: 271666 out of 271847 tests passed. 181 failed (0.0665816%) TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%) TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%) TIBETAN: 208469 out of 208469 tests passed. 0 failed (0%)
Behdad Esfahbod 398238a2 2013-02-15T07:40:10 Fix partial disabling of default-on features Surprisingly, if user ever tried to turn a default feature off partially (say, disable liga for a range), the feature was being turned off globally! Fixed now.
Behdad Esfahbod cfc507c5 2013-02-14T10:40:12 [Indic-like] Disable automatic joiner handling for basic shaping features Not for Arabic, but for Indic-like scripts. ZWJ/ZWNJ have special meanings in those scripts, so let font lookups take full control. This undoes the regression caused by automatic-joiners handling introduced two commits ago. We only disable automatic joiner handling for the "basic shaping features" of Indic, Myanmar, and SEAsian shapers. The "presentation forms" and other features are still applied with automatic-joiner handling. This change also changes the test suite failure statistics, such that a few scripts show more "failures". The most affected is Kannada. However, upon inspection, we believe that in most, if not all, of the new failures, we are producing results superior to Uniscribe. Hard to count those! Here's an example of what is fixed by the recent joiner-handling changes: https://bugs.freedesktop.org/show_bug.cgi?id=58714 New numbers, for future reference: BENGALI: 353892 out of 354188 tests passed. 296 failed (0.0835714%) DEVANAGARI: 707336 out of 707394 tests passed. 58 failed (0.00819911%) GUJARATI: 366262 out of 366457 tests passed. 195 failed (0.0532122%) GURMUKHI: 60706 out of 60747 tests passed. 41 failed (0.067493%) KANNADA: 950680 out of 951913 tests passed. 1233 failed (0.129529%) KHMER: 299074 out of 299124 tests passed. 50 failed (0.0167155%) LAO: 53611 out of 53644 tests passed. 33 failed (0.0615167%) MALAYALAM: 1047983 out of 1048334 tests passed. 351 failed (0.0334817%) ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%) SINHALA: 271539 out of 271847 tests passed. 308 failed (0.113299%) TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%) TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%) TIBETAN: 208469 out of 208469 tests passed. 0 failed (0%)
Behdad Esfahbod ec544866 2013-02-14T11:25:10 Add hb_ot_map_feature_flags_t Code cleanup. No (intended) functional change.
Behdad Esfahbod f3064103 2012-11-15T18:39:46 Bunch of independent changes (ouch) API additions: hb_segment_properties_t HB_SEGMENT_PROPERTIES_DEFAULT hb_segment_properties_equal() hb_segment_properties_hash() hb_buffer_set_segment_properties() hb_buffer_get_segment_properties() hb_ot_layout_glyph_class_t hb_shape_plan_t hb_shape_plan_create() hb_shape_plan_create_cached() hb_shape_plan_get_empty() hb_shape_plan_reference() hb_shape_plan_destroy() hb_shape_plan_set_user_data() hb_shape_plan_get_user_data() hb_shape_plan_execute() hb_ot_shape_plan_collect_lookups() API changes: Rename hb_ot_layout_feature_get_lookup_indexes() to hb_ot_layout_feature_get_lookups(). New header file: hb-shape-plan.h And a bunch of prototyped but not implemented stuff. Coming soon. (Tests fail because of the prototypes right now.)
Behdad Esfahbod 362a990b 2012-11-15T14:57:31 Rename hb_ot_layout_would_substitute_lookup() and hb_ot_layout_substitute_closure_lookup() To match upcoming API.
Behdad Esfahbod 851784f8 2012-11-14T16:24:05 Improve shaper selection
Behdad Esfahbod 6fddf2d7 2012-11-12T17:57:24 Refactoring ot-map building to make chosen script available earlier
Behdad Esfahbod fabd3113 2012-09-05T22:19:28 [OT] Port Arabic fallback shaping to synthetic GSUB All of init/medi/fina/isol and rlig implemented. Let there be dragons... ⻯
Behdad Esfahbod 87b75d0a 2012-09-04T23:06:38 [OT] Allow adding features with fallback implementation
Behdad Esfahbod d9b204d3 2012-08-23T16:22:28 [GSUB] Allow non-zero-context matching in would_apply() To be used in the next patch.
Behdad Esfahbod 8bb5deba 2012-08-02T10:07:58 [OT] Pipe shape_plan down to pause_callbacks
Behdad Esfahbod 3e38c0f2 2012-08-02T09:44:18 More massaging
Behdad Esfahbod 5393e3a6 2012-08-02T09:24:35 [OT] Minor refactoring
Behdad Esfahbod afbcc24b 2012-08-02T08:36:40 [GSUB] Wire the font, not just the face, down to substitute() We need the font for glyph lookup during GSUB pauses in Indic shaper. Could perhaps be avoided, but at this point, we don't mean to support separate substitute()/position() entry points (anymore), so there is no point in not providing the font to GSUB.
Behdad Esfahbod b0e6a26a 2012-08-02T08:11:14 [OT] Hide some API It was impossible to meaningfully use them from the outside these days.
Behdad Esfahbod 610e5e8f 2012-08-02T05:27:46 [Indic] Streamline feature would_apply() Comes with some 10% speedup for Devanagari even!
Behdad Esfahbod f8603664 2012-07-30T02:38:39 [OT] Gain back some lost speed
Behdad Esfahbod 77471e03 2012-06-08T20:21:02 Clear output buffer before calling GSUB pause functions
Behdad Esfahbod 6a9be5bd 2012-04-23T22:23:17 Rename hb_glyph_map_t to hb_set_t
Behdad Esfahbod d2984a24 2012-04-23T17:21:14 Add map->substitute_closure()
Behdad Esfahbod c605bbbb 2011-08-04T20:00:53 Remove C++ guards from source files Where causing issues for people with MSVC.
Behdad Esfahbod c47a31fb 2011-07-30T20:57:01 [OT] Save chosen script tag
Behdad Esfahbod 359dcaa0 2011-07-07T21:55:05 Update copyright headers
Behdad Esfahbod d8d0c480 2011-07-07T21:22:08 Refactor some code common to GSUB and GPOS
Behdad Esfahbod b70c96db 2011-07-07T21:07:41 Enable applying GSUB/GPOS features in multiple segments Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=644184 among others. Shapers now can request segmented feature application by calling add_gsub_pause() or add_gpos_pause(). They can also provide a callback to be called at the pause. Currently the Arabic shaper uses pauses to enforce certain feature application. The Indic shaper can use the same facility to pause and do reordering in the callback.
Behdad Esfahbod 31f18abe 2011-06-15T09:49:58 Minor compiler warning fixes