Round when scaling values

Doesn't matter for most users since they should be working in a
fixed sub-pixel scale anyway (ie. 22.10, 26.6, 16.16, etc).
This commit is contained in:
Behdad Esfahbod 2013-08-09 09:40:01 -04:00
parent df8f70ae5d
commit 10f964623f
2 changed files with 5 additions and 3 deletions

2
TODO
View File

@ -12,8 +12,6 @@ General fixes:
- Warn at compile time (and runtime with HB_DEBUG?) if no Unicode / font
funcs found / set.
- Do proper rounding when scaling from font space? May be a non-issue.
- Misc features:
* init/medi/fina/isol for non-cursive scripts

View File

@ -461,7 +461,11 @@ struct hb_font_t {
}
private:
inline hb_position_t em_scale (int16_t v, int scale) { return v * (int64_t) scale / face->get_upem (); }
inline hb_position_t em_scale (int16_t v, int scale)
{
unsigned int upem = face->get_upem ();
return (v * (int64_t) scale + upem / 2) / upem;
}
};
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS