[pango/font-metrics-trouble-in-northwest] wip: Fix up font metrics in improver gravities
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/font-metrics-trouble-in-northwest] wip: Fix up font metrics in improver gravities
- Date: Sat, 20 Nov 2021 03:22:43 +0000 (UTC)
commit ca217a382d895b68d4c656214665b79a6dd86618
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Nov 19 22:15:06 2021 -0500
wip: Fix up font metrics in improver gravities
In these gravities, we give the font a negative scale
to get negative advance widths, but this also makes
font metrics come out negative, and some of our code
in pango-layout.c can't deal with that. So flip the
metrics back.
pango/pangofc-font.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 74503b91..1e003cf3 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -322,6 +322,8 @@ pango_fc_font_get_coverage (PangoFont *font,
return coverage;
}
+static PangoGravity pango_fc_font_key_get_gravity (PangoFcFontKey *key);
+
/* For Xft, it would be slightly more efficient to simply to
* call Xft, and also more robust against changes in Xft.
* But for now, we simply use the same code for all backends.
@@ -336,6 +338,8 @@ get_face_metrics (PangoFcFont *fcfont,
hb_font_t *hb_font = pango_font_get_hb_font (PANGO_FONT (fcfont));
hb_font_extents_t extents;
hb_position_t position;
+ PangoFcFontKey *key = _pango_fc_font_get_font_key (fcfont);
+ PangoGravity gravity;
FcMatrix *fc_matrix;
gboolean have_transform = FALSE;
@@ -362,6 +366,14 @@ get_face_metrics (PangoFcFont *fcfont,
metrics->height = extents.ascender - extents.descender + extents.line_gap;
}
+ gravity = pango_fc_font_key_get_gravity (key);
+ if (PANGO_GRAVITY_IS_IMPROPER (gravity))
+ {
+ metrics->descent = - metrics->descent;
+ metrics->ascent = - metrics->ascent;
+ metrics->height = - metrics->height;
+ }
+
metrics->underline_thickness = PANGO_SCALE;
metrics->underline_position = - PANGO_SCALE;
metrics->strikethrough_thickness = PANGO_SCALE;
@@ -978,6 +990,7 @@ pango_fc_font_create_hb_font (PangoFont *font)
x_scale_inv = -x_scale_inv;
y_scale_inv = -y_scale_inv;
}
+
get_font_size (key, &pixel_size, &point_size);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]