mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-12 21:06:18 +00:00
Position-independent font shaper caching
Use relative cluster positioning to allow identical texts runs in different row positions to share the same cache entry.
This commit is contained in:
@@ -2530,7 +2530,7 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
||||
|
||||
// Advance our index until we reach or pass
|
||||
// our current x position in the shaper cells.
|
||||
while (shaper_cells.?[shaper_cells_i].x < x) {
|
||||
while (shaper_cells.?[shaper_cells_i].x + run.offset < x) {
|
||||
shaper_cells_i += 1;
|
||||
}
|
||||
}
|
||||
@@ -2769,13 +2769,13 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
||||
// If we encounter a shaper cell to the left of the current
|
||||
// cell then we have some problems. This logic relies on x
|
||||
// position monotonically increasing.
|
||||
assert(cells[shaper_cells_i].x >= x);
|
||||
assert(cells[shaper_cells_i].x + run.offset >= x);
|
||||
|
||||
// NOTE: An assumption is made here that a single cell will never
|
||||
// be present in more than one shaper run. If that assumption is
|
||||
// violated, this logic breaks.
|
||||
|
||||
while (shaper_cells_i < cells.len and cells[shaper_cells_i].x == x) : ({
|
||||
while (shaper_cells_i < cells.len and cells[shaper_cells_i].x + run.offset == x) : ({
|
||||
shaper_cells_i += 1;
|
||||
}) {
|
||||
self.addGlyph(
|
||||
|
Reference in New Issue
Block a user