mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
font/coretext: calculate advance_x properly
This commit is contained in:
@ -397,6 +397,10 @@ pub const Face = struct {
|
|||||||
break :offset_y @intFromFloat(@ceil(baseline_with_offset));
|
break :offset_y @intFromFloat(@ceil(baseline_with_offset));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Get our advance
|
||||||
|
var advances: [glyphs.len]macos.graphics.Size = undefined;
|
||||||
|
_ = self.font.getAdvancesForGlyphs(.horizontal, &glyphs, &advances);
|
||||||
|
|
||||||
// std.log.warn("renderGlyph rect={} width={} height={} render_x={} render_y={} offset_y={} ascent={} cell_height={} cell_baseline={}", .{
|
// std.log.warn("renderGlyph rect={} width={} height={} render_x={} render_y={} offset_y={} ascent={} cell_height={} cell_baseline={}", .{
|
||||||
// rect,
|
// rect,
|
||||||
// width,
|
// width,
|
||||||
@ -416,10 +420,7 @@ pub const Face = struct {
|
|||||||
.offset_y = offset_y,
|
.offset_y = offset_y,
|
||||||
.atlas_x = region.x,
|
.atlas_x = region.x,
|
||||||
.atlas_y = region.y,
|
.atlas_y = region.y,
|
||||||
|
.advance_x = @floatCast(advances[0].width),
|
||||||
// This is not used, so we don't bother calculating it. If we
|
|
||||||
// ever need it, we can calculate it using getAdvancesForGlyph.
|
|
||||||
.advance_x = 0,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user