diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-09-11 12:44:29 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-01-02 13:37:24 -0500 |
commit | 1a553ba64c43c13e37d54f1fb20a656ffb2ef067 (patch) | |
tree | 01af735f9e717c0184e180da59e9c66c8f493f2b /pango/pangofc-font.c | |
parent | 492df836ade5056e73f4779593ce31598ed77d85 (diff) | |
download | pango-1a553ba64c43c13e37d54f1fb20a656ffb2ef067.tar.gz |
Pass synthetic slant to harfbuzzsynthetic-slant
When our font matrix includes a slant, pass that information
to HarfBuzz, so it can adjust its mark positioning, metrics
like caret slope, etc.
This commit corrects the code that pulls the font matrix out
of fontconfig to properly take the flipped y axis between fontconfig
and pango into account.
Requires new api in HarfBuzz > 3.2
Diffstat (limited to 'pango/pangofc-font.c')
-rw-r--r-- | pango/pangofc-font.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index 03f15efa..9d555a37 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -964,10 +964,12 @@ pango_fc_font_create_hb_font (PangoFont *font) double x_scale, y_scale; double pixel_size; double point_size; + double slant G_GNUC_UNUSED; x_scale_inv = y_scale_inv = 1.0; pixel_size = 1.0; point_size = 1.0; + slant = 0.0; key = _pango_fc_font_get_font_key (fc_font); if (key) @@ -988,11 +990,12 @@ pango_fc_font_create_hb_font (PangoFont *font) FcMatrixMultiply (&fc_matrix, &fc_matrix, fc_matrix_val); font_matrix.xx = fc_matrix.xx; - font_matrix.yx = fc_matrix.yx; + font_matrix.yx = - fc_matrix.yx; font_matrix.xy = fc_matrix.xy; - font_matrix.yy = fc_matrix.yy; + font_matrix.yy = - fc_matrix.yy; pango_matrix_get_font_scale_factors (&font_matrix, &x, &y); + slant = pango_matrix_get_slant_ratio (&font_matrix); x_scale_inv /= x; y_scale_inv /= y; @@ -1003,6 +1006,7 @@ pango_fc_font_create_hb_font (PangoFont *font) x_scale_inv = -x_scale_inv; y_scale_inv = -y_scale_inv; } + get_font_size (key, &pixel_size, &point_size); } @@ -1017,6 +1021,10 @@ pango_fc_font_create_hb_font (PangoFont *font) pixel_size * PANGO_SCALE * y_scale); hb_font_set_ptem (hb_font, point_size); +#if HB_VERSION_ATLEAST (3, 3, 0) + hb_font_set_synthetic_slant (hb_font, slant); +#endif + if (key) { const FcPattern *pattern = pango_fc_font_key_get_pattern (key); |