summaryrefslogtreecommitdiff
blob: 3b4d3f4f21b357bd323580984f03706b6bba550a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 85a466268360ad007de90e34b24fa0f56692eaa8 Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@linux.intel.com>
Date: Mon, 5 Dec 2011 11:43:48 +0000
Subject: [PATCH] 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.
(cherry picked from commit 158245fda31e7adad38aa49e4c12efcad0e326e0)

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
---
 clutter/clutter-backend.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c
index 8267544..db0a637 100644
--- a/clutter/clutter-backend.c
+++ b/clutter/clutter-backend.c
@@ -155,14 +155,10 @@ get_units_per_em (ClutterBackend       *backend,
       if (is_absolute)
         font_size = (gdouble) pango_size / PANGO_SCALE;
       else
-        font_size = (gdouble) pango_size / PANGO_SCALE
-                  * dpi
-                  / 96.0f;
+        font_size = dpi * ((gdouble) pango_size / PANGO_SCALE) / 72.0f;
 
       /* 10 points at 96 DPI is 13.3 pixels */
-      units_per_em = (1.2f * font_size)
-                   * dpi
-                   / 96.0f;
+      units_per_em = (1.2f * font_size) * dpi / 96.0f;
     }
   else
     units_per_em = -1.0f;
-- 
1.7.8.1