[pango/better-space-size: 3/4] fc: Implement get_absolute_size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/better-space-size: 3/4] fc: Implement get_absolute_size
- Date: Tue, 21 Dec 2021 12:53:50 +0000 (UTC)
commit 93cb50d4438d2d60db4c1d0251db556da278e6fd
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 21 07:51:04 2021 -0500
fc: Implement get_absolute_size
No surprises here.
pango/pangofc-font.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 77e99e16..03f15efa 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -77,6 +77,7 @@ static void _pango_fc_font_get_scale_factors (PangoFont *fon
double *y_scale);
static void pango_fc_font_get_matrix (PangoFont *font,
PangoMatrix *matrix);
+static int pango_fc_font_get_absolute_size (PangoFont *font);
#define PANGO_FC_FONT_LOCK_FACE(font) (PANGO_FC_FONT_GET_CLASS (font)->lock_face (font))
#define PANGO_FC_FONT_UNLOCK_FACE(font) (PANGO_FC_FONT_GET_CLASS (font)->unlock_face (font))
@@ -112,6 +113,7 @@ pango_fc_font_class_init (PangoFcFontClass *class)
pclass->is_hinted = _pango_fc_font_is_hinted;
pclass->get_scale_factors = _pango_fc_font_get_scale_factors;
pclass->get_matrix = pango_fc_font_get_matrix;
+ pclass->get_absolute_size = pango_fc_font_get_absolute_size;
/**
* PangoFcFont:pattern:
@@ -300,6 +302,18 @@ pango_fc_font_describe_absolute (PangoFont *font)
return desc;
}
+static int
+pango_fc_font_get_absolute_size (PangoFont *font)
+{
+ PangoFcFont *fcfont = (PangoFcFont *)font;
+ double size;
+
+ if (FcPatternGetDouble (fcfont->font_pattern, FC_PIXEL_SIZE, 0, &size) == FcResultMatch)
+ return (int) (size * PANGO_SCALE);
+
+ return 0;
+}
+
static PangoCoverage *
pango_fc_font_get_coverage (PangoFont *font,
PangoLanguage *language G_GNUC_UNUSED)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]