[pango/pango-1-48] Revert "Fix advance widths with transforms"



commit f3819b394772ababab9b00fe76a0856bf5245b89
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Dec 17 14:19:56 2021 -0500

    Revert "Fix advance widths with transforms"
    
    This reverts commit 81f8a47df61f1df9ca82a08813c022150e7d96aa.
    
    This broke vertical text rendering, see
    https://gitlab.com/inkscape/inkscape/-/issues/2950.

 pango/pangofc-shape.c | 42 +++++++++++++++++++++++++++++-------------
 1 file changed, 29 insertions(+), 13 deletions(-)
---
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 460635e8..0a5ce7f9 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -207,11 +207,16 @@ pango_hb_font_get_glyph_h_advance (hb_font_t      *font,
                                    void           *user_data G_GNUC_UNUSED)
 {
   PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
-  PangoRectangle logical;
 
-  pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
+  if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+    {
+      PangoRectangle logical;
+
+      pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
+      return logical.width;
+    }
 
-  return logical.width;
+  return hb_font_get_glyph_h_advance (context->parent, glyph);
 }
 
 static hb_position_t
@@ -221,11 +226,16 @@ pango_hb_font_get_glyph_v_advance (hb_font_t      *font,
                                    void           *user_data G_GNUC_UNUSED)
 {
   PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
-  PangoRectangle logical;
 
-  pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
+  if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+    {
+      PangoRectangle logical;
+
+      pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
+      return logical.height;
+    }
 
-  return logical.height;
+  return hb_font_get_glyph_v_advance (context->parent, glyph);
 }
 
 static hb_bool_t
@@ -236,16 +246,22 @@ pango_hb_font_get_glyph_extents (hb_font_t          *font,
                                  void               *user_data G_GNUC_UNUSED)
 {
   PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
-  PangoRectangle ink;
 
-  pango_font_get_glyph_extents (context->font, glyph, &ink, NULL);
+  if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+    {
+      PangoRectangle ink;
+
+      pango_font_get_glyph_extents (context->font, glyph, &ink, NULL);
 
-  extents->x_bearing = ink.x;
-  extents->y_bearing = ink.y;
-  extents->width     = ink.width;
-  extents->height    = ink.height;
+      extents->x_bearing = ink.x;
+      extents->y_bearing = ink.y;
+      extents->width     = ink.width;
+      extents->height    = ink.height;
+
+      return TRUE;
+    }
 
-  return TRUE;
+  return hb_font_get_glyph_extents (context->parent, glyph, extents);
 }
 
 static hb_font_t *


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