summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh8
1 files changed, 7 insertions, 1 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh
index 8da40a992e9..0b755779490 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/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