mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
renderer/metal: font grid change should run all screen size logic
This commit is contained in:
@ -835,16 +835,6 @@ pub fn setFontGrid(self: *Metal, grid: *font.SharedGrid) void {
|
|||||||
const metrics = grid.metrics;
|
const metrics = grid.metrics;
|
||||||
self.grid_metrics = metrics;
|
self.grid_metrics = metrics;
|
||||||
|
|
||||||
// Reset our cell contents.
|
|
||||||
const grid_size = self.gridSize().?;
|
|
||||||
self.cells.resize(self.alloc, grid_size) catch |err| {
|
|
||||||
// The setFontGrid function can't fail but resizing our cell
|
|
||||||
// buffer definitely can fail. If it does, our renderer is probably
|
|
||||||
// screwed but let's just log it and continue until we can figure
|
|
||||||
// out a better way to handle this.
|
|
||||||
log.err("error resizing cells buffer err={}", .{err});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Reset our shaper cache. If our font changed (not just the size) then
|
// Reset our shaper cache. If our font changed (not just the size) then
|
||||||
// the data in the shaper cache may be invalid and cannot be used, so we
|
// the data in the shaper cache may be invalid and cannot be used, so we
|
||||||
// always clear the cache just in case.
|
// always clear the cache just in case.
|
||||||
@ -852,25 +842,21 @@ pub fn setFontGrid(self: *Metal, grid: *font.SharedGrid) void {
|
|||||||
self.font_shaper_cache.deinit(self.alloc);
|
self.font_shaper_cache.deinit(self.alloc);
|
||||||
self.font_shaper_cache = font_shaper_cache;
|
self.font_shaper_cache = font_shaper_cache;
|
||||||
|
|
||||||
// Reset our viewport to force a rebuild
|
// Run a screen size update since this handles a lot of our uniforms
|
||||||
self.cells_viewport = null;
|
// that are grid size dependent and changing the font grid can change
|
||||||
|
// the grid size.
|
||||||
// Update our uniforms
|
//
|
||||||
self.uniforms = .{
|
// If the screen size isn't set, it will be eventually so that'll call
|
||||||
.projection_matrix = self.uniforms.projection_matrix,
|
// the setScreenSize automatically.
|
||||||
.cell_size = .{
|
if (self.screen_size) |size| {
|
||||||
@floatFromInt(metrics.cell_width),
|
self.setScreenSize(size, self.padding.explicit) catch |err| {
|
||||||
@floatFromInt(metrics.cell_height),
|
// The setFontGrid function can't fail but resizing our cell
|
||||||
},
|
// buffer definitely can fail. If it does, our renderer is probably
|
||||||
.grid_size = .{
|
// screwed but let's just log it and continue until we can figure
|
||||||
grid_size.columns,
|
// out a better way to handle this.
|
||||||
grid_size.rows,
|
log.err("error resizing cells buffer err={}", .{err});
|
||||||
},
|
};
|
||||||
.grid_padding = self.uniforms.grid_padding,
|
}
|
||||||
.min_contrast = self.uniforms.min_contrast,
|
|
||||||
.cursor_pos = self.uniforms.cursor_pos,
|
|
||||||
.cursor_color = self.uniforms.cursor_color,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the frame data.
|
/// Update the frame data.
|
||||||
|
Reference in New Issue
Block a user