summaryrefslogtreecommitdiff
path: root/pango/pangocoretext-fontmap.c
diff options
context:
space:
mode:
authorJohn Ralls <jralls@ceridwen.us>2018-04-29 16:03:08 -0700
committerJohn Ralls <jralls@ceridwen.us>2018-05-08 17:55:35 -0700
commitf661cdbf8cfbdb2ba7241d8dfa4a579c6dfe0a94 (patch)
treeee57d3ef3507c65bd5a74c13ad10f63cb4c72964 /pango/pangocoretext-fontmap.c
parentedb0dff3454d4d9ce6242a0f30ddaef993ee1e89 (diff)
downloadpango-f661cdbf8cfbdb2ba7241d8dfa4a579c6dfe0a94.tar.gz
Restore scaling of CoreText fonts.
Fixes bug 787867.
Diffstat (limited to 'pango/pangocoretext-fontmap.c')
-rw-r--r--pango/pangocoretext-fontmap.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index 4d101847..c5cacab4 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -806,6 +806,7 @@ get_context_matrix (PangoContext *context,
/*
* Helper functions for PangoCoreTextFontsetKey
*/
+static const double ppi = 72.0; /* typographic points per inch */
static double
pango_core_text_font_map_get_resolution (PangoCoreTextFontMap *fontmap,
@@ -817,7 +818,7 @@ pango_core_text_font_map_get_resolution (PangoCoreTextFontMap *fontmap,
/* FIXME: acquire DPI from CoreText using some deafault font */
g_warning ("FIXME: returning default DPI");
- return 72.0;
+ return ppi;
}
static int
@@ -826,8 +827,16 @@ get_scaled_size (PangoCoreTextFontMap *fontmap,
const PangoFontDescription *desc)
{
double size = pango_font_description_get_size (desc);
-
- return .5 + pango_matrix_get_font_scale_factor (pango_context_get_matrix (context)) * size;
+ PangoMatrix *matrix = pango_context_get_matrix (context);
+ double scale_factor = pango_matrix_get_font_scale_factor (matrix);
+
+ if (!pango_font_description_get_size_is_absolute(desc))
+ {
+ double dpi = pango_core_text_font_map_get_resolution (fontmap, context);
+ size *= (dpi/ppi);
+ }
+
+ return .5 + scale_factor * size;
}