diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-07-28 23:48:04 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-07-28 23:48:04 +0000 |
commit | 4f601cd5b95f397a2056a7a6e72c3bd2222f9658 (patch) | |
tree | 962656780dfd773ac06027e6d942aebbe46d5736 | |
parent | 08ed8c5251b6ebcb35f6d073410617de1af51248 (diff) | |
parent | 775c99e5b8567d0a1773b6ffe6e6d2fd8047d097 (diff) | |
download | pango-4f601cd5b95f397a2056a7a6e72c3bd2222f9658.tar.gz |
Merge branch 'fix-emoji-scaling' into 'master'
Take font matrix into account
See merge request GNOME/pango!107
-rw-r--r-- | pango/pangofc-font.c | 19 |
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)) { |