[gtk/small-text-fixes: 18/20] gsk: Explicitly set font options




commit de7e7a8e913ce8fbfb50c7dcccc66bb0328046c5
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 31 23:01:43 2021 -0400

    gsk: Explicitly set font options
    
    Explicitly set font options when rendering glyphs,
    to avoid surprises.

 gsk/ngl/gsknglglyphlibrary.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gsk/ngl/gsknglglyphlibrary.c b/gsk/ngl/gsknglglyphlibrary.c
index 9f269d8643..0fe94e05a5 100644
--- a/gsk/ngl/gsknglglyphlibrary.c
+++ b/gsk/ngl/gsknglglyphlibrary.c
@@ -166,11 +166,19 @@ render_glyph (cairo_surface_t           *surface,
 {
   cairo_t *cr;
   cairo_glyph_t glyph;
+  cairo_font_options_t *options;
 
   g_assert (surface != NULL);
   g_assert (scaled_font != NULL);
 
   cr = cairo_create (surface);
+  options = cairo_font_options_create ();
+  cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_GRAY);
+  cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_SLIGHT);
+  cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
+  cairo_set_font_options (cr, options);
+  cairo_font_options_destroy (options);
+
   cairo_set_scaled_font (cr, scaled_font);
   cairo_set_source_rgba (cr, 1, 1, 1, 1);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]