gsk: Tweak gsk_get_hinted_font slightly

Make it possible to preserve some of the fonts original options.
This commit is contained in:
Matthias Clasen 2024-03-02 20:19:11 -05:00
parent 7c207c4868
commit ddedb39329

View File

@ -98,8 +98,10 @@ gsk_get_scaled_font (PangoFont *font,
/*< private >
* gsk_get_hinted_font:
* @font: a `PangoFont`
* @hint_style: hint style to use
* @antialias: antialiasing to use
* @hint_style: hint style to use or `CAIRO_HINT_STYLE_DEFAULT` to keep the
* hint style of @font unchanged
* @antialias: antialiasing to use, or `CAIRO_ANTIALIAS_DEFAULT` to keep the
* antialias option of @font unchanged
*
* Returns a font that is just like @font, but uses the
* given hinting options for its glyphs and metrics.
@ -120,6 +122,12 @@ gsk_get_hinted_font (PangoFont *font,
sf = pango_cairo_font_get_scaled_font (PANGO_CAIRO_FONT (font));
cairo_scaled_font_get_font_options (sf, options);
if (hint_style == CAIRO_HINT_STYLE_DEFAULT)
hint_style = cairo_font_options_get_hint_style (options);
if (antialias == CAIRO_ANTIALIAS_DEFAULT)
antialias = cairo_font_options_get_antialias (options);
if (cairo_font_options_get_hint_style (options) == hint_style &&
cairo_font_options_get_antialias (options) == antialias &&
cairo_font_options_get_hint_metrics (options) == CAIRO_HINT_METRICS_OFF &&