From e4f4b708c989e68a96ed340f5ce99b0678c6f556 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Fri, 11 Oct 2024 13:44:49 -0400 Subject: [PATCH] font/shaper: explicitly skip invisible cells while shaping Fixes a bug caused by the renderer logic assuming this behavior and not advancing the run iterator when skipping foreground elements in cells with the invisible flag set. --- src/font/shaper/run.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/font/shaper/run.zig b/src/font/shaper/run.zig index 8ef0f790c..22d19979e 100644 --- a/src/font/shaper/run.zig +++ b/src/font/shaper/run.zig @@ -55,6 +55,14 @@ pub const RunIterator = struct { break :max 0; }; + // Invisible cells don't have any glyphs rendered, + // so we explicitly skip them in the shaping process. + while (self.i < max and + self.row.style(&cells[self.i]).flags.invisible) + { + self.i += 1; + } + // We're over at the max if (self.i >= max) return null;