gsk: Add a private helper

Add a function to get the hint style of a font.
This commit is contained in:
Matthias Clasen 2024-03-02 21:14:42 -05:00
parent d1b52cc292
commit 81c97f0910
2 changed files with 26 additions and 0 deletions

View File

@ -158,3 +158,27 @@ gsk_get_hinted_font (PangoFont *font,
return font;
#endif
}
/*< private >
* gsk_font_get_hint_style:
* @font: a `PangoFont`
*
* Get the hint style from the cairo font options.
*
* Returns: the hint style
*/
cairo_hint_style_t
gsk_font_get_hint_style (PangoFont *font)
{
cairo_scaled_font_t *sf;
cairo_font_options_t *options;
cairo_hint_style_t style;
sf = pango_cairo_font_get_scaled_font (PANGO_CAIRO_FONT (font));
options = cairo_font_options_create ();
cairo_scaled_font_get_font_options (sf, options);
style = cairo_font_options_get_hint_style (options);
cairo_font_options_destroy (options);
return style;
}

View File

@ -15,5 +15,7 @@ PangoFont *gsk_get_hinted_font (PangoFont *font,
cairo_hint_style_t hint_style,
cairo_antialias_t antialias);
cairo_hint_style_t gsk_font_get_hint_style (PangoFont *font);
G_END_DECLS