mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
font: adjust cell baseline to center after modification, fix styles
Fixes #1064 Fixes #1066
This commit is contained in:
@ -32,10 +32,21 @@ pub fn apply(self: *Metrics, mods: ModifierSet) void {
|
|||||||
.cell_height,
|
.cell_height,
|
||||||
=> |tag| {
|
=> |tag| {
|
||||||
const original = @field(self, @tagName(tag));
|
const original = @field(self, @tagName(tag));
|
||||||
@field(self, @tagName(tag)) = @max(
|
const new = @max(entry.value_ptr.apply(original), 1);
|
||||||
entry.value_ptr.apply(original),
|
@field(self, @tagName(tag)) = new;
|
||||||
1,
|
|
||||||
);
|
// For cell height, we have to also modify some positions
|
||||||
|
// that are absolute from the top of the cell. The main goal
|
||||||
|
// here is to center the baseline so that text is vertically
|
||||||
|
// centered in the cell.
|
||||||
|
if (comptime tag == .cell_height) {
|
||||||
|
// We split the difference in half because we want to
|
||||||
|
// center the baseline in the cell.
|
||||||
|
const diff = (new - original) / 2;
|
||||||
|
self.cell_baseline += diff;
|
||||||
|
self.underline_position += diff;
|
||||||
|
self.strikethrough_position += diff;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
inline else => |tag| {
|
inline else => |tag| {
|
||||||
|
Reference in New Issue
Block a user