[pango/simple-fontmap: 10/13] Fix glyph extents to look right
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 10/13] Fix glyph extents to look right
- Date: Fri, 29 Oct 2021 19:05:25 +0000 (UTC)
commit 93d35f3ba3ad4b1bab4f5b532888b4ba7b20c95f
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 21 13:54:19 2021 -0500
Fix glyph extents to look right
This is done purely by visual inspection.
Not clear to me why this is necessary.
To test this, I've used
pango-view --font-file /usr/share/fonts/cantarell/Cantarell-VF.otf \
--font="Cantarell 64" \
--gravity=east --gravity-hint=strong --rotate=-90 \
--text "Vertical" \
--annotate=glyph
Remove the --font-file argument to see the rendering
with the current code.
pango/pango-hbfont.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/pango/pango-hbfont.c b/pango/pango-hbfont.c
index 86729338..a17f52bf 100644
--- a/pango/pango-hbfont.c
+++ b/pango/pango-hbfont.c
@@ -406,12 +406,18 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
if (ink_rect)
{
+ PangoMatrix matrix = PANGO_MATRIX_INIT;
+
ink_rect->x = extents.x_bearing;
ink_rect->width = extents.width;
ink_rect->y = - extents.y_bearing;
ink_rect->height = - extents.height;
pango_matrix_transform_rectangle (&self->face->matrix, ink_rect);
+
+ /* FIXME: why is this required */
+ pango_matrix_rotate (&matrix, - pango_gravity_to_rotation (PANGO_HB_FONT (font)->gravity) * 180. /
G_PI);
+ pango_matrix_transform_rectangle (&matrix, ink_rect);
}
if (logical_rect)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]