mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 17:01:17 +01:00
[fallback] Widen space advance formulas
Fallback space advances negate, round, and multiply the font scale. Perform those operations in 64-bit arithmetic so full-range scales do not overflow before the final, bounded division. Tested with: meson test -C build --print-errorlogs Assisted-by: OpenAI Codex
This commit is contained in:
1 parent
f531c3ffc7
commit
b9e31281a0
1 file changed
+5
-5
@@ -573,7 +573,7 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
||||
if (horizontal)
|
||||
pos[i].x_advance = +font->x_scale / 4;
|
||||
else
|
||||
pos[i].y_advance = -font->y_scale / 4;
|
||||
pos[i].y_advance = -(int64_t) font->y_scale / 4;
|
||||
}
|
||||
|
||||
hb_unicode_funcs_t::space_t space_type = _hb_glyph_info_get_unicode_space_fallback_type (&info[i]);
|
||||
@@ -593,16 +593,16 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
||||
case t::SPACE_EM_6:
|
||||
case t::SPACE_EM_16:
|
||||
if (horizontal)
|
||||
pos[i].x_advance = +(font->x_scale + ((int) space_type)/2) / (int) space_type;
|
||||
pos[i].x_advance = ((int64_t) font->x_scale + ((int) space_type)/2) / (int) space_type;
|
||||
else
|
||||
pos[i].y_advance = -(font->y_scale + ((int) space_type)/2) / (int) space_type;
|
||||
pos[i].y_advance = -((int64_t) font->y_scale + ((int) space_type)/2) / (int) space_type;
|
||||
break;
|
||||
|
||||
case t::SPACE_4_EM_18:
|
||||
if (horizontal)
|
||||
pos[i].x_advance = (int64_t) +font->x_scale * 4 / 18;
|
||||
pos[i].x_advance = (int64_t) font->x_scale * 4 / 18;
|
||||
else
|
||||
pos[i].y_advance = (int64_t) -font->y_scale * 4 / 18;
|
||||
pos[i].y_advance = -(int64_t) font->y_scale * 4 / 18;
|
||||
break;
|
||||
|
||||
case t::SPACE_FIGURE:
|
||||
|
||||
Reference in new issue
Block a user