mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 01:54:21 +01:00
[ot-layout] Convert script tags for hanging baseline synthesis (#6467)
The baseline fallback accepts an OpenType script tag but compared it with hb_script_t values. Convert the tag before choosing the glyph used to synthesize the hanging baseline. Exercise Bengali's old and new OpenType tags, Tibetan, and the script and language entry point. The updated test fails before the fix (622 versus 600); the full Meson suite passes (293 tests). Reported by Anthropic's OSS Scanner as ordinary bug ANT-2026-COIT72UF. Assisted-by: OpenAI Codex
This commit is contained in:
1 parent
c207662595
commit
f030bd2186
2 files changed
+15
-3
No files matched your search
+1
-1
@@ -2520,7 +2520,7 @@ hb_ot_layout_get_baseline_with_fallback (hb_font_t *font,
|
||||
hb_glyph_extents_t extents;
|
||||
|
||||
/* Keep in sync with hb_ot_layout_get_horizontal_baseline_for_script */
|
||||
switch ((int) script_tag)
|
||||
switch ((int) hb_ot_tag_to_script (script_tag))
|
||||
{
|
||||
/* Unicode-1.1 additions */
|
||||
case HB_SCRIPT_BENGALI: ch = 0x0995u; break;
|
||||
|
||||
@@ -105,13 +105,25 @@ test_ot_layout_base_with_fallback (void)
|
||||
font = hb_font_create (face);
|
||||
|
||||
hb_ot_layout_get_baseline_with_fallback (font, HB_OT_LAYOUT_BASELINE_TAG_HANGING, HB_DIRECTION_LTR,
|
||||
HB_SCRIPT_BENGALI,
|
||||
HB_TAG ('b','e','n','g'),
|
||||
HB_TAG ('E','N','G',' '),
|
||||
&position);
|
||||
g_assert_cmpint (622, ==, position);
|
||||
|
||||
hb_ot_layout_get_baseline_with_fallback (font, HB_OT_LAYOUT_BASELINE_TAG_HANGING, HB_DIRECTION_LTR,
|
||||
HB_SCRIPT_TIBETAN,
|
||||
HB_TAG ('b','n','g','2'),
|
||||
HB_TAG ('E','N','G',' '),
|
||||
&position);
|
||||
g_assert_cmpint (622, ==, position);
|
||||
|
||||
hb_ot_layout_get_baseline_with_fallback2 (font, HB_OT_LAYOUT_BASELINE_TAG_HANGING, HB_DIRECTION_LTR,
|
||||
HB_SCRIPT_BENGALI,
|
||||
hb_language_from_string ("bn", -1),
|
||||
&position);
|
||||
g_assert_cmpint (622, ==, position);
|
||||
|
||||
hb_ot_layout_get_baseline_with_fallback (font, HB_OT_LAYOUT_BASELINE_TAG_HANGING, HB_DIRECTION_LTR,
|
||||
HB_TAG ('t','i','b','t'),
|
||||
HB_TAG ('E','N','G',' '),
|
||||
&position);
|
||||
g_assert_cmpint (600, ==, position);
|
||||
|
||||
Reference in new issue
Block a user