From 276e0301e0d68cc799a7073d26a7a10c11d036ff Mon Sep 17 00:00:00 2001 From: Ian Huang Date: Sun, 19 Apr 2020 17:56:11 -0700 Subject: interpret "subpixel none" as CAIRO_ANTIALIAS_GRAY See issue #5228. Currently, WL_OUTPUT_SUBPIXEL_NONE is ignored and CAIRO_ANTIALIAS_SUBPIXEL is still set. This commit checks if subpixel is set to none and if so, calls set_antialias with CAIRO_ANTIALIAS_GRAY. This mirrors the functionality in Mako's [PR261](https://github.com/emersion/mako/pull/261) --- swaybar/render.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'swaybar') diff --git a/swaybar/render.c b/swaybar/render.c index ea5faef6..3a626e1c 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -698,8 +698,13 @@ void render_frame(struct swaybar_output *output) { cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST); cairo_font_options_t *fo = cairo_font_options_create(); cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL); - cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL); - cairo_font_options_set_subpixel_order(fo, to_cairo_subpixel_order(output->subpixel)); + if (output->subpixel == WL_OUTPUT_SUBPIXEL_NONE) { + cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_GRAY); + } else { + cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL); + cairo_font_options_set_subpixel_order(fo, + to_cairo_subpixel_order(output->subpixel)); + } cairo_set_font_options(cairo, fo); cairo_font_options_destroy(fo); cairo_save(cairo); -- cgit v1.2.3