sway{,bar}: use default font hint style

CAIRO_HINT_STYLE_FULL attempts to maximize contrast at the expense
of fidelity, this makes most fonts that haven't been hand hinted,
which makes up the majority of fonts out there, appear much worse.

In the absence of explicitly set hint style, cairo will default to
CAIRO_HINT_STYLE_SLIGHT, which attempts to improve contrast while
retaining fidelity to the original shapes, which is what we want.
This commit is contained in:
llyyr 2023-02-26 16:12:19 +05:30 committed by Simon Zeni
parent d63497698b
commit b757ef94ef
2 changed files with 0 additions and 3 deletions

View file

@ -508,7 +508,6 @@ static void render_titlebar_text_texture(struct sway_output *output,
cairo_t *c = cairo_create(dummy_surface); cairo_t *c = cairo_create(dummy_surface);
cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST); cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST);
cairo_font_options_t *fo = cairo_font_options_create(); cairo_font_options_t *fo = cairo_font_options_create();
cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL);
if (output->wlr_output->subpixel == WL_OUTPUT_SUBPIXEL_NONE) { if (output->wlr_output->subpixel == WL_OUTPUT_SUBPIXEL_NONE) {
cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_GRAY); cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_GRAY);
} else { } else {

View file

@ -774,14 +774,12 @@ void render_frame(struct swaybar_output *output) {
ctx.cairo = cairo; ctx.cairo = cairo;
cairo_font_options_t *fo = cairo_font_options_create(); 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_GRAY); cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_GRAY);
ctx.textaa_safe = fo; ctx.textaa_safe = fo;
if (output->subpixel == WL_OUTPUT_SUBPIXEL_NONE) { if (output->subpixel == WL_OUTPUT_SUBPIXEL_NONE) {
ctx.textaa_sharp = ctx.textaa_safe; ctx.textaa_sharp = ctx.textaa_safe;
} else { } else {
fo = cairo_font_options_create(); 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_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL);
cairo_font_options_set_subpixel_order(fo, cairo_font_options_set_subpixel_order(fo,
to_cairo_subpixel_order(output->subpixel)); to_cairo_subpixel_order(output->subpixel));