diff --git a/src/hb-ft.cc b/src/hb-ft.cc index ff1e187b3..113b0eb85 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -94,7 +94,7 @@ hb_ft_get_glyph_h_advance (hb_font_t *font HB_UNUSED, if (unlikely (FT_Get_Advance (ft_face, glyph, load_flags, &v))) return 0; - return v >> 10; + return (v + (1<<9)) >> 10; } static hb_position_t @@ -112,7 +112,7 @@ hb_ft_get_glyph_v_advance (hb_font_t *font HB_UNUSED, /* Note: FreeType's vertical metrics grows downward while other FreeType coordinates * have a Y growing upward. Hence the extra negation. */ - return -v >> 10; + return (-v + (1<<9)) >> 10; } static hb_bool_t @@ -418,8 +418,8 @@ hb_ft_font_create (FT_Face ft_face, _hb_ft_get_font_funcs (), ft_face, (hb_destroy_func_t) _do_nothing); hb_font_set_scale (font, - ((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM) >> 16, - ((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM) >> 16); + ((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16, + ((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16); hb_font_set_ppem (font, ft_face->size->metrics.x_ppem, ft_face->size->metrics.y_ppem);