From 3d8f685443e6f0ddac7f3e7402169cf82ea79d88 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 24 Aug 2019 14:50:26 +0200 Subject: cairo: Adjust hinting to subpixel positioning If we are not rounding glyph positions, assume we are doing subpixel positioning, and reduce the hint style to slight hinting and turn metrics hinting off. --- pango/pangocairo-context.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c index 5949c448..e8b8cc5d 100644 --- a/pango/pangocairo-context.c +++ b/pango/pangocairo-context.c @@ -321,6 +321,22 @@ _pango_cairo_context_get_merged_font_options (PangoContext *context) cairo_font_options_merge (info->merged_options, info->surface_options); if (info->set_options) cairo_font_options_merge (info->merged_options, info->set_options); + + if (!pango_context_get_round_glyph_positions (context)) + { + switch (cairo_font_options_get_hint_style (info->merged_options)) + { + case CAIRO_HINT_STYLE_DEFAULT: + case CAIRO_HINT_STYLE_NONE: + case CAIRO_HINT_STYLE_SLIGHT: + break; + case CAIRO_HINT_STYLE_MEDIUM: + case CAIRO_HINT_STYLE_FULL: + cairo_font_options_set_hint_style (info->merged_options, CAIRO_HINT_STYLE_SLIGHT); + break; + } + cairo_font_options_set_hint_metrics (info->merged_options, CAIRO_HINT_METRICS_OFF); + } } return info->merged_options; -- cgit v1.2.1