summaryrefslogtreecommitdiff
path: root/pango/shape.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-17 14:24:17 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-12-17 14:47:59 -0500
commit22f8df579d82f342909b629c0e94b8ff7c5452fd (patch)
tree7112e37d600ce33fa5613f46d12b33879c457b4b /pango/shape.c
parente54d4fd26f6e73a32b89fd8d72ec09103ecd386e (diff)
downloadpango-22f8df579d82f342909b629c0e94b8ff7c5452fd.tar.gz
Revert "Fix advance widths with transforms"fix-vertical-regression
This reverts commit ccb651dd2a876a4f4a4cb9351f05332173e709ba. This broke vertical text rendering, see https://gitlab.com/inkscape/inkscape/-/issues/2950. Update affected tests and add a vertical test.
Diffstat (limited to 'pango/shape.c')
-rw-r--r--pango/shape.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/pango/shape.c b/pango/shape.c
index d0140d5e..90334cc1 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -162,11 +162,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
@@ -176,14 +181,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;
- if (hb_font_get_glyph_v_advance (context->parent, glyph) < 0)
- return - logical.height;
- else
- return logical.height;
+ pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
+ return logical.height;
+ }
+
+ return hb_font_get_glyph_v_advance (context->parent, glyph);
}
static hb_bool_t
@@ -194,16 +201,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 *