labwc/include/common
John Lindgren 4fa51b950c common: render text buffers with opaque background
After a roundabout discussion[1] with wlroots devs, it's become apparent
that subpixel text rendering (a.k.a. "ClearType") does not work properly
when rendering over a transparent background, as labwc currently does.

Basically it comes down to the fact that the color of semi-transparent
pixels (which is adjusted redder or bluer to compensate for RGB subpixel
alignment) depends somewhat on background color. When rendering over
transparency, the text engine doesn't know the intended background color
and can't adjust the pixel colors correctly.

With Pango/Cairo, the end result can range from grayscale rendering (no
subpixel rendering at all) to wrong/oversaturated colors (for example,
bright pink pixels when rendering white text on blue background).

This change solves the issue by first filling the text buffer with an
opaque background color before rendering the text over it. Currently,
this is easy since the background is always a solid color. It may be a
little more complex (but doable) if we implement gradients in future.

Note that GTK 4 (and to some degree, recent versions of Microsoft
Windows) avoid this issue by disabling subpixel rendering altogether. I
would much prefer that labwc NOT do this -- it results in noticeably
blurrier text on non-retina LCD screens, which are still common.

[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3822
2024-03-17 19:09:53 +00:00
..
array.h common/array.h: add wl_array_for_each_reverse macro 2023-11-21 22:31:05 +01:00
border.h Move border-struct to common/border.h for sharing 2023-06-26 06:04:07 +01:00
buf.h src/common/buf.c: enhance the buffer API 2024-03-16 15:45:46 +00:00
dir.h config: support merging multiple config files 2024-01-18 20:20:36 +00:00
fd_util.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
file-helpers.h common/file-helpers.c: share file_exists() to reduce duplication 2023-09-17 19:26:41 +01:00
font.h common: render text buffers with opaque background 2024-03-17 19:09:53 +00:00
grab-file.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
graphic-helpers.h common: render text buffers with opaque background 2024-03-17 19:09:53 +00:00
list.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
macros.h edges, resistance, snap: unified resistance and snapping engine 2024-01-30 15:02:17 -05:00
match.h common: use fnmatch() for pattern matching 2023-10-01 14:17:29 +01:00
mem.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
nodename.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
parse-bool.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
scaled_font_buffer.h common: render text buffers with opaque background 2024-03-17 19:09:53 +00:00
scaled_scene_buffer.h scaled_scene_buffer: make dropping the buffer optional 2023-10-19 21:48:57 +01:00
scene-helpers.h chase: use wlroots tree node getters 2023-12-03 18:24:26 +00:00
spawn.h Fix various typos across the codebase 2024-03-08 13:59:20 +01:00
string-helpers.h session: process environment.d and allow empty variables 2024-03-11 20:01:14 +00:00
surface-helpers.h cursor: process layer subsurfaces in cursor_button_press() 2024-03-09 00:44:19 +01:00