config: add adjust keys for new font metrics

This commit is contained in:
Qwerasd
2024-12-13 15:36:13 -05:00
parent a73cb2b258
commit d48c6fc885
2 changed files with 25 additions and 0 deletions

View File

@ -255,12 +255,28 @@ const c = @cImport({
/// that things like status lines continue to look aligned.
@"adjust-cell-width": ?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,
/// 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,
/// Thickness in pixels of the underline.
@"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,
/// Thickness in pixels of the strikethrough.
@"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,
/// 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 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-strikethrough-position": ?Metrics.Modifier,
@"adjust-strikethrough-thickness": ?Metrics.Modifier,
@"adjust-overline-position": ?Metrics.Modifier,
@"adjust-overline-thickness": ?Metrics.Modifier,
@"adjust-cursor-thickness": ?Metrics.Modifier,
@"adjust-box-thickness": ?Metrics.Modifier,
@"freetype-load-flags": font.face.FreetypeLoadFlags,
/// 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-strikethrough-position" = config.@"adjust-strikethrough-position",
.@"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-box-thickness" = config.@"adjust-box-thickness",
.@"freetype-load-flags" = if (font.face.FreetypeLoadFlags != void) config.@"freetype-load-flags" else {},
// 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-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-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-box-thickness") |m| try set.put(alloc, .box_thickness, m);
break :set set;
};