mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-29 07:58:01 -04:00
config: add tweak.scaling-filter
Use the new fcft_set_scaling_filter() API to use a non-default scaling filter. By default, we use lanczo3, the ‘best’ filter. This overrides the default in fcft, which is ‘cubic’ filtering.
This commit is contained in:
parent
6a9725c7a6
commit
51a7e44fa2
6 changed files with 46 additions and 2 deletions
|
|
@ -91,6 +91,7 @@
|
||||||
* Minimum window size changed from four rows and 20 columns, to 1 row
|
* Minimum window size changed from four rows and 20 columns, to 1 row
|
||||||
and 2 columns.
|
and 2 columns.
|
||||||
* **scrollback-up/down** renamed to **scrollback-up/down-page**.
|
* **scrollback-up/down** renamed to **scrollback-up/down-page**.
|
||||||
|
* fcft >= 2.3.0 is now required.
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
30
config.c
30
config.c
|
|
@ -1442,7 +1442,34 @@ parse_section_tweak(
|
||||||
const char *key, const char *value, struct config *conf,
|
const char *key, const char *value, struct config *conf,
|
||||||
const char *path, unsigned lineno)
|
const char *path, unsigned lineno)
|
||||||
{
|
{
|
||||||
if (strcmp(key, "allow-overflowing-double-width-glyphs") == 0) {
|
if (strcmp(key, "scaling-filter") == 0) {
|
||||||
|
static const struct {
|
||||||
|
const char *name;
|
||||||
|
enum fcft_scaling_filter filter;
|
||||||
|
} filters[] = {
|
||||||
|
{"none", FCFT_SCALING_FILTER_NONE},
|
||||||
|
{"nearest", FCFT_SCALING_FILTER_NEAREST},
|
||||||
|
{"bilinear", FCFT_SCALING_FILTER_BILINEAR},
|
||||||
|
{"cubic", FCFT_SCALING_FILTER_CUBIC},
|
||||||
|
{"lanczos3", FCFT_SCALING_FILTER_LANCZOS3},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0; i < ALEN(filters); i++) {
|
||||||
|
if (strcmp(value, filters[i].name) == 0) {
|
||||||
|
conf->tweak.fcft_filter = filters[i].filter;
|
||||||
|
LOG_WARN("tweak: scaling-filter=%s", filters[i].name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_AND_NOTIFY_ERR(
|
||||||
|
"%s:%d: [tweak]: %s: invalid 'scaling-filter' value, "
|
||||||
|
"expected one of 'none', 'nearest', 'bilinear', 'cubic' or "
|
||||||
|
"'lanczos3'", path, lineno, value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "allow-overflowing-double-width-glyphs") == 0) {
|
||||||
conf->tweak.allow_overflowing_double_width_glyphs = str_to_bool(value);
|
conf->tweak.allow_overflowing_double_width_glyphs = str_to_bool(value);
|
||||||
if (conf->tweak.allow_overflowing_double_width_glyphs)
|
if (conf->tweak.allow_overflowing_double_width_glyphs)
|
||||||
LOG_WARN("tweak: allow overflowing double-width glyphs");
|
LOG_WARN("tweak: allow overflowing double-width glyphs");
|
||||||
|
|
@ -1894,6 +1921,7 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
.hold_at_exit = false,
|
.hold_at_exit = false,
|
||||||
|
|
||||||
.tweak = {
|
.tweak = {
|
||||||
|
.fcft_filter = FCFT_SCALING_FILTER_LANCZOS3,
|
||||||
.allow_overflowing_double_width_glyphs = false,
|
.allow_overflowing_double_width_glyphs = false,
|
||||||
.delayed_render_lower_ns = 500000, /* 0.5ms */
|
.delayed_render_lower_ns = 500000, /* 0.5ms */
|
||||||
.delayed_render_upper_ns = 16666666 / 2, /* half a frame period (60Hz) */
|
.delayed_render_upper_ns = 16666666 / 2, /* half a frame period (60Hz) */
|
||||||
|
|
|
||||||
1
config.h
1
config.h
|
|
@ -160,6 +160,7 @@ struct config {
|
||||||
bool hold_at_exit;
|
bool hold_at_exit;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
enum fcft_scaling_filter fcft_filter;
|
||||||
bool allow_overflowing_double_width_glyphs;
|
bool allow_overflowing_double_width_glyphs;
|
||||||
bool render_timer_osd;
|
bool render_timer_osd;
|
||||||
bool render_timer_log;
|
bool render_timer_log;
|
||||||
|
|
|
||||||
|
|
@ -460,9 +460,21 @@ should not change these unless you understand what they do and note
|
||||||
that changing the default values *will* print a warning when launching
|
that changing the default values *will* print a warning when launching
|
||||||
foot.
|
foot.
|
||||||
|
|
||||||
|
Note that these options may change, or be removed at any time, without
|
||||||
|
prior notice.
|
||||||
|
|
||||||
When reporting bugs, please mention if, and to what, you have changed
|
When reporting bugs, please mention if, and to what, you have changed
|
||||||
any of these options.
|
any of these options.
|
||||||
|
|
||||||
|
*scaling-filter*
|
||||||
|
Overrides the default scaling filter used when down-scaling bitmap
|
||||||
|
fonts (e.g. emoji fonts). Possible values are *none*, *nearest*,
|
||||||
|
*bilinear*, *cubic* or *lanczos3*. *cubic* and *lanczos3* produce
|
||||||
|
the best results, but are slower (with *lanczos3* being the best
|
||||||
|
_and_ slowest).
|
||||||
|
|
||||||
|
Default: _lanczos3_.
|
||||||
|
|
||||||
*allow-overflowing-double-width-glyphs*
|
*allow-overflowing-double-width-glyphs*
|
||||||
Boolean. when enabled, double width glyphs with a character width
|
Boolean. when enabled, double width glyphs with a character width
|
||||||
of 1 are allowed to overflow into the neighbouring cell.
|
of 1 are allowed to overflow into the neighbouring cell.
|
||||||
|
|
|
||||||
2
main.c
2
main.c
|
|
@ -363,6 +363,8 @@ main(int argc, char *const *argv)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fcft_set_scaling_filter(conf.tweak.fcft_filter);
|
||||||
|
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
LOG_INFO("locale: %s", setlocale(LC_CTYPE, NULL));
|
LOG_INFO("locale: %s", setlocale(LC_CTYPE, NULL));
|
||||||
if (!locale_is_utf8()) {
|
if (!locale_is_utf8()) {
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ xkb = dependency('xkbcommon')
|
||||||
fontconfig = dependency('fontconfig')
|
fontconfig = dependency('fontconfig')
|
||||||
|
|
||||||
tllist = dependency('tllist', version: '>=1.0.4', fallback: 'tllist')
|
tllist = dependency('tllist', version: '>=1.0.4', fallback: 'tllist')
|
||||||
fcft = dependency('fcft', version: ['>=2.2.2', '<3.0.0'], fallback: 'fcft')
|
fcft = dependency('fcft', version: ['>=2.3.0', '<3.0.0'], fallback: 'fcft')
|
||||||
|
|
||||||
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue