mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
renderer/OpenGL: use better logic for whether to render glyph
Metal already had this change made, so I copied it over from there. This logic is more straightforward. Also copied the check to skip 0-sized glyphs, since sometimes, for example, spaces are emitted as glyphs by the shaper for some reason, even though they have no actual content, and we want to avoid sending a bunch of useless stuff to the GPU.
This commit is contained in:
@ -1808,19 +1808,25 @@ fn updateCell(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the cell has a character, draw it
|
// If the shaper cell has a glyph, draw it.
|
||||||
if (cell.hasText()) fg: {
|
if (shaper_cell.glyph_index) |glyph_index| glyph: {
|
||||||
// Render
|
// Render
|
||||||
const render = try self.font_grid.renderGlyph(
|
const render = try self.font_grid.renderGlyph(
|
||||||
self.alloc,
|
self.alloc,
|
||||||
shaper_run.font_index,
|
shaper_run.font_index,
|
||||||
shaper_cell.glyph_index orelse break :fg,
|
glyph_index,
|
||||||
.{
|
.{
|
||||||
.grid_metrics = self.grid_metrics,
|
.grid_metrics = self.grid_metrics,
|
||||||
.thicken = self.config.font_thicken,
|
.thicken = self.config.font_thicken,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// If the glyph is 0 width or height, it will be invisible
|
||||||
|
// when drawn, so don't bother adding it to the buffer.
|
||||||
|
if (render.glyph.width == 0 or render.glyph.height == 0) {
|
||||||
|
break :glyph;
|
||||||
|
}
|
||||||
|
|
||||||
// If we're rendering a color font, we use the color atlas
|
// If we're rendering a color font, we use the color atlas
|
||||||
const mode: CellProgram.CellMode = switch (try fgMode(
|
const mode: CellProgram.CellMode = switch (try fgMode(
|
||||||
render.presentation,
|
render.presentation,
|
||||||
|
Reference in New Issue
Block a user