mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
renderer: double line widths for sprite fonts when font-thicken is true
Fixes #193
This commit is contained in:
@ -226,7 +226,7 @@ pub fn init(alloc: Allocator, options: renderer.Options) !Metal {
|
|||||||
options.font_group.group.sprite = font.sprite.Face{
|
options.font_group.group.sprite = font.sprite.Face{
|
||||||
.width = metrics.cell_width,
|
.width = metrics.cell_width,
|
||||||
.height = metrics.cell_height,
|
.height = metrics.cell_height,
|
||||||
.thickness = 2,
|
.thickness = 2 * @as(u32, if (options.config.font_thicken) 2 else 1),
|
||||||
.underline_position = metrics.underline_position,
|
.underline_position = metrics.underline_position,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ pub fn setFontSize(self: *Metal, size: font.face.DesiredSize) !void {
|
|||||||
self.font_group.group.sprite = font.sprite.Face{
|
self.font_group.group.sprite = font.sprite.Face{
|
||||||
.width = self.cell_size.width,
|
.width = self.cell_size.width,
|
||||||
.height = self.cell_size.height,
|
.height = self.cell_size.height,
|
||||||
.thickness = 2,
|
.thickness = 2 * @as(u32, if (self.config.font_thicken) 2 else 1),
|
||||||
.underline_position = metrics.underline_position,
|
.underline_position = metrics.underline_position,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -302,7 +302,11 @@ pub fn init(alloc: Allocator, options: renderer.Options) !OpenGL {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Setup our font metrics uniform
|
// Setup our font metrics uniform
|
||||||
const metrics = try resetFontMetrics(alloc, options.font_group);
|
const metrics = try resetFontMetrics(
|
||||||
|
alloc,
|
||||||
|
options.font_group,
|
||||||
|
options.config.font_thicken,
|
||||||
|
);
|
||||||
|
|
||||||
// Set our cell dimensions
|
// Set our cell dimensions
|
||||||
const pbind = try program.use();
|
const pbind = try program.use();
|
||||||
@ -639,7 +643,11 @@ pub fn setFontSize(self: *OpenGL, size: font.face.DesiredSize) !void {
|
|||||||
self.resetCellsLRU();
|
self.resetCellsLRU();
|
||||||
|
|
||||||
// Reset our GPU uniforms
|
// Reset our GPU uniforms
|
||||||
const metrics = try resetFontMetrics(self.alloc, self.font_group);
|
const metrics = try resetFontMetrics(
|
||||||
|
self.alloc,
|
||||||
|
self.font_group,
|
||||||
|
self.config.font_thicken,
|
||||||
|
);
|
||||||
|
|
||||||
// Defer our GPU updates
|
// Defer our GPU updates
|
||||||
self.deferred_font_size = .{ .metrics = metrics };
|
self.deferred_font_size = .{ .metrics = metrics };
|
||||||
@ -670,6 +678,7 @@ pub fn setFontSize(self: *OpenGL, size: font.face.DesiredSize) !void {
|
|||||||
fn resetFontMetrics(
|
fn resetFontMetrics(
|
||||||
alloc: Allocator,
|
alloc: Allocator,
|
||||||
font_group: *font.GroupCache,
|
font_group: *font.GroupCache,
|
||||||
|
font_thicken: bool,
|
||||||
) !font.face.Metrics {
|
) !font.face.Metrics {
|
||||||
// Get our cell metrics based on a regular font ascii 'M'. Why 'M'?
|
// Get our cell metrics based on a regular font ascii 'M'. Why 'M'?
|
||||||
// Doesn't matter, any normal ASCII will do we're just trying to make
|
// Doesn't matter, any normal ASCII will do we're just trying to make
|
||||||
@ -685,7 +694,7 @@ fn resetFontMetrics(
|
|||||||
font_group.group.sprite = font.sprite.Face{
|
font_group.group.sprite = font.sprite.Face{
|
||||||
.width = metrics.cell_width,
|
.width = metrics.cell_width,
|
||||||
.height = metrics.cell_height,
|
.height = metrics.cell_height,
|
||||||
.thickness = 2,
|
.thickness = 2 * @as(u32, if (font_thicken) 2 else 1),
|
||||||
.underline_position = metrics.underline_position,
|
.underline_position = metrics.underline_position,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user