diff --git a/src/hb-font.hh b/src/hb-font.hh index 5e02ca79f..c2b805a49 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -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 (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); } }