mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-23 20:26:09 +03:00
renderer: hook up font thickening setting
This commit is contained in:
@ -129,6 +129,7 @@ const GPUCellMode = enum(u8) {
|
||||
/// configuration. This must be exported so that we don't need to
|
||||
/// pass around Config pointers which makes memory management a pain.
|
||||
pub const DerivedConfig = struct {
|
||||
font_thicken: bool,
|
||||
cursor_color: ?terminal.color.RGB,
|
||||
background: terminal.color.RGB,
|
||||
foreground: terminal.color.RGB,
|
||||
@ -142,6 +143,8 @@ pub const DerivedConfig = struct {
|
||||
_ = alloc_gpa;
|
||||
|
||||
return .{
|
||||
.font_thicken = config.@"font-thicken",
|
||||
|
||||
.cursor_color = if (config.@"cursor-color") |col|
|
||||
col.toTerminalRGB()
|
||||
else
|
||||
@ -738,6 +741,14 @@ fn drawCells(
|
||||
|
||||
/// Update the configuration.
|
||||
pub fn changeConfig(self: *Metal, config: *DerivedConfig) !void {
|
||||
// If font thickening settings change, we need to reset our
|
||||
// font texture completely because we need to re-render the glyphs.
|
||||
if (self.config.font_thicken != config.font_thicken) {
|
||||
self.font_group.reset();
|
||||
self.font_group.atlas_greyscale.clear();
|
||||
self.font_group.atlas_color.clear();
|
||||
}
|
||||
|
||||
self.config = config.*;
|
||||
}
|
||||
|
||||
@ -998,6 +1009,7 @@ pub fn updateCell(
|
||||
shaper_cell.glyph_index,
|
||||
.{
|
||||
.max_height = @intFromFloat(@ceil(self.cell_size.height)),
|
||||
.thicken = self.config.font_thicken,
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -226,6 +226,7 @@ const GPUCellMode = enum(u8) {
|
||||
/// configuration. This must be exported so that we don't need to
|
||||
/// pass around Config pointers which makes memory management a pain.
|
||||
pub const DerivedConfig = struct {
|
||||
font_thicken: bool,
|
||||
cursor_color: ?terminal.color.RGB,
|
||||
background: terminal.color.RGB,
|
||||
foreground: terminal.color.RGB,
|
||||
@ -239,6 +240,8 @@ pub const DerivedConfig = struct {
|
||||
_ = alloc_gpa;
|
||||
|
||||
return .{
|
||||
.font_thicken = config.@"font-thicken",
|
||||
|
||||
.cursor_color = if (config.@"cursor-color") |col|
|
||||
col.toTerminalRGB()
|
||||
else
|
||||
@ -1144,7 +1147,10 @@ pub fn updateCell(
|
||||
self.alloc,
|
||||
shaper_run.font_index,
|
||||
shaper_cell.glyph_index,
|
||||
.{ .max_height = @intFromFloat(@ceil(self.cell_size.height)) },
|
||||
.{
|
||||
.max_height = @intFromFloat(@ceil(self.cell_size.height)),
|
||||
.thicken = self.config.font_thicken,
|
||||
},
|
||||
);
|
||||
|
||||
// If we're rendering a color font, we use the color atlas
|
||||
@ -1254,6 +1260,14 @@ fn gridSize(self: *const OpenGL, screen_size: renderer.ScreenSize) renderer.Grid
|
||||
|
||||
/// Update the configuration.
|
||||
pub fn changeConfig(self: *OpenGL, config: *DerivedConfig) !void {
|
||||
// If font thickening settings change, we need to reset our
|
||||
// font texture completely because we need to re-render the glyphs.
|
||||
if (self.config.font_thicken != config.font_thicken) {
|
||||
self.font_group.reset();
|
||||
self.font_group.atlas_greyscale.clear();
|
||||
self.font_group.atlas_color.clear();
|
||||
}
|
||||
|
||||
self.config = config.*;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user