[pango/synthetic-slant: 311/311] Pass synthetic slant to harfbuzz




commit 9a27171411c06d78d0a602a85d4c5c7515c366ae
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 11 12:44:29 2021 -0400

    Pass synthetic slant to harfbuzz
    
    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 requires new api in HarfBuzz > 3.2

 pango/pangofc-font.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 77e99e16..72ff7739 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -950,10 +950,12 @@ pango_fc_font_create_hb_font (PangoFont *font)
   double x_scale, y_scale;
   double pixel_size;
   double point_size;
+  double slant;
 
   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)
@@ -979,6 +981,7 @@ pango_fc_font_create_hb_font (PangoFont *font)
       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;
@@ -989,6 +992,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);
     }
 
@@ -1003,6 +1007,8 @@ pango_fc_font_create_hb_font (PangoFont *font)
                      pixel_size * PANGO_SCALE * y_scale);
   hb_font_set_ptem (hb_font, point_size);
 
+  hb_font_set_synthetic_slant (hb_font, slant);
+
   if (key)
     {
       const FcPattern *pattern = pango_fc_font_key_get_pattern (key);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]