summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-28 19:09:25 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-07-28 19:09:25 -0400
commit775c99e5b8567d0a1773b6ffe6e6d2fd8047d097 (patch)
tree962656780dfd773ac06027e6d942aebbe46d5736
parent08ed8c5251b6ebcb35f6d073410617de1af51248 (diff)
downloadpango-775c99e5b8567d0a1773b6ffe6e6d2fd8047d097.tar.gz
Take font matrix into account
When setting up the scale of the hb_font_t, we need to take both the pango ctm and the font matrix into account - this used to come for free when we were calling into cairo for getting glyph metrics. Now, we use harfbuzz for glyph metrics, so we need to give it the proper scale info. The symptom of this was Emoji getting an enormous width. Curiously, cairo would still render them at the expected size.
-rw-r--r--pango/pangofc-font.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 5ed9b792..a4bf5f61 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -1006,11 +1006,30 @@ pango_fc_font_create_hb_font (PangoFont *font)
key = _pango_fc_font_get_font_key (fc_font);
if (key)
{
+ const FcPattern *pattern = pango_fc_font_key_get_pattern (key);
const PangoMatrix *matrix;
+ PangoMatrix matrix2;
PangoGravity gravity;
+ FcMatrix fc_matrix, *fc_matrix_val;
+ double x, y;
+ int i;
matrix = pango_fc_font_key_get_matrix (key);
pango_matrix_get_font_scale_factors (matrix, &x_scale_inv, &y_scale_inv);
+
+ FcMatrixInit (&fc_matrix);
+ for (i = 0; FcPatternGetMatrix (pattern, FC_MATRIX, i, &fc_matrix_val) == FcResultMatch; i++)
+ FcMatrixMultiply (&fc_matrix, &fc_matrix, fc_matrix_val);
+
+ matrix2.xx = fc_matrix.xx;
+ matrix2.yx = fc_matrix.yx;
+ matrix2.xy = fc_matrix.xy;
+ matrix2.yy = fc_matrix.yy;
+ pango_matrix_get_font_scale_factors (&matrix2, &x, &y);
+
+ x_scale_inv /= x;
+ y_scale_inv /= y;
+
gravity = pango_fc_font_key_get_gravity (key);
if (PANGO_GRAVITY_IS_IMPROPER (gravity))
{