From bcb6ee6db676c6f6c05fbb3ab43aa66c6b7b1433 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Mon, 7 Jul 2025 09:43:33 -0600 Subject: [PATCH] config: add adjust-icon-height option Metric modifier for the `icon_height` metric. --- src/config/Config.zig | 12 ++++++++++++ src/font/SharedGridSet.zig | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/config/Config.zig b/src/config/Config.zig index a53986bc9..8ca8d3154 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -396,6 +396,18 @@ pub const compatibility = std.StaticStringMap( /// Thickness in pixels or percentage adjustment of box drawing characters. /// See the notes about adjustments in `adjust-cell-width`. @"adjust-box-thickness": ?MetricModifier = null, +/// Height in pixels or percentage adjustment of maximum height for nerd font icons. +/// +/// Increasing this value will allow nerd font icons to be larger, but won't +/// necessarily force them to be. Decreasing this value will make nerd font +/// icons smaller. +/// +/// The default value for the icon height is 1.2 times the height of capital +/// letters in your primary font, so something like -16.6% would make icons +/// roughly the same height as capital letters. +/// +/// See the notes about adjustments in `adjust-cell-width`. +@"adjust-icon-height": ?MetricModifier = null, /// The method to use for calculating the cell width of a grapheme cluster. /// The default value is `unicode` which uses the Unicode standard to determine diff --git a/src/font/SharedGridSet.zig b/src/font/SharedGridSet.zig index b77b44f23..14a8babad 100644 --- a/src/font/SharedGridSet.zig +++ b/src/font/SharedGridSet.zig @@ -449,6 +449,7 @@ pub const DerivedConfig = struct { @"adjust-cursor-thickness": ?Metrics.Modifier, @"adjust-cursor-height": ?Metrics.Modifier, @"adjust-box-thickness": ?Metrics.Modifier, + @"adjust-icon-height": ?Metrics.Modifier, @"freetype-load-flags": font.face.FreetypeLoadFlags, /// Initialize a DerivedConfig. The config should be either a @@ -488,6 +489,7 @@ pub const DerivedConfig = struct { .@"adjust-cursor-thickness" = config.@"adjust-cursor-thickness", .@"adjust-cursor-height" = config.@"adjust-cursor-height", .@"adjust-box-thickness" = config.@"adjust-box-thickness", + .@"adjust-icon-height" = config.@"adjust-icon-height", .@"freetype-load-flags" = if (font.face.FreetypeLoadFlags != void) config.@"freetype-load-flags" else {}, // This must be last so the arena contains all our allocations @@ -634,6 +636,7 @@ pub const Key = struct { if (config.@"adjust-cursor-thickness") |m| try set.put(alloc, .cursor_thickness, m); if (config.@"adjust-cursor-height") |m| try set.put(alloc, .cursor_height, m); if (config.@"adjust-box-thickness") |m| try set.put(alloc, .box_thickness, m); + if (config.@"adjust-icon-height") |m| try set.put(alloc, .icon_height, m); break :set set; };