swaybar, swaylock, & tree/container: Set cairo font options to render text and lines with subpixel hinting (if available).

This commit is contained in:
Geoff Greer 2018-09-20 20:37:08 -07:00
parent 2376a9c5d7
commit 1ba79a159e
2 changed files with 13 additions and 2 deletions

8
main.c
View File

@ -195,11 +195,15 @@ void damage_state(struct swaylock_state *state) {
} }
} }
static void handle_wl_output_geometry(void *data, struct wl_output *output, static void handle_wl_output_geometry(void *data, struct wl_output *wl_output,
int32_t x, int32_t y, int32_t width_mm, int32_t height_mm, int32_t x, int32_t y, int32_t width_mm, int32_t height_mm,
int32_t subpixel, const char *make, const char *model, int32_t subpixel, const char *make, const char *model,
int32_t transform) { int32_t transform) {
// Who cares struct swaylock_surface *surface = data;
surface->subpixel = subpixel;
if (surface->state->run_display) {
damage_surface(surface);
}
} }
static void handle_wl_output_mode(void *data, struct wl_output *output, static void handle_wl_output_mode(void *data, struct wl_output *output,

View File

@ -39,6 +39,13 @@ void render_frame(struct swaylock_surface *surface) {
} }
cairo_t *cairo = surface->current_buffer->cairo; cairo_t *cairo = surface->current_buffer->cairo;
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(surface->subpixel));
cairo_set_font_options(cairo, fo);
cairo_font_options_destroy(fo);
cairo_identity_matrix(cairo); cairo_identity_matrix(cairo);
cairo_save(cairo); cairo_save(cairo);