From c3866592cdc45877e2fa7e0181d4c83ead059842 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 21 Dec 2021 07:49:45 -0500 Subject: 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. --- pango/fonts.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pango/fonts.c') 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 -- cgit v1.2.1