mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-10 11:56:33 +00:00
font/sprite+renderer: never constrain sprite glyphs
This was creating problems with the branch drawing glyphs at some sizes. In the future the whole "foreground modes" thing needs to be reworked, so this is just a stopgap until that gets turned in to something nicer.
This commit is contained in:
@@ -20,3 +20,6 @@ atlas_y: u32,
|
||||
|
||||
/// horizontal position to increase drawing position for strings
|
||||
advance_x: f32,
|
||||
|
||||
/// Whether we drew this glyph ourselves with the sprite font.
|
||||
sprite: bool = false,
|
||||
|
@@ -216,7 +216,7 @@ pub fn renderGlyph(
|
||||
// Write the drawing to the atlas
|
||||
const region = try canvas.writeAtlas(alloc, atlas);
|
||||
|
||||
return font.Glyph{
|
||||
return .{
|
||||
.width = region.width,
|
||||
.height = region.height,
|
||||
.offset_x = @as(i32, @intCast(canvas.clip_left)) - @as(i32, @intCast(padding_x)),
|
||||
@@ -224,6 +224,7 @@ pub fn renderGlyph(
|
||||
.atlas_x = region.x,
|
||||
.atlas_y = region.y,
|
||||
.advance_x = @floatFromInt(width),
|
||||
.sprite = true,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -3039,7 +3039,14 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
||||
return;
|
||||
}
|
||||
|
||||
const mode: shaderpkg.CellText.Mode = switch (fgMode(
|
||||
// We always use fg mode for sprite glyphs, since we know we never
|
||||
// need to constrain them, and we don't have any color sprites.
|
||||
//
|
||||
// Otherwise we defer to `fgMode`.
|
||||
const mode: shaderpkg.CellText.Mode =
|
||||
if (render.glyph.sprite)
|
||||
.fg
|
||||
else switch (fgMode(
|
||||
render.presentation,
|
||||
cell_pin,
|
||||
)) {
|
||||
|
Reference in New Issue
Block a user