From cf81fff062c8cac850f491ac722d6bb79a8bde14 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 17 Jun 2021 17:52:38 +0200 Subject: config: add underline-offset option This option allows the user to configure a custom underline offset. That is, use the user provided offset instead of the font provided one. Closes #490 --- config.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 0439b2e3..ae7f0be5 100644 --- a/config.c +++ b/config.c @@ -793,6 +793,14 @@ parse_section_main(const char *key, const char *value, struct config *conf, return false; } + else if (strcmp(key, "underline-offset") == 0) { + if (!str_to_pt_or_px( + value, &conf->underline_offset, + conf, path, lineno, "default", "underline-offset")) + return false; + conf->use_custom_underline_offset = true; + } + else if (strcmp(key, "dpi-aware") == 0) { if (strcmp(value, "auto") == 0) conf->dpi_aware = DPI_AWARE_AUTO; @@ -2514,10 +2522,11 @@ config_load(struct config *conf, const char *conf_path, }, .startup_mode = STARTUP_WINDOWED, .fonts = {tll_init(), tll_init(), tll_init(), tll_init()}, - .line_height = { .pt = 0, .px = -1, }, - .letter_spacing = { .pt = 0, .px = 0, }, - .horizontal_letter_offset = {.pt = 0, .px = 0, }, - .vertical_letter_offset = {.pt = 0, .px = 0, }, + .line_height = {.pt = 0, .px = -1}, + .letter_spacing = {.pt = 0, .px = 0}, + .horizontal_letter_offset = {.pt = 0, .px = 0}, + .vertical_letter_offset = {.pt = 0, .px = 0}, + .use_custom_underline_offset = false, .box_drawings_uses_font_glyphs = false, .dpi_aware = DPI_AWARE_AUTO, /* DPI-aware when scaling-factor == 1 */ .bell = { -- cgit v1.3