[color] Round extents when scaling
This commit is contained in:
parent
c929ccfcea
commit
e998fb9fbf
|
@ -443,11 +443,13 @@ struct CBDT
|
|||
}
|
||||
}
|
||||
|
||||
/* Convert to the font units. */
|
||||
extents->x_bearing *= upem / (float) x_ppem;
|
||||
extents->y_bearing *= upem / (float) y_ppem;
|
||||
extents->width *= upem / (float) x_ppem;
|
||||
extents->height *= upem / (float) y_ppem;
|
||||
/* Convert to font units. */
|
||||
double x_scale = upem / (double) x_ppem;
|
||||
double y_scale = upem / (double) y_ppem;
|
||||
extents->x_bearing = round (extents->x_bearing * x_scale);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -252,14 +252,14 @@ struct sbix
|
|||
extents->width = png.IHDR.width;
|
||||
extents->height = png.IHDR.height;
|
||||
|
||||
/* Convert to the font units. */
|
||||
/* Convert to font units. */
|
||||
if (strike_ppem)
|
||||
{
|
||||
unsigned int upem = font->face->upem;
|
||||
extents->x_bearing *= upem / (float) strike_ppem;
|
||||
extents->y_bearing *= upem / (float) strike_ppem;
|
||||
extents->width *= upem / (float) strike_ppem;
|
||||
extents->height *= upem / (float) strike_ppem;
|
||||
double scale = font->face->upem / (double) strike_ppem;
|
||||
extents->x_bearing = round (extents->x_bearing * scale);
|
||||
extents->y_bearing = round (extents->y_bearing * scale);
|
||||
extents->width = round (extents->width * scale);
|
||||
extents->height = round (extents->height * scale);
|
||||
}
|
||||
|
||||
hb_blob_destroy (blob);
|
||||
|
|
Loading…
Reference in New Issue