aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-07 10:16:02 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-11 08:31:05 +0000
commitf9c9dd24329fe4a2f6d350e693b1d7a7bae33b83 (patch)
tree8b577eb5399400eed96fca0923fd3389059ad761
parentMerge branch 'fish-completions' (diff)
config: add line-height, letter-spacing, {horizontal,vertical}-letter-offset
-rw-r--r--config.c48
-rw-r--r--config.h8
2 files changed, 56 insertions, 0 deletions
diff --git a/config.c b/config.c
index 0e106584..6af8803b 100644
--- a/config.c
+++ b/config.c
@@ -555,6 +555,50 @@ parse_section_main(const char *key, const char *value, struct config *conf,
free(copy);
}
+ else if (strcmp(key, "line-height") == 0) {
+ unsigned long height;
+ if (!str_to_ulong(value, 10, &height)) {
+ LOG_AND_NOTIFY_ERR(
+ "%s:%d: [default]: line-height: expected an integer, got '%s'",
+ path, lineno, value);
+ return false;
+ }
+ conf->line_height = height;
+ }
+
+ else if (strcmp(key, "letter-spacing") == 0) {
+ unsigned long spacing;
+ if (!str_to_ulong(value, 10, &spacing)) {
+ LOG_AND_NOTIFY_ERR(
+ "%s:%d: [default]: letter-spacing: expected an integer, got '%s'",
+ path, lineno, value);
+ return false;
+ }
+ conf->letter_spacing = spacing;
+ }
+
+ else if (strcmp(key, "horizontal-letter-offset") == 0) {
+ unsigned long offset;
+ if (!str_to_ulong(value, 10, &offset)) {
+ LOG_AND_NOTIFY_ERR(
+ "%s:%d: [default]: horizontal-letter-offset: "
+ "expected an integer, got '%s'", path, lineno, value);
+ return false;
+ }
+ conf->horizontal_letter_offset = offset;
+ }
+
+ else if (strcmp(key, "vertical-letter-offset") == 0) {
+ unsigned long offset;
+ if (!str_to_ulong(value, 10, &offset)) {
+ LOG_AND_NOTIFY_ERR(
+ "%s:%d: [default]: horizontal-letter-offset: "
+ "expected an integer, got '%s'", path, lineno, value);
+ return false;
+ }
+ conf->vertical_letter_offset = offset;
+ }
+
else if (strcmp(key, "dpi-aware") == 0) {
if (strcmp(value, "auto") == 0)
conf->dpi_aware = DPI_AWARE_AUTO;
@@ -1979,6 +2023,10 @@ 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()},
+ .line_height = -1,
+ .letter_spacing = -1,
+ .horizontal_letter_offset = 0,
+ .vertical_letter_offset = 0,
.dpi_aware = DPI_AWARE_AUTO, /* DPI-aware when scaling-factor == 1 */
.scrollback = {
.lines = 1000,
diff --git a/config.h b/config.h
index 21b79230..9b33b37f 100644
--- a/config.h
+++ b/config.h
@@ -84,6 +84,14 @@ struct config {
enum {DPI_AWARE_AUTO, DPI_AWARE_YES, DPI_AWARE_NO} dpi_aware;
config_font_list_t fonts[4];
+ /* Custom font metrics (-1 = use real font metrics) */
+ int16_t line_height;
+ int16_t letter_spacing;
+
+ /* Adjusted letter x/y offsets */
+ int16_t horizontal_letter_offset;
+ int16_t vertical_letter_offset;
+
struct {
int lines;