backend: Fix em computation for non-absolute fonts

If a font description is not set to have an absolute size then we were
using the wrong transformation for points to device units.
This commit is contained in:
Emmanuele Bassi 2011-12-05 11:43:48 +00:00
parent 943a65b476
commit 158245fda3

View File

@ -176,14 +176,10 @@ get_units_per_em (ClutterBackend *backend,
if (is_absolute) if (is_absolute)
font_size = (gdouble) pango_size / PANGO_SCALE; font_size = (gdouble) pango_size / PANGO_SCALE;
else else
font_size = (gdouble) pango_size / PANGO_SCALE font_size = dpi * ((gdouble) pango_size / PANGO_SCALE) / 72.0f;
* dpi
/ 96.0f;
/* 10 points at 96 DPI is 13.3 pixels */ /* 10 points at 96 DPI is 13.3 pixels */
units_per_em = (1.2f * font_size) units_per_em = (1.2f * font_size) * dpi / 96.0f;
* dpi
/ 96.0f;
} }
else else
units_per_em = -1.0f; units_per_em = -1.0f;