mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 15:31:05 +01:00
[font] Saturate synthetic contour points
Synthetic slant and emboldening add adjustments to full-range contour coordinates. Keep the slant calculation in float, clamp its rounded delta, and saturate both additions. Tested with: meson test -C build --print-errorlogs Assisted-by: OpenAI Codex
This commit is contained in:
1 parent
b9e31281a0
commit
d09f9bbc21
1 file changed
+4
-3
+4
-3
@@ -667,13 +667,14 @@ struct hb_font_t
|
||||
{
|
||||
/* Slant */
|
||||
if (slant_xy)
|
||||
*x += roundf (*y * slant_xy);
|
||||
*x = hb_saturate_add (*x,
|
||||
hb_clamp_to<hb_position_t> (roundf (*y * slant_xy)));
|
||||
|
||||
/* Embolden */
|
||||
if (!embolden_in_place)
|
||||
{
|
||||
int x_shift = x_scale < 0 ? -x_strength : x_strength;
|
||||
*x += x_shift;
|
||||
hb_position_t x_shift = x_scale < 0 ? hb_saturate_neg (x_strength) : x_strength;
|
||||
*x = hb_saturate_add (*x, x_shift);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user