fonts: size fonts using the scaling factor when output scaling is enabled

This extends the new ‘dpi-aware’ option with a new default value,
‘auto’.

When set to ‘auto’, fonts are sized using monitors’ DPI when output
scaling is disabled. When output scaling is enabled, fonts are instead
sized using the scaling factor.

The reasoning here is that a user that has enabled output scaling is
obviously *not* relying on DPI scaling.

Output scaling can also be a way to compensate for different viewing
distances, in which case we do *not* want to break that by using DPI
scaling.

Users can still force DPI-only font sizing by setting ‘dpi-aware=yes’,
or disable it completely by setting ‘dpi-aware=no’.
This commit is contained in:
Daniel Eklöf 2020-12-17 12:05:22 +01:00
parent 69cd5fd3ab
commit 0a821f2ed4
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 78 additions and 35 deletions

View file

@ -548,8 +548,12 @@ parse_section_main(const char *key, const char *value, struct config *conf,
free(copy);
}
else if (strcmp(key, "dpi-aware") == 0)
conf->dpi_aware = str_to_bool(value);
else if (strcmp(key, "dpi-aware") == 0) {
if (strcmp(value, "auto") == 0)
conf->dpi_aware = DPI_AWARE_AUTO;
else
conf->dpi_aware = str_to_bool(value) ? DPI_AWARE_YES : DPI_AWARE_NO;
}
else if (strcmp(key, "workers") == 0) {
unsigned long count;
@ -1959,7 +1963,7 @@ config_load(struct config *conf, const char *conf_path,
.bell_action = BELL_ACTION_NONE,
.startup_mode = STARTUP_WINDOWED,
.fonts = {tll_init(), tll_init(), tll_init(), tll_init()},
.dpi_aware = true, /* Use DPI by default, not scale factor */
.dpi_aware = DPI_AWARE_AUTO, /* DPI-aware when scaling-factor == 1 */
.scrollback = {
.lines = 1000,
.indicator = {