diff options
author | Geoff Greer <geoff@greer.fm> | 2018-09-20 20:37:08 -0700 |
---|---|---|
committer | Geoff Greer <geoff@greer.fm> | 2018-09-22 11:34:21 -0700 |
commit | c495164f6059d8f352afeead86a510365cc802a1 (patch) | |
tree | ee7316a573d5feb5332bb5cef509bd37faf5bcf7 /swaybar | |
parent | Merge pull request #2660 from RyanDwyer/fix-scratchpad-iteration (diff) | |
download | sway-c495164f6059d8f352afeead86a510365cc802a1.tar.gz sway-c495164f6059d8f352afeead86a510365cc802a1.tar.zst sway-c495164f6059d8f352afeead86a510365cc802a1.zip |
swaybar, swaylock, & tree/container: Set cairo font options to render text and lines with subpixel hinting (if available).
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/bar.c | 8 | ||||
-rw-r--r-- | swaybar/render.c | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index 69069f40..ab307fd4 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -319,10 +319,14 @@ static bool bar_uses_output(struct swaybar *bar, const char *name) { | |||
319 | return false; | 319 | return false; |
320 | } | 320 | } |
321 | 321 | ||
322 | static void output_geometry(void *data, struct wl_output *output, int32_t x, | 322 | static void output_geometry(void *data, struct wl_output *wl_output, int32_t x, |
323 | int32_t y, int32_t width_mm, int32_t height_mm, int32_t subpixel, | 323 | int32_t y, int32_t width_mm, int32_t height_mm, int32_t subpixel, |
324 | const char *make, const char *model, int32_t transform) { | 324 | const char *make, const char *model, int32_t transform) { |
325 | // Who cares | 325 | struct swaybar_output *output = data; |
326 | output->subpixel = subpixel; | ||
327 | if (output->surface) { | ||
328 | render_frame(output->bar, output); | ||
329 | } | ||
326 | } | 330 | } |
327 | 331 | ||
328 | static void output_mode(void *data, struct wl_output *output, uint32_t flags, | 332 | static void output_mode(void *data, struct wl_output *output, uint32_t flags, |
diff --git a/swaybar/render.c b/swaybar/render.c index 26db80cb..9413dc57 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -495,6 +495,13 @@ void render_frame(struct swaybar *bar, struct swaybar_output *output) { | |||
495 | cairo_surface_t *recorder = cairo_recording_surface_create( | 495 | cairo_surface_t *recorder = cairo_recording_surface_create( |
496 | CAIRO_CONTENT_COLOR_ALPHA, NULL); | 496 | CAIRO_CONTENT_COLOR_ALPHA, NULL); |
497 | cairo_t *cairo = cairo_create(recorder); | 497 | cairo_t *cairo = cairo_create(recorder); |
498 | cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST); | ||
499 | cairo_font_options_t *fo = cairo_font_options_create(); | ||
500 | cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL); | ||
501 | cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL); | ||
502 | cairo_font_options_set_subpixel_order(fo, to_cairo_subpixel_order(output->subpixel)); | ||
503 | cairo_set_font_options(cairo, fo); | ||
504 | cairo_font_options_destroy(fo); | ||
498 | cairo_save(cairo); | 505 | cairo_save(cairo); |
499 | cairo_set_operator(cairo, CAIRO_OPERATOR_CLEAR); | 506 | cairo_set_operator(cairo, CAIRO_OPERATOR_CLEAR); |
500 | cairo_paint(cairo); | 507 | cairo_paint(cairo); |