Add new font adjust configs (#2962)

Add keys for adjusting overline position/thickness and box drawing
thickness, + docs to each adjust key clarifying what the metric they
adjust does.
This commit is contained in:
Mitchell Hashimoto
2024-12-15 14:09:30 -08:00
committed by GitHub
3 changed files with 26 additions and 1 deletions

View File

@ -9,7 +9,7 @@ pub const zsh_completions = comptimeGenerateZshCompletions();
fn comptimeGenerateZshCompletions() []const u8 { fn comptimeGenerateZshCompletions() []const u8 {
comptime { comptime {
@setEvalBranchQuota(19000); @setEvalBranchQuota(50000);
var counter = std.io.countingWriter(std.io.null_writer); var counter = std.io.countingWriter(std.io.null_writer);
try writeZshCompletions(&counter.writer()); try writeZshCompletions(&counter.writer());

View File

@ -255,12 +255,28 @@ const c = @cImport({
/// that things like status lines continue to look aligned. /// that things like status lines continue to look aligned.
@"adjust-cell-width": ?MetricModifier = null, @"adjust-cell-width": ?MetricModifier = null,
@"adjust-cell-height": ?MetricModifier = null, @"adjust-cell-height": ?MetricModifier = null,
/// Distance in pixels from the bottom of the cell to the text baseline.
/// Increase to move baseline UP, decrease to move baseline DOWN.
@"adjust-font-baseline": ?MetricModifier = null, @"adjust-font-baseline": ?MetricModifier = null,
/// Distance in pixels from the top of the cell to the top of the underline.
/// Increase to move underline DOWN, decrease to move underline UP.
@"adjust-underline-position": ?MetricModifier = null, @"adjust-underline-position": ?MetricModifier = null,
/// Thickness in pixels of the underline.
@"adjust-underline-thickness": ?MetricModifier = null, @"adjust-underline-thickness": ?MetricModifier = null,
/// Distance in pixels from the top of the cell to the top of the strikethrough.
/// Increase to move strikethrough DOWN, decrease to move underline UP.
@"adjust-strikethrough-position": ?MetricModifier = null, @"adjust-strikethrough-position": ?MetricModifier = null,
/// Thickness in pixels of the strikethrough.
@"adjust-strikethrough-thickness": ?MetricModifier = null, @"adjust-strikethrough-thickness": ?MetricModifier = null,
/// Distance in pixels from the top of the cell to the top of the overline.
/// Increase to move overline DOWN, decrease to move underline UP.
@"adjust-overline-position": ?MetricModifier = null,
/// Thickness in pixels of the overline.
@"adjust-overline-thickness": ?MetricModifier = null,
/// Thickness in pixels of the bar cursor and outlined rect cursor.
@"adjust-cursor-thickness": ?MetricModifier = null, @"adjust-cursor-thickness": ?MetricModifier = null,
/// Thickness in pixels of box drawing characters.
@"adjust-box-thickness": ?MetricModifier = null,
/// The method to use for calculating the cell width of a grapheme cluster. /// 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 /// The default value is `unicode` which uses the Unicode standard to determine

View File

@ -427,7 +427,10 @@ pub const DerivedConfig = struct {
@"adjust-underline-thickness": ?Metrics.Modifier, @"adjust-underline-thickness": ?Metrics.Modifier,
@"adjust-strikethrough-position": ?Metrics.Modifier, @"adjust-strikethrough-position": ?Metrics.Modifier,
@"adjust-strikethrough-thickness": ?Metrics.Modifier, @"adjust-strikethrough-thickness": ?Metrics.Modifier,
@"adjust-overline-position": ?Metrics.Modifier,
@"adjust-overline-thickness": ?Metrics.Modifier,
@"adjust-cursor-thickness": ?Metrics.Modifier, @"adjust-cursor-thickness": ?Metrics.Modifier,
@"adjust-box-thickness": ?Metrics.Modifier,
@"freetype-load-flags": font.face.FreetypeLoadFlags, @"freetype-load-flags": font.face.FreetypeLoadFlags,
/// Initialize a DerivedConfig. The config should be either a /// Initialize a DerivedConfig. The config should be either a
@ -462,7 +465,10 @@ pub const DerivedConfig = struct {
.@"adjust-underline-thickness" = config.@"adjust-underline-thickness", .@"adjust-underline-thickness" = config.@"adjust-underline-thickness",
.@"adjust-strikethrough-position" = config.@"adjust-strikethrough-position", .@"adjust-strikethrough-position" = config.@"adjust-strikethrough-position",
.@"adjust-strikethrough-thickness" = config.@"adjust-strikethrough-thickness", .@"adjust-strikethrough-thickness" = config.@"adjust-strikethrough-thickness",
.@"adjust-overline-position" = config.@"adjust-overline-position",
.@"adjust-overline-thickness" = config.@"adjust-overline-thickness",
.@"adjust-cursor-thickness" = config.@"adjust-cursor-thickness", .@"adjust-cursor-thickness" = config.@"adjust-cursor-thickness",
.@"adjust-box-thickness" = config.@"adjust-box-thickness",
.@"freetype-load-flags" = if (font.face.FreetypeLoadFlags != void) config.@"freetype-load-flags" else {}, .@"freetype-load-flags" = if (font.face.FreetypeLoadFlags != void) config.@"freetype-load-flags" else {},
// This must be last so the arena contains all our allocations // This must be last so the arena contains all our allocations
@ -604,7 +610,10 @@ pub const Key = struct {
if (config.@"adjust-underline-thickness") |m| try set.put(alloc, .underline_thickness, m); if (config.@"adjust-underline-thickness") |m| try set.put(alloc, .underline_thickness, m);
if (config.@"adjust-strikethrough-position") |m| try set.put(alloc, .strikethrough_position, m); if (config.@"adjust-strikethrough-position") |m| try set.put(alloc, .strikethrough_position, m);
if (config.@"adjust-strikethrough-thickness") |m| try set.put(alloc, .strikethrough_thickness, m); if (config.@"adjust-strikethrough-thickness") |m| try set.put(alloc, .strikethrough_thickness, m);
if (config.@"adjust-overline-position") |m| try set.put(alloc, .overline_position, m);
if (config.@"adjust-overline-thickness") |m| try set.put(alloc, .overline_thickness, m);
if (config.@"adjust-cursor-thickness") |m| try set.put(alloc, .cursor_thickness, m); if (config.@"adjust-cursor-thickness") |m| try set.put(alloc, .cursor_thickness, m);
if (config.@"adjust-box-thickness") |m| try set.put(alloc, .box_thickness, m);
break :set set; break :set set;
}; };