[pango/simple-fontmap: 34/35] Fix vertical metrics
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 34/35] Fix vertical metrics
- Date: Thu, 21 Oct 2021 18:55:51 +0000 (UTC)
commit 6bc23a21bedc4ad5d9ccb5f680deff1baf8ed36c
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 21 13:43:43 2021 -0500
Fix vertical metrics
If the gravity is vertical, ask harfbuzz for vertical
metrics. This fixes glyph positioning in vertical text.
pango/pango-hbfont.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-hbfont.c b/pango/pango-hbfont.c
index 2e4da212..67abfa51 100644
--- a/pango/pango-hbfont.c
+++ b/pango/pango-hbfont.c
@@ -224,9 +224,13 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
{
hb_font_extents_t font_extents;
hb_position_t x, y;
+ hb_direction_t direction;
- hb_font_get_extents_for_direction (hb_font, HB_DIRECTION_LTR, &font_extents);
- hb_font_get_glyph_advance_for_direction (hb_font, glyph, HB_DIRECTION_LTR, &x, &y);
+ direction = PANGO_GRAVITY_IS_VERTICAL (PANGO_HB_FONT (font)->gravity)
+ ? HB_DIRECTION_TTB : HB_DIRECTION_LTR;
+
+ hb_font_get_extents_for_direction (hb_font, direction, &font_extents);
+ hb_font_get_glyph_advance_for_direction (hb_font, glyph, direction, &x, &y);
logical_rect->x = 0;
logical_rect->width = x;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]