summaryrefslogtreecommitdiff
path: root/pango/fonts.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-21 07:49:45 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-12-21 07:49:45 -0500
commitc3866592cdc45877e2fa7e0181d4c83ead059842 (patch)
tree07a9ffe88f4b6aef92ae0173fd5ff543dedbaff0 /pango/fonts.c
parent092061db9d0bb94549e3ad44095fcaed49080c82 (diff)
downloadpango-c3866592cdc45877e2fa7e0181d4c83ead059842.tar.gz
Add a private api to get the font size
Add a private vfunc to get the (absolute) size of a font. This default implementation just pulls it out of the font description, but we can do implement this cheaper without copying the font description.
Diffstat (limited to 'pango/fonts.c')
-rw-r--r--pango/fonts.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/pango/fonts.c b/pango/fonts.c
index 35527e7a..2054dd31 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -1761,6 +1761,19 @@ pango_font_default_get_matrix (PangoFont *font,
*matrix = (PangoMatrix) PANGO_MATRIX_INIT;
}
+static int
+pango_font_default_get_absolute_size (PangoFont *font)
+{
+ PangoFontDescription *desc;
+ int size;
+
+ desc = pango_font_describe_with_absolute_size (font);
+ size = pango_font_description_get_size (desc);
+ pango_font_description_free (desc);
+
+ return size;
+}
+
static void
pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
{
@@ -1777,6 +1790,7 @@ pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
pclass->has_char = pango_font_default_has_char;
pclass->get_face = pango_font_default_get_face;
pclass->get_matrix = pango_font_default_get_matrix;
+ pclass->get_absolute_size = pango_font_default_get_absolute_size;
}
static void