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 /common | |
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 'common')
-rw-r--r-- | common/cairo.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/cairo.c b/common/cairo.c index c267c77c..e8231484 100644 --- a/common/cairo.c +++ b/common/cairo.c | |||
@@ -13,6 +13,22 @@ void cairo_set_source_u32(cairo_t *cairo, uint32_t color) { | |||
13 | (color >> (0*8) & 0xFF) / 255.0); | 13 | (color >> (0*8) & 0xFF) / 255.0); |
14 | } | 14 | } |
15 | 15 | ||
16 | cairo_subpixel_order_t to_cairo_subpixel_order(enum wl_output_subpixel subpixel) { | ||
17 | switch (subpixel) { | ||
18 | case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: | ||
19 | return CAIRO_SUBPIXEL_ORDER_RGB; | ||
20 | case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: | ||
21 | return CAIRO_SUBPIXEL_ORDER_BGR; | ||
22 | case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: | ||
23 | return CAIRO_SUBPIXEL_ORDER_VRGB; | ||
24 | case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: | ||
25 | return CAIRO_SUBPIXEL_ORDER_VBGR; | ||
26 | default: | ||
27 | return CAIRO_SUBPIXEL_ORDER_DEFAULT; | ||
28 | } | ||
29 | return CAIRO_SUBPIXEL_ORDER_DEFAULT; | ||
30 | } | ||
31 | |||
16 | cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image, | 32 | cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image, |
17 | int width, int height) { | 33 | int width, int height) { |
18 | int image_width = cairo_image_surface_get_width(image); | 34 | int image_width = cairo_image_surface_get_width(image); |