[pango/pango-1-48: 1/2] Fix advance widths with transforms
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango-1-48: 1/2] Fix advance widths with transforms
- Date: Wed, 17 Nov 2021 00:40:01 +0000 (UTC)
commit 81f8a47df61f1df9ca82a08813c022150e7d96aa
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Nov 16 13:30:46 2021 -0600
Fix advance widths with transforms
The hb_font_t we were passing to Harfbuzz
for shaping was not taking context transforms
into account, and therefore was not scaling
advance widths as necessary. Always go through
pangos glyph extents to fix this.
Fixes: #620
This is a backport of commit ccb651dd2a876a4f4a4cb9351f05332173e709ba
pango/pangofc-shape.c | 42 +++++++++++++-----------------------------
1 file changed, 13 insertions(+), 29 deletions(-)
---
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 0a5ce7f9..460635e8 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -207,16 +207,11 @@ pango_hb_font_get_glyph_h_advance (hb_font_t *font,
void *user_data G_GNUC_UNUSED)
{
PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+ PangoRectangle logical;
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- {
- PangoRectangle logical;
-
- pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
- return logical.width;
- }
+ pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
- return hb_font_get_glyph_h_advance (context->parent, glyph);
+ return logical.width;
}
static hb_position_t
@@ -226,16 +221,11 @@ pango_hb_font_get_glyph_v_advance (hb_font_t *font,
void *user_data G_GNUC_UNUSED)
{
PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+ PangoRectangle logical;
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- {
- PangoRectangle logical;
-
- pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
- return logical.height;
- }
+ pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
- return hb_font_get_glyph_v_advance (context->parent, glyph);
+ return logical.height;
}
static hb_bool_t
@@ -246,22 +236,16 @@ pango_hb_font_get_glyph_extents (hb_font_t *font,
void *user_data G_GNUC_UNUSED)
{
PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+ PangoRectangle ink;
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- {
- PangoRectangle ink;
-
- pango_font_get_glyph_extents (context->font, glyph, &ink, NULL);
+ 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;
-
- return TRUE;
- }
+ extents->x_bearing = ink.x;
+ extents->y_bearing = ink.y;
+ extents->width = ink.width;
+ extents->height = ink.height;
- return hb_font_get_glyph_extents (context->parent, glyph, extents);
+ return TRUE;
}
static hb_font_t *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]