提交 e998fb9f 编写于 作者: B Behdad Esfahbod

[color] Round extents when scaling

上级 c929ccfc
...@@ -443,11 +443,13 @@ struct CBDT ...@@ -443,11 +443,13 @@ struct CBDT
} }
} }
/* Convert to the font units. */ /* Convert to font units. */
extents->x_bearing *= upem / (float) x_ppem; double x_scale = upem / (double) x_ppem;
extents->y_bearing *= upem / (float) y_ppem; double y_scale = upem / (double) y_ppem;
extents->width *= upem / (float) x_ppem; extents->x_bearing = round (extents->x_bearing * x_scale);
extents->height *= upem / (float) y_ppem; extents->y_bearing = round (extents->y_bearing * y_scale);
extents->width = round (extents->width * x_scale);
extents->height = round (extents->height * y_scale);
return true; return true;
} }
......
...@@ -252,14 +252,14 @@ struct sbix ...@@ -252,14 +252,14 @@ struct sbix
extents->width = png.IHDR.width; extents->width = png.IHDR.width;
extents->height = png.IHDR.height; extents->height = png.IHDR.height;
/* Convert to the font units. */ /* Convert to font units. */
if (strike_ppem) if (strike_ppem)
{ {
unsigned int upem = font->face->upem; double scale = font->face->upem / (double) strike_ppem;
extents->x_bearing *= upem / (float) strike_ppem; extents->x_bearing = round (extents->x_bearing * scale);
extents->y_bearing *= upem / (float) strike_ppem; extents->y_bearing = round (extents->y_bearing * scale);
extents->width *= upem / (float) strike_ppem; extents->width = round (extents->width * scale);
extents->height *= upem / (float) strike_ppem; extents->height = round (extents->height * scale);
} }
hb_blob_destroy (blob); hb_blob_destroy (blob);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册