[pango/kill-ft-face: 54/59] Use harfbuzz for all font metrics
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/kill-ft-face: 54/59] Use harfbuzz for all font metrics
- Date: Thu, 4 Jul 2019 18:16:55 +0000 (UTC)
commit 0bc9b7240f922be770b043c18bdd39469db3d587
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jul 3 16:00:48 2019 +0000
Use harfbuzz for all font metrics
This fills in the gap left by 092d865269c263b0969.
Note that the harfbuzz api has not landed yet.
pango/pangofc-font.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 12cc4f50..bc351efe 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -47,9 +47,6 @@
#include "pango-impl-utils.h"
#include <harfbuzz/hb-ot.h>
-#include <fontconfig/fcfreetype.h>
-
-#include FT_TRUETYPE_TABLES_H
enum {
PROP_0,
@@ -404,11 +401,27 @@ get_face_metrics (PangoFcFont *fcfont,
metrics->ascent = extents.ascender;
}
+ metrics->underline_thickness = PANGO_SCALE;
+ metrics->underline_position = - PANGO_SCALE;
+ metrics->strikethrough_thickness = PANGO_SCALE;
+ metrics->strikethrough_position = metrics->ascent / 2;
+
+ /* FIXME: use the right hb version */
+#if HB_VERSION_ATLEAST (2,5,2)
+ hb_position_t position;
+
+ if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_UNDERLINE_SIZE, &position))
+ metrics->underline_thickness = position;
+
+ if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_UNDERLINE_OFFSET, &position))
+ metrics->underline_position = position;
+
+ if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_STRIKEOUT_SIZE, &position))
+ metrics->strikethrough_thickness = position;
- metrics->underline_thickness = 0;
- metrics->underline_position = 0;
- metrics->strikethrough_thickness = 0;
- metrics->strikethrough_position = 0;
+ if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_STRIKEOUT_OFFSET, &position))
+ metrics->strikethrough_position = position;
+#endif
}
PangoFontMetrics *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]