mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-16 08:21:20 -04:00
config: disable gamma-correct blending by default
When using 8-bit surfaces (like foot does by default), there's enough loss of precision when using a linear color space, that the difference in color is visible, especially for dark colors. Since 10-bit surfaces is too slow (and since 10 bits isn't really enough anyway), and since there are no other high precision surface types in common between Wayland SHM and pixman, we have to choose between: 1. gamma-correct blending, but "wrong colors" 2. gamma-incorrect blending, "correct colors". Since most users do see the difference in colors, few users see the difference in font rendering, and since gamma-incorrect blending is how most applications still render fonts (and is thus considered "normal"), let's change the default to gamma *incorrect* blending. This is just a change of the default value; users can still enable gamma-correct blending with 'gamma-correct-blending=yes'.
This commit is contained in:
parent
4d70bb7b42
commit
16b4862cb3
6 changed files with 21 additions and 29 deletions
|
|
@ -90,6 +90,10 @@
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* `cursor.color` moved to `colors.cursor`.
|
* `cursor.color` moved to `colors.cursor`.
|
||||||
|
* Default value of `gamma-correct-blending` changed to `no`
|
||||||
|
(disabled) ([#2035][2035]).
|
||||||
|
|
||||||
|
[2035]: https://codeberg.org/dnkl/foot/issues/2035
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
||||||
15
config.c
15
config.c
|
|
@ -1086,17 +1086,8 @@ parse_section_main(struct context *ctx)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (streq(key, "gamma-correct-blending")) {
|
else if (streq(key, "gamma-correct-blending"))
|
||||||
bool gamma_correct;
|
return value_to_bool(ctx, &conf->gamma_correct);
|
||||||
if (!value_to_bool(ctx, &gamma_correct))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
conf->gamma_correct =
|
|
||||||
gamma_correct
|
|
||||||
? GAMMA_CORRECT_ENABLED
|
|
||||||
: GAMMA_CORRECT_DISABLED;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (streq(key, "initial-color-theme")) {
|
else if (streq(key, "initial-color-theme")) {
|
||||||
_Static_assert(
|
_Static_assert(
|
||||||
|
|
@ -3362,7 +3353,7 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
.underline_thickness = {.pt = 0., .px = -1},
|
.underline_thickness = {.pt = 0., .px = -1},
|
||||||
.strikeout_thickness = {.pt = 0., .px = -1},
|
.strikeout_thickness = {.pt = 0., .px = -1},
|
||||||
.dpi_aware = false,
|
.dpi_aware = false,
|
||||||
.gamma_correct = GAMMA_CORRECT_AUTO,
|
.gamma_correct = false,
|
||||||
.security = {
|
.security = {
|
||||||
.osc52 = OSC52_ENABLED,
|
.osc52 = OSC52_ENABLED,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
4
config.h
4
config.h
|
|
@ -232,9 +232,7 @@ struct config {
|
||||||
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
||||||
|
|
||||||
bool dpi_aware;
|
bool dpi_aware;
|
||||||
enum {GAMMA_CORRECT_DISABLED,
|
bool gamma_correct;
|
||||||
GAMMA_CORRECT_ENABLED,
|
|
||||||
GAMMA_CORRECT_AUTO} gamma_correct;
|
|
||||||
struct config_font_list fonts[4];
|
struct config_font_list fonts[4];
|
||||||
struct font_size_adjustment font_size_adjustment;
|
struct font_size_adjustment font_size_adjustment;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -215,18 +215,19 @@ empty string to be set, but it must be quoted: *KEY=""*)
|
||||||
*FREETYPE_PROPERTIES="cff:no-stem-darkening=0"* before starting
|
*FREETYPE_PROPERTIES="cff:no-stem-darkening=0"* before starting
|
||||||
foot.
|
foot.
|
||||||
|
|
||||||
Also be aware that many fonts have been developed on systems that
|
Be aware that many fonts have been developed on systems that do
|
||||||
do not do gamma-correct blending, and may therefore look thicker
|
not do gamma-correct blending, and may therefore look thicker than
|
||||||
than intended when rendered with gamma-correct blending, since the
|
intended when rendered with gamma-correct blending, since the font
|
||||||
font designer set the font weight based on incorrect rendering.
|
designer set the font weight based on incorrect rendering.
|
||||||
|
|
||||||
Note that some colors (especially dark ones) will look a bit
|
Note that some colors (especially dark ones) will look a bit
|
||||||
off. The reason for this is loss of color precision, due to foot
|
off. The reason for this is loss of color precision, due to foot
|
||||||
using 8-bit surfaces (i.e. each color channel is 8 bits). The
|
using 8-bit surfaces (i.e. each color channel is 8 bits). The
|
||||||
amount of errors can be reduced by using 10-bit surfaces; see
|
amount of error can be reduced by using 10-bit surfaces; see
|
||||||
*tweak.surface-bit-depth*.
|
*tweak.surface-bit-depth* (do read the documentation before
|
||||||
|
enabling it).
|
||||||
|
|
||||||
Default: enabled when compositor support is available
|
Default: _no_
|
||||||
|
|
||||||
*box-drawings-uses-font-glyphs*
|
*box-drawings-uses-font-glyphs*
|
||||||
Boolean. When disabled, foot generates box/line drawing characters
|
Boolean. When disabled, foot generates box/line drawing characters
|
||||||
|
|
|
||||||
2
render.c
2
render.c
|
|
@ -5251,6 +5251,6 @@ render_xcursor_set(struct seat *seat, struct terminal *term,
|
||||||
bool
|
bool
|
||||||
render_do_linear_blending(const struct terminal *term)
|
render_do_linear_blending(const struct terminal *term)
|
||||||
{
|
{
|
||||||
return term->conf->gamma_correct != GAMMA_CORRECT_DISABLED &&
|
return term->conf->gamma_correct &&
|
||||||
term->wl->color_management.img_description != NULL;
|
term->wl->color_management.img_description != NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
wayland.c
10
wayland.c
|
|
@ -1980,7 +1980,7 @@ wayl_win_init(struct terminal *term, const char *token)
|
||||||
xdg_toplevel_icon_v1_destroy(icon);
|
xdg_toplevel_icon_v1_destroy(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (term->conf->gamma_correct != GAMMA_CORRECT_DISABLED) {
|
if (term->conf->gamma_correct) {
|
||||||
if (wayl->color_management.img_description != NULL) {
|
if (wayl->color_management.img_description != NULL) {
|
||||||
xassert(wayl->color_management.manager != NULL);
|
xassert(wayl->color_management.manager != NULL);
|
||||||
|
|
||||||
|
|
@ -1990,14 +1990,14 @@ wayl_win_init(struct terminal *term, const char *token)
|
||||||
wp_color_management_surface_v1_set_image_description(
|
wp_color_management_surface_v1_set_image_description(
|
||||||
win->surface.color_management, wayl->color_management.img_description,
|
win->surface.color_management, wayl->color_management.img_description,
|
||||||
WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL);
|
WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL);
|
||||||
} else if (term->conf->gamma_correct == GAMMA_CORRECT_ENABLED) {
|
} else {
|
||||||
if (wayl->color_management.manager == NULL) {
|
if (wayl->color_management.manager == NULL) {
|
||||||
LOG_WARN(
|
LOG_WARN(
|
||||||
"gamma-corrected-blending: disabling; "
|
"gamma-correct-blending: disabling; "
|
||||||
"compositor does not implement the color-management protocol");
|
"compositor does not implement the color-management protocol");
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN(
|
LOG_WARN(
|
||||||
"gamma-corrected-blending: disabling; "
|
"gamma-correct-blending: disabling; "
|
||||||
"compositor does not implement all required color-management features");
|
"compositor does not implement all required color-management features");
|
||||||
LOG_WARN("use e.g. 'wayland-info' and verify the compositor implements:");
|
LOG_WARN("use e.g. 'wayland-info' and verify the compositor implements:");
|
||||||
LOG_WARN(" - feature: parametric");
|
LOG_WARN(" - feature: parametric");
|
||||||
|
|
@ -2005,8 +2005,6 @@ wayl_win_init(struct terminal *term, const char *token)
|
||||||
LOG_WARN(" - TF: ext_linear");
|
LOG_WARN(" - TF: ext_linear");
|
||||||
LOG_WARN(" - primaries: sRGB");
|
LOG_WARN(" - primaries: sRGB");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* "auto" - don't warn */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue