From 57302425966fcf9d79b08433f82a9d15e60cb1e4 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Tue, 8 Oct 2024 23:47:35 -0400 Subject: [PATCH] coretext: don't emit 0 codepoints for special fonts --- src/font/shaper/coretext.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/font/shaper/coretext.zig b/src/font/shaper/coretext.zig index 085f913d3..6cf494c1e 100644 --- a/src/font/shaper/coretext.zig +++ b/src/font/shaper/coretext.zig @@ -361,6 +361,12 @@ pub const Shaper = struct { self.cell_buf.clearRetainingCapacity(); try self.cell_buf.ensureTotalCapacity(self.alloc, state.codepoints.items.len); for (state.codepoints.items) |entry| { + // We use null codepoints to pad out our list so indices match + // the UTF-16 string we constructed for CoreText. We don't want + // to emit these if this is a special font, since they're not + // part of the original run. + if (entry.codepoint == 0) continue; + self.cell_buf.appendAssumeCapacity(.{ .x = @intCast(entry.cluster), .glyph_index = @intCast(entry.codepoint),