From 0e6a9c81f059ca517878d4efb0da6e70b5a4e4d0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 1 Nov 2026 19:14:23 -0700 Subject: [PATCH] [indic] Fix Unicode 18 shaping and Rust table generation (#6544) * [indic] Include Unicode 18 Devanagari and Bengali additions The block filter discarded U+11B0A even though the Unicode 18 data classifies it as a consonant. Following marks therefore formed broken syllables and received unwanted dotted circles. The same omission excluded Bengali Supplement's U+11DF0 and U+11DF1. Include both blocks and regenerate the Indic table. These three code points are the only effective classification changes. Add nine shaping cases using the existing Adobe Blank font, including a valid-syllable control and an isolated anusvara that needs a dotted circle. Eight new cases fail before the fix. All 275 Meson tests pass after it, including the full shaping suite. Fixes: https://github.com/harfbuzz/harfbuzz/issues/6452 Assisted-by: OpenAI Codex * [gen] Preserve current Rust vowel-constraint buffer access The shared generator still emitted direct field access through buffer.cur(), which now returns Option in HarfRust. Regenerating the file also lost its checked access to output glyph information. Emit the cur_glyph helper and guarded output lookup already used by the checked-in Rust implementation. The regenerated Rust functions match HarfRust after its import adaptations, and the C++ output is byte-for-byte unchanged. All 275 Meson tests pass. HarfRust's default and all-feature workspace tests pass with the regenerated functions. Assisted-by: OpenAI Codex * [test] Keep Unicode 18 Indic cases in a dedicated shaping file Group the new cases in indic-unicode18.tests so HarfRust can import these generated tests without replacing existing Indic regressions. Register the file in the in-house shaping suite. All 275 Meson tests pass. Assisted-by: OpenAI Codex * [gen] Emit HarfRust names directly from the shared generators Generate the Rust module paths, type names, and table symbol prefixes used by HarfRust at their source. This removes the need for text rewrites in HarfRust's Unicode-table makefile. All eight Rust outputs are byte-for-byte identical to the previous postprocessed outputs. All seven C/C++ generator outputs are byte-for-byte unchanged, and all 275 Meson tests pass. Assisted-by: OpenAI Codex --- src/gen-arabic-pua.py | 2 +- src/gen-arabic-table.py | 8 +- src/gen-emoji-table.py | 8 +- src/gen-indic-table.py | 10 +- src/gen-ucd-table.py | 14 +- src/gen-use-table.py | 4 +- src/gen-vowel-constraints.py | 29 +-- src/hb-ot-shaper-indic-table.cc | 178 +++++++++--------- test/shape/data/in-house/meson.build | 1 + .../data/in-house/tests/indic-unicode18.tests | 10 + 10 files changed, 144 insertions(+), 120 deletions(-) create mode 100644 test/shape/data/in-house/tests/indic-unicode18.tests diff --git a/src/gen-arabic-pua.py b/src/gen-arabic-pua.py index 8293c1165..0d4e36cca 100755 --- a/src/gen-arabic-pua.py +++ b/src/gen-arabic-pua.py @@ -37,7 +37,7 @@ else: print ("#![allow(clippy::unreadable_literal)]") print () -code = packTab.Code('_hb_arabic_pua') +code = packTab.Code('_hb_arabic_pua' if language.name == "c" else 'arabic_pua') for p, name in zip(paths, ("simp_map", "trad_map")): with open (p, encoding='utf-8') as f: diff --git a/src/gen-arabic-table.py b/src/gen-arabic-table.py index 911ea1f52..0032889fd 100755 --- a/src/gen-arabic-table.py +++ b/src/gen-arabic-table.py @@ -86,7 +86,7 @@ def print_joining_table(f): value = "JOINING_TYPE_" + fields[2] values[u] = value - code = packTab.Code ('_hb_arabic_joining') + code = packTab.Code ('_hb_arabic_joining' if language.name == "c" else 'arabic_joining') data = {u: JOINING_CODE[v] for u, v in values.items ()} sol = packTab.pack_table (data, default=JOINING_CODE['JOINING_TYPE_X'], compression=9) if language.name == "c": @@ -111,16 +111,16 @@ def print_joining_table(f): print ("use crate::unicode::Codepoint;") print () print ( - "use super::ot_shaper_arabic::hb_arabic_joining_type_t::{" + "use super::arabic::ArabicJoiningType::{" "self, D, GroupAlaph, GroupDalathRish, L, R, T, U, X};" ) print () code.print_code (file=sys.stdout, language=language, private=False) print () print ("#[inline]") - print ("pub(crate) fn joining_type (u: Codepoint) -> hb_arabic_joining_type_t") + print ("pub(crate) fn joining_type (u: Codepoint) -> ArabicJoiningType") print ("{") - print (" match _hb_arabic_joining_joining_type_u8 (u as usize) {") + print (" match arabic_joining_joining_type_u8 (u as usize) {") print (" 0 => U,") print (" 1 => L,") print (" 2 => R,") diff --git a/src/gen-emoji-table.py b/src/gen-emoji-table.py index 09d34e528..3ef7dc8b7 100755 --- a/src/gen-emoji-table.py +++ b/src/gen-emoji-table.py @@ -69,7 +69,7 @@ elif language.name == "rust": print ("#![allow(unused_parens)]") print ("#![allow(clippy::unnecessary_cast, clippy::unreadable_literal, clippy::double_parens)]") print () - print ("use crate::hb::unicode::Codepoint;") + print ("use crate::unicode::Codepoint;") print () else: assert False, "Unknown language: %s" % language.name @@ -83,19 +83,19 @@ for typ, s in ranges.items(): arr[i] = 1 sol = packTab.pack_table(arr, 0, compression=9) - code = packTab.Code('_hb_emoji') + code = packTab.Code('_hb_emoji' if language.name == "c" else 'emoji') if language.name == "c": sol.genCode(code, 'is_'+typ, language=language) code.print_code(language=language) print() elif language.name == "rust": - sol.genCode(code, 'is_'+typ+'_u8', language=language, private=False) + sol.genCode(code, 'is_'+typ.lower()+'_u8', language=language, private=False) code.print_code(language=language, private=False) print() print ("#[inline]") print ("pub(crate) fn is_%s (u: Codepoint) -> bool" % typ) print ("{") - print (" _hb_emoji_is_%s_u8 (u as usize) != 0" % typ) + print (" emoji_is_%s_u8 (u as usize) != 0" % typ.lower()) print ("}") print() else: diff --git a/src/gen-indic-table.py b/src/gen-indic-table.py index bf24f6f96..14298cf9a 100755 --- a/src/gen-indic-table.py +++ b/src/gen-indic-table.py @@ -43,6 +43,8 @@ ALLOWED_BLOCKS = [ 'Myanmar Extended-B', 'Myanmar Extended-A', 'Myanmar Extended-C', + 'Devanagari Extended-A', + 'Bengali Supplement', ] files = [open (x, encoding='utf-8') for x in sys.argv[1:]] @@ -540,8 +542,8 @@ elif language.name == "rust": print ("#![allow(non_camel_case_types)]") print ("#![allow(unused_imports)]") print () - print ('use super::ot_shaper_indic::ot_category_t::*;') - print ('use super::ot_shaper_indic::ot_position_t::*;') + print ('use super::indic::category::*;') + print ('use super::indic::position::*;') print () else: assert False, "Unknown language: %s" % language.name @@ -650,7 +652,7 @@ else: unique_values = sorted (set (pack_data.values ()) | {default_value}) mapping = {v: i for i, v in enumerate (unique_values)} -code = packTab.Code ('_hb_indic') +code = packTab.Code ('_hb_indic' if language.name == "c" else 'indic') value_type = 'uint16_t' if language.name == "c" else language.type_name ("u16") indic_values, _ = code.addArray (value_type, 'values', unique_values) sol = packTab.pack_table (pack_data, default=default_value, mapping=mapping, compression=9) @@ -678,7 +680,7 @@ else: print ("#[inline]") print ("pub(crate) fn get_categories (u: u32) -> (u8, u8)") print ("{") - print (" let v = %s[_hb_indic_get_categories_index (u as usize) as usize];" % indic_values) + print (" let v = %s[indic_get_categories_index (u as usize) as usize];" % indic_values) print (" ((v & 0xFF) as u8, (v >> 8) as u8)") print ("}") print () diff --git a/src/gen-ucd-table.py b/src/gen-ucd-table.py index 32a6105d3..6cf3ed883 100755 --- a/src/gen-ucd-table.py +++ b/src/gen-ucd-table.py @@ -154,7 +154,7 @@ for line in open(hb_script_list_h): sc_order[tag] = i sc_order[i] = tag if language.name == "rust": - name = name.replace("HB_SCRIPT_", "script::") + name = name.replace("HB_SCRIPT_", "Script::") sc_array.append(name) @@ -195,9 +195,8 @@ elif language.name == "rust": print("#![allow(unused_parens)]") print("#![allow(clippy::unnecessary_cast, clippy::unreadable_literal, clippy::double_parens)]") print() - print("use crate::hb::algs::{HB_CODEPOINT_ENCODE3, HB_CODEPOINT_ENCODE3_11_7_14};") - print("use crate::hb::common::script;") - print("use crate::hb::common::Script as hb_script_t;") + print("use crate::algs::{HB_CODEPOINT_ENCODE3, HB_CODEPOINT_ENCODE3_11_7_14};") + print("use crate::Script;") print() else: assert False, "Unknown language: %s" % language.name @@ -215,8 +214,9 @@ elif language.name == "rust": else: assert False, "Unknown language: %s" % language.name -code = packTab.Code("_hb_ucd") -sc_array, _ = code.addArray("hb_script_t", "sc_map", sc_array) +code_prefix = "_hb_ucd" if language.name == "c" else "ucd" +code = packTab.Code(code_prefix) +sc_array, _ = code.addArray("hb_script_t" if language.name == "c" else "Script", "sc_map", sc_array) dm1_p0_array, _ = code.addArray(uint16_t, "dm1_p0_map", dm1_p0_array) dm1_p2_array, _ = code.addArray(uint16_t, "dm1_p2_map", dm1_p2_array) dm2_u32_array, _ = code.addArray(uint32_t, "dm2_u32_map", dm2_u32_array) @@ -268,7 +268,7 @@ for step, text in modes.items(): if ((i + 1) % 128) and sc[i] == "Zzzz": sc[i] = sc[i + 1] - code = packTab.Code("_hb_ucd") + code = packTab.Code(code_prefix) for name, data, default, mapping in datasets: sol = packTab.pack_table( diff --git a/src/gen-use-table.py b/src/gen-use-table.py index 3e64700e9..37d16f807 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -462,7 +462,7 @@ elif language.name == "rust": print("#![allow(unused_parens)]") print("#![allow(clippy::unnecessary_cast, clippy::unreadable_literal, clippy::double_parens)]") print() - print("use super::ot_shaper_use::category::*;") + print("use super::use_::category::*;") print() else: assert False, "Unknown language: %s" % language.name @@ -507,7 +507,7 @@ for step, text in modes.items(): compression = compression_level[step] logging.info(" Compression=%d:" % compression) - code = packTab.Code('hb_use') + code = packTab.Code('hb_use' if language.name == "c" else 'use') sol = packTab.pack_table(data, compression=compression, default='O') logging.info(' FullCost=%d' % (sol.fullCost)) sol.genCode(code, f'get_category', language=language, private=private) diff --git a/src/gen-vowel-constraints.py b/src/gen-vowel-constraints.py index 0e3c5d0ce..f0ed1c5a6 100755 --- a/src/gen-vowel-constraints.py +++ b/src/gen-vowel-constraints.py @@ -139,13 +139,13 @@ class ConstraintSet (object): s.append ('matched = true;\n') elif len (self._c) == 1: assert index == 1, 'Cannot use `matched` for this constraint; the general case has not been implemented' - s.append ('matched = 0x{:04X} == buffer.cur({}).glyph_id;\n'.format (next (iter (self._c)), index)) + s.append ('matched = 0x{:04X} == cur_glyph(buffer, {});\n'.format (next (iter (self._c)), index)) else: - s.append ('if 0x{:04X} == buffer.cur({}).glyph_id &&\n'.format (self._c[0], index)) + s.append ('if 0x{:04X} == cur_glyph(buffer, {}) &&\n'.format (self._c[0], index)) if index: s.append ('buffer.idx + {} < buffer.len &&\n'.format (index + 1)) for i, cp in enumerate (self._c[1:], start=1): - s.append ('0x{:04X} == buffer.cur({}).glyph_id{}\n'.format ( + s.append ('0x{:04X} == cur_glyph(buffer, {}){}\n'.format ( cp, index + i, '' if i == len (self._c) - 1 else ' &&')) s.append ('{\n') for i in range (index + 1): @@ -153,7 +153,7 @@ class ConstraintSet (object): s.append ('output_dotted_circle(buffer);\n') s.append ('}\n') else: - s.append ('match buffer.cur({}).glyph_id {{\n'.format (index)) + s.append ('match cur_glyph(buffer, {}) {{\n'.format (index)) cases = collections.defaultdict (set) for first, rest in sorted (self._c.items ()): cases[rest.rust_str (index + 1)].add (first) @@ -199,24 +199,31 @@ if output_rust: print () print ('#![allow(clippy::single_match)]') print () - print ('use super::buffer::hb_buffer_t;') - print ('use super::script;') + print ('use crate::buffer::Buffer;') print ('use crate::BufferFlags;') + print ('use crate::Script;') print () - print ('fn output_dotted_circle(buffer: &mut hb_buffer_t) {') + print ('/// The glyph `i` places past the current one, or 0, which matches nothing.') + print ('fn cur_glyph(buffer: &Buffer, i: usize) -> u32 {') + print (' buffer.cur(i).map_or(0, |info| info.glyph_id)') + print ('}') + print () + print ('fn output_dotted_circle(buffer: &mut Buffer) {') print (' buffer.output_glyph(0x25CC);') print (' {') print (' let out_idx = buffer.out_len - 1;') - print (' buffer.out_info_mut()[out_idx].clear_continuation();') + print (' if let Some(info) = buffer.out_info_mut().get_mut(out_idx) {') + print (' info.clear_continuation();') + print (' }') print (' }') print ('}') print () - print ('fn output_with_dotted_circle(buffer: &mut hb_buffer_t) {') + print ('fn output_with_dotted_circle(buffer: &mut Buffer) {') print (' output_dotted_circle(buffer);') print (' buffer.next_glyph();') print ('}') print () - print ('pub fn preprocess_text_vowel_constraints(buffer: &mut hb_buffer_t) {') + print ('pub fn preprocess_text_vowel_constraints(buffer: &mut Buffer) {') print (' if buffer.flags.contains(BufferFlags::DO_NOT_INSERT_DOTTED_CIRCLE) {') print (' return;') print (' }') @@ -230,7 +237,7 @@ if output_rust: print (' match buffer.script {') for script, constraints in sorted (constraints.items (), key=lambda s_c: script_order[s_c[0]]): - print (' Some(script::{}) => {{'.format (script.upper ())) + print (' Some(Script::{}) => {{'.format (script.upper ())) print (' buffer.idx = 0;') print (' while buffer.idx + 1 < buffer.len {') print (' #[allow(unused_mut)]') diff --git a/src/hb-ot-shaper-indic-table.cc b/src/hb-ot-shaper-indic-table.cc index 10ca0db6c..eff850735 100644 --- a/src/hb-ot-shaper-indic-table.cc +++ b/src/hb-ot-shaper-indic-table.cc @@ -77,7 +77,7 @@ static_assert (OT_VPst == M_Cat(VPst), ""); #define _OT_A OT_A /* 53 chars; A */ #define _OT_As OT_As /* 1 chars; As */ -#define _OT_C OT_C /* 476 chars; C */ +#define _OT_C OT_C /* 478 chars; C */ #define _OT_CM OT_CM /* 1 chars; CM */ #define _OT_CS OT_CS /* 4 chars; CS */ #define _OT_DC OT_DOTTEDCIRCLE /* 1 chars; DOTTEDCIRCLE */ @@ -95,7 +95,7 @@ static_assert (OT_VPst == M_Cat(VPst), ""); #define _OT_R OT_Ra /* 14 chars; Ra */ #define _OT_Rf OT_Repha /* 1 chars; Repha */ #define _OT_Rt OT_Robatic /* 3 chars; Robatic */ -#define _OT_SM OT_SM /* 50 chars; SM */ +#define _OT_SM OT_SM /* 51 chars; SM */ #define _OT_SP OT_SMPst /* 6 chars; SMPst */ #define _OT_S OT_Symbol /* 22 chars; Symbol */ #define _OT_V OT_V /* 172 chars; V */ @@ -114,14 +114,14 @@ static_assert (OT_VPst == M_Cat(VPst), ""); #define _POS_A POS_AFTER_MAIN /* 5 chars; AFTER_MAIN */ #define _POS_AP POS_AFTER_POST /* 50 chars; AFTER_POST */ #define _POS_AS POS_AFTER_SUB /* 51 chars; AFTER_SUB */ -#define _POS_C POS_BASE_C /* 853 chars; BASE_C */ +#define _POS_C POS_BASE_C /* 855 chars; BASE_C */ #define _POS_BS POS_BEFORE_SUB /* 25 chars; BEFORE_SUB */ #define _POS_B POS_BELOW_C /* 13 chars; BELOW_C */ #define _POS_X POS_END /* 71 chars; END */ #define _POS_R POS_POST_C /* 13 chars; POST_C */ #define _POS_L POS_PRE_C /* 5 chars; PRE_C */ #define _POS_LM POS_PRE_M /* 14 chars; PRE_M */ -#define _POS_SM POS_SMVD /* 130 chars; SMVD */ +#define _POS_SM POS_SMVD /* 131 chars; SMVD */ #pragma GCC diagnostic pop @@ -141,95 +141,99 @@ static const uint16_t _hb_indic_values[42]= _(VA,T), _(VB,B), _(VL,L), _(VR,R), _(VS,X), _(X,X), _(Xg,X), _(Yg,X), _(ZWJ,X),_(ZWNJ,X), }; -static const uint8_t _hb_indic_u8[1224]= +static const uint8_t _hb_indic_u8[1348]= { - 1, 0, 50, 4, 5, 96, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 16, 24, 32, 0, 40, 0, 0, 48, 0, 0, 56, 0, + 64, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,186, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, - 0, 0, 0, 0,208,224, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 22, 23, - 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 26, 0, 0, - 0, 27, 0, 0, 0, 0, 28, 29, 30, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 31, 0, 0, 0, 32, 0, 0, 0, 33, 0, 34, - 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 36, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 25, 2, 10, 0, 0, 0, 0, 26, 0, - 27, 0, 0, 0, 28, 0, 0, 0, 0, 0, 29, 11, 30, 1, 1, 1, - 4, 31, 32, 33, 34, 1, 6, 2, 35, 1, 12, 13, 7, 1, 1, 3, - 36, 14, 15, 37, 16, 17, 6, 2, 38, 39, 18, 40, 7, 1, 1, 3, - 41, 42, 43, 44, 45, 46, 19, 2, 47, 0, 18, 48, 49, 1, 1, 3, - 20, 14, 50, 51, 0, 0, 21, 2, 0, 52, 53, 13, 7, 1, 1, 3, - 20, 54, 15, 55, 56, 17, 6, 2, 57, 0, 58, 59, 60, 61, 62, 63, - 4, 64, 65, 66, 16, 0, 19, 2, 0, 0, 67, 8, 9, 1, 1, 3, - 4, 22, 68, 69, 70, 71, 23, 2, 0, 0, 12, 8, 9, 1, 1, 3, - 72, 22, 73, 74, 75, 76, 23, 2, 77, 0, 78, 8, 9, 1, 1, 1, - 4, 79, 80, 81, 82, 83, 21, 2, 0, 84, 85, 1, 1, 86, 87, 88, - 89, 90, 2, 91, 92, 93, 94, 95, 96, 1, 97, 98, 2, 99, 0, 0, - 0, 0, 1, 1, 1,100,101, 11,102,103,104,105,106,107, 2, 10, - 0, 0, 0, 0,108, 5, 5,109,110,111, 0,112,113, 0,114, 0, - 0, 0, 0, 0, 0, 0, 0, 0,115, 0,116, 0, 0, 0, 0, 0, - 0, 0, 0,117, 0, 0, 0, 0, 0,118, 0, 0, 0, 0, 5, 5, - 119,120, 0, 0, 0, 0,121, 1, 2,122, 0, 0, 0, 0, 1, 1, - 123,124, 24, 24, 0, 0, 0, 0, 0, 0,125, 0, 0, 0, 0, 0, - 0,126, 0, 0, 2, 2, 2, 10, 0, 0, 0, 0, 2, 2, 2, 2, - 4, 4, 4, 4, 10, 2, 2, 2, 26, 2, 2, 2, 8, 8, 8, 8, - 6, 18, 0, 4, 20, 14, 24, 2, 6, 6, 20, 6, 20, 6, 24, 2, - 4, 0, 0, 0, 6, 6, 6, 6, 66, 12, 14, 6, 6, 6, 20, 14, - 2, 0, 36, 50, 52, 18, 38, 68, 0, 0, 0, 32, 0, 0, 2, 16, - 56, 12, 14, 6, 0, 0, 0, 4, 44, 2, 16, 2, 6, 22, 0, 4, - 2, 0, 36, 28, 6, 28, 0, 4, 30, 30, 30, 30, 0, 0, 42, 0, - 34, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 42, 12, 12, 6, 6, - 6, 6, 24, 2, 2, 18, 36,110, 18, 18, 18, 18, 18, 18,112,114, - 116,118,120, 18, 0, 6, 6, 6, 44, 10, 0, 2, 54, 32, 46, 10, - 26, 0, 0, 0, 0, 0, 34, 70, 6, 20, 0, 14, 44, 2, 16, 10, - 2, 0, 72, 50,122, 48, 0, 32, 48, 32, 46, 0,124, 0, 0, 0, - 16, 2, 10, 10, 12, 2,126, 0, 6, 6, 6, 14, 6, 14, 24, 2, - 22, 22, 52, 74, 76, 32, 46, 0, 16, 58, 58, 78,128, 12, 14, 6, - 2, 0, 36,130,132, 32, 46, 0, 0,134,136,138, 16, 0, 0, 0, - 0, 70, 14, 6, 6, 20, 0, 6, 20, 6, 24, 0, 16, 10, 10, 2, - 0, 16, 10, 0, 2, 10, 0, 2, 2, 0, 0, 22, 76, 48, 0, 80, - 54, 22, 82, 0, 12, 12,140, 6, 28, 60, 38, 28, 84, 28, 86, 0, - 0, 0,142, 84, 2, 10, 16, 0, 26, 2, 16, 2, 28, 60, 38, 60, - 38, 18, 86, 0, 0, 0, 74, 38, 0, 0, 16, 10,144,146, 0, 0, - 12, 12,148, 6, 2,150,152, 22, 22, 22, 48, 80, 54, 22, 82,154, - 0, 0, 2,156, 0, 0, 0, 14, 0, 2, 2, 2, 2, 2, 26, 2, - 2,158, 2, 2, 88, 6, 6, 6, 6,160, 90, 92,162,164, 62, 58, - 166,168,170,172, 4, 4, 0, 10, 2, 6, 6, 94, 96, 26, 2,174, - 176, 98,178,180, 98,100,100, 2,102, 62,182, 2, 2,184,186,188, - 12, 12, 12,190, 4, 12,192, 0, 2, 26, 2, 2, 2, 88, 6, 6, - 6, 6, 0, 90, 62, 92, 96,194,196,198, 94,200,202,104,104,106, - 106,204, 0, 0, 42, 0,206, 0, 8,208, 8, 8,210, 40,212, 40, - 40, 2,214,216, 8, 34, 0, 0, 0, 0,218, 0, 4, 4, 4, 0, - 0, 34, 0, 0, 0, 0,108, 0, 0, 64,108, 0, 0, 0,220, 0, - 0, 42, 4, 34, 8, 40, 40, 40, 0, 0, 0,222, 2, 2,102, 16, - 4, 2, 2, 10, 16, 2, 4, 34, 0,224, 78, 2, 56, 12, 0, 0, - 0,226, 72, 0, 37, 37, 2, 2, 6, 6, 31, 31, 0, 0, 2, 37, - 29, 29, 37, 31, 37, 2, 12, 12, 31, 37, 11, 11, 31, 2, 24, 2, - 14, 14, 36, 36, 37, 11, 6, 37, 22, 27, 12, 37, 27, 27, 37, 6, - 24, 37, 11, 7, 11, 37, 11, 15, 11, 12, 15, 37, 37, 29, 0, 22, - 14, 12, 32, 32, 30, 30, 6, 29, 37, 15, 29, 37, 22, 37, 37, 12, - 12, 11, 22, 22, 15, 15, 11, 8, 14, 37, 14, 8, 2, 31, 35, 32, - 32, 33, 35, 35, 33, 33, 35, 23, 23, 23, 2, 32, 26, 38, 38, 38, - 30, 37, 12, 15, 12, 7, 15, 12, 37, 0, 0, 29, 29, 12, 18, 11, - 37, 13, 37, 3, 37, 28, 11, 10, 10, 37, 37, 10, 10, 22, 10, 11, - 29, 31, 37, 14, 37, 4, 4, 29, 6, 31, 2, 12, 12, 27, 25, 37, - 2, 11, 2, 24, 31, 35, 33, 34, 0, 32, 29, 9, 1, 21, 19, 20, - 16, 2, 21, 21, 17, 2, 23, 2, 2, 35, 32, 2, 20, 35, 34, 32, - 32, 29, 2, 29, 29, 32, 32, 35, 35, 34, 34, 34, 38, 39, 39, 26, - 9, 39, 27, 39, 0, 37, 0, 27, 27, 0, 0, 4, 4, 0, 41, 40, - 5, 37, 31, 12, 2, 23, 37, 22, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 80, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, + 0, 0, 0, 0, 0, 0, 0, 0, 0,104, 0,112, 0,120,128, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 3, 0, 0, 0, 0, 0, + 0, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 0, 0, 22, 23, 24, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 25, 26, 0, 0, 0, 27, 0, 0, 0, 0, 28, + 29, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, + 0, 0, 32, 0, 0, 0, 33, 0, 34, 0, 0, 0, 0, 0, 0, 35, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, + 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 25, 2, 10, 0, 0, 0, 0, 26, 0, 27, 0, 0, + 0, 28, 0, 0, 0, 0, 0, 29, 11, 30, 1, 1, 1, 4, 31, 32, + 33, 34, 1, 6, 2, 35, 1, 12, 13, 7, 1, 1, 3, 36, 14, 15, + 37, 16, 17, 6, 2, 38, 39, 18, 40, 7, 1, 1, 3, 41, 42, 43, + 44, 45, 46, 19, 2, 47, 0, 18, 48, 49, 1, 1, 3, 20, 14, 50, + 51, 0, 0, 21, 2, 0, 52, 53, 13, 7, 1, 1, 3, 20, 54, 15, + 55, 56, 17, 6, 2, 57, 0, 58, 59, 60, 61, 62, 63, 4, 64, 65, + 66, 16, 0, 19, 2, 0, 0, 67, 8, 9, 1, 1, 3, 4, 22, 68, + 69, 70, 71, 23, 2, 0, 0, 12, 8, 9, 1, 1, 3, 72, 22, 73, + 74, 75, 76, 23, 2, 77, 0, 78, 8, 9, 1, 1, 1, 4, 79, 80, + 81, 82, 83, 21, 2, 0, 84, 85, 1, 1, 86, 87, 88, 89, 90, 2, + 91, 92, 93, 94, 95, 96, 1, 97, 98, 2, 99, 0, 0, 0, 0, 1, + 1, 1,100,101, 11,102,103,104,105,106,107, 2, 10, 0, 0, 0, + 0,108, 5, 5,109,110,111, 0,112,113, 0,114, 0, 0, 0, 0, + 0, 0, 0, 0, 0,115, 0,116, 0, 0, 0, 0, 0, 0, 0, 0, + 117, 0, 0, 0, 0, 0,118, 0, 0, 0, 0, 5, 5,119,120, 0, + 0, 0, 0,121, 1, 2,122, 0, 0, 0, 0, 1, 1,123,124, 24, + 24, 0, 0, 0, 0, 0, 0,125, 0, 0, 0, 0, 0, 0,126, 0, + 0, 2, 2,127, 0, 0, 0, 0,128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,129, 0, 0, 0, 0, 2, 2, 2, 2, 4, 4, + 4, 4, 10, 2, 2, 2, 26, 2, 2, 2, 8, 8, 8, 8, 6, 18, + 0, 4, 20, 14, 24, 2, 6, 6, 20, 6, 20, 6, 24, 2, 4, 0, + 0, 0, 6, 6, 6, 6, 66, 12, 14, 6, 6, 6, 20, 14, 2, 0, + 36, 50, 52, 18, 38, 68, 0, 0, 0, 32, 0, 0, 2, 16, 56, 12, + 14, 6, 0, 0, 0, 4, 44, 2, 16, 2, 6, 22, 0, 4, 2, 0, + 36, 28, 6, 28, 0, 4, 30, 30, 30, 30, 0, 0, 42, 0, 34, 0, + 0, 0, 0, 64, 0, 0, 0, 0, 0, 42, 12, 12, 6, 6, 6, 6, + 24, 2, 2, 18, 36,110, 18, 18, 18, 18, 18, 18,112,114,116,118, + 120, 18, 0, 6, 6, 6, 44, 10, 0, 2, 54, 32, 46, 10, 26, 0, + 0, 0, 0, 0, 34, 70, 6, 20, 0, 14, 44, 2, 16, 10, 2, 0, + 72, 50,122, 48, 0, 32, 48, 32, 46, 0,124, 0, 0, 0, 16, 2, + 10, 10, 12, 2,126, 0, 6, 6, 6, 14, 6, 14, 24, 2, 22, 22, + 52, 74, 76, 32, 46, 0, 16, 58, 58, 78,128, 12, 14, 6, 2, 0, + 36,130,132, 32, 46, 0, 0,134,136,138, 16, 0, 0, 0, 0, 70, + 14, 6, 6, 20, 0, 6, 20, 6, 24, 0, 16, 10, 10, 2, 0, 16, + 10, 0, 2, 10, 0, 2, 2, 0, 0, 22, 76, 48, 0, 80, 54, 22, + 82, 0, 12, 12,140, 6, 28, 60, 38, 28, 84, 28, 86, 0, 0, 0, + 142, 84, 2, 10, 16, 0, 26, 2, 16, 2, 28, 60, 38, 60, 38, 18, + 86, 0, 0, 0, 74, 38, 0, 0, 16, 10,144,146, 0, 0, 12, 12, + 148, 6, 2,150,152, 22, 22, 22, 48, 80, 54, 22, 82,154, 0, 0, + 2,156, 0, 0, 0, 14, 0, 2, 2, 2, 2, 2, 26, 2, 2,158, + 2, 2, 88, 6, 6, 6, 6,160, 90, 92,162,164, 62, 58,166,168, + 170,172, 4, 4, 0, 10, 2, 6, 6, 94, 96, 26, 2,174,176, 98, + 178,180, 98,100,100, 2,102, 62,182, 2, 2,184,186,188, 12, 12, + 12,190, 4, 12,192, 0, 2, 26, 2, 2, 2, 88, 6, 6, 6, 6, + 0, 90, 62, 92, 96,194,196,198, 94,200,202,104,104,106,106,204, + 0, 0, 42, 0,206, 0, 8,208, 8, 8,210, 40,212, 40, 40, 2, + 214,216, 8, 34, 0, 0, 0, 0,218, 0, 4, 4, 4, 0, 0, 34, + 0, 0, 0, 0,108, 0, 0, 64,108, 0, 0, 0,220, 0, 0, 42, + 4, 34, 8, 40, 40, 40, 0, 0, 0,222, 2, 2,102, 16, 4, 2, + 2, 10, 16, 2, 4, 34, 0,224, 78, 2, 56, 12, 0, 0, 0,226, + 72, 0, 4, 4, 0, 0, 0, 10, 0, 0,228, 0, 0, 0, 37, 37, + 2, 2, 6, 6, 31, 31, 0, 0, 2, 37, 29, 29, 37, 31, 37, 2, + 12, 12, 31, 37, 11, 11, 31, 2, 24, 2, 14, 14, 36, 36, 37, 11, + 6, 37, 22, 27, 12, 37, 27, 27, 37, 6, 24, 37, 11, 7, 11, 37, + 11, 15, 11, 12, 15, 37, 37, 29, 0, 22, 14, 12, 32, 32, 30, 30, + 6, 29, 37, 15, 29, 37, 22, 37, 37, 12, 12, 11, 22, 22, 15, 15, + 11, 8, 14, 37, 14, 8, 2, 31, 35, 32, 32, 33, 35, 35, 33, 33, + 35, 23, 23, 23, 2, 32, 26, 38, 38, 38, 30, 37, 12, 15, 12, 7, + 15, 12, 37, 0, 0, 29, 29, 12, 18, 11, 37, 13, 37, 3, 37, 28, + 11, 10, 10, 37, 37, 10, 10, 22, 10, 11, 29, 31, 37, 14, 37, 4, + 4, 29, 6, 31, 2, 12, 12, 27, 25, 37, 2, 11, 2, 24, 31, 35, + 33, 34, 0, 32, 29, 9, 1, 21, 19, 20, 16, 2, 21, 21, 17, 2, + 23, 2, 2, 35, 32, 2, 20, 35, 34, 32, 32, 29, 2, 29, 29, 32, + 32, 35, 35, 34, 34, 34, 38, 39, 39, 26, 9, 39, 27, 39, 0, 37, + 0, 27, 27, 0, 0, 4, 4, 0, 41, 40, 5, 37, 31, 12, 2, 23, + 37, 22, 29, 2, }; -static inline uint8_t _hb_indic_b4 (const uint8_t* a, unsigned i) -{ - return (a[i>>1]>>((i&1)<<2))&15; -} static inline uint8_t _hb_indic_get_categories_index (unsigned u) { - /* packtab: [2^4,2^3,2^3,2^2,2^1] */ - return u<71396u ? (uint8_t)(_hb_indic_u8[996u+_hb_indic_u8[488u+((_hb_indic_u8[186u+((_hb_indic_u8[70u+((_hb_indic_b4(_hb_indic_u8,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)])<<3)+((((((u)>>1))>>2))&7)])<<2)+((((u)>>1))&3)]+((u)&1)]) : 37; + /* packtab: [2^8,2^3,2^3,2^2,2^1] */ + return u<73202u ? (uint8_t)(_hb_indic_u8[1118u+_hb_indic_u8[598u+((_hb_indic_u8[279u+((_hb_indic_u8[143u+_hb_indic_u8[((((((((u)>>1))>>2))>>3))>>3)]+((((((((u)>>1))>>2))>>3))&7)])<<3)+((((((u)>>1))>>2))&7)])<<2)+((((u)>>1))&3)]+((u)&1)]) : 37; } uint16_t diff --git a/test/shape/data/in-house/meson.build b/test/shape/data/in-house/meson.build index 2ca97bbac..f1417fe67 100644 --- a/test/shape/data/in-house/meson.build +++ b/test/shape/data/in-house/meson.build @@ -43,6 +43,7 @@ in_house_tests = [ 'indic-script-extensions.tests', 'indic-special-cases.tests', 'indic-syllable.tests', + 'indic-unicode18.tests', 'indic-vowel-letter-spoofing.tests', 'item-context.tests', 'kbts.tests', diff --git a/test/shape/data/in-house/tests/indic-unicode18.tests b/test/shape/data/in-house/tests/indic-unicode18.tests new file mode 100644 index 000000000..538fcda8c --- /dev/null +++ b/test/shape/data/in-house/tests/indic-unicode18.tests @@ -0,0 +1,10 @@ +# Unicode 18 additions in Devanagari Extended-A and Bengali Supplement. +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot;U+11B0A,U+093C;[1=0|1=0] +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot;U+11B0A,U+093F;[1=0|1=0] +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot;U+11B0A,U+094C;[1=0|1=0] +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot;U+11B0A,U+094D,U+0915;[1=0|1=0|1=2] +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot;U+11DF1,U+09BC;[1=0|1=0] +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot;U+11DF1,U+09BF;[1=0|1=0] +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot;U+11DF1,U+09BE;[1=0|1=0] +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot;U+0995,U+11DF0;[1=0|1=0] +../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot --script=beng;U+11DF0;[1=0|1=0]