X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fhb-font-private.hh;h=0b755779490a92c2f46db45d07417b3f1aa4d554;hb=e8e3a59d74b93e80f83e2fbd41cc23fd205f47f6;hp=8da40a992e963af526a4114d7f3f23d19c7edb80;hpb=5200acdbfd74b4eda74180a84ba3c53f170d95f0;p=platform%2Fupstream%2Fharfbuzz.git diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh index 8da40a9..0b75577 100644 --- a/src/hb-font-private.hh +++ b/src/hb-font-private.hh @@ -505,7 +505,13 @@ struct hb_font_t { } private: - inline hb_position_t em_scale (int16_t v, int scale) { return (hb_position_t) (v * (int64_t) scale / face->get_upem ()); } + inline hb_position_t em_scale (int16_t v, int scale) + { + int upem = face->get_upem (); + int64_t scaled = v * (int64_t) scale; + scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */ + return (hb_position_t) (scaled / upem); + } }; #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS