mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
font: shaper should not look up U+200D for consistent fonts
Related to #914 U+200D is the zero-width joiner character used for multi-codepoint Emojis. When faced with a multi-codepoint grapheme, the font shaper must find a font that provides _all codepoints_ consistently. However, U+200D isn't meant to be provided by any font. As a result, the font shaper search ends up iterating over every font looking for a match.
This commit is contained in:
@ -213,6 +213,7 @@ pub const RunIterator = struct {
|
|||||||
if (cell.attrs.grapheme) {
|
if (cell.attrs.grapheme) {
|
||||||
var it = self.row.codepointIterator(j);
|
var it = self.row.codepointIterator(j);
|
||||||
while (it.next()) |cp| {
|
while (it.next()) |cp| {
|
||||||
|
// Do not send presentation modifiers
|
||||||
if (cp == 0xFE0E or cp == 0xFE0F) continue;
|
if (cp == 0xFE0E or cp == 0xFE0F) continue;
|
||||||
try self.hooks.addCodepoint(cp, @intCast(cluster));
|
try self.hooks.addCodepoint(cp, @intCast(cluster));
|
||||||
}
|
}
|
||||||
@ -269,7 +270,7 @@ pub const RunIterator = struct {
|
|||||||
|
|
||||||
while (it.next()) |cp| {
|
while (it.next()) |cp| {
|
||||||
// Ignore Emoji ZWJs
|
// Ignore Emoji ZWJs
|
||||||
if (cp == 0xFE0E or cp == 0xFE0F) continue;
|
if (cp == 0xFE0E or cp == 0xFE0F or cp == 0x200D) continue;
|
||||||
|
|
||||||
// Find a font that supports this codepoint. If none support this
|
// Find a font that supports this codepoint. If none support this
|
||||||
// then the whole grapheme can't be rendered so we return null.
|
// then the whole grapheme can't be rendered so we return null.
|
||||||
@ -288,7 +289,7 @@ pub const RunIterator = struct {
|
|||||||
it.reset();
|
it.reset();
|
||||||
while (it.next()) |cp| {
|
while (it.next()) |cp| {
|
||||||
// Ignore Emoji ZWJs
|
// Ignore Emoji ZWJs
|
||||||
if (cp == 0xFE0E or cp == 0xFE0F) continue;
|
if (cp == 0xFE0E or cp == 0xFE0F or cp == 0x200D) continue;
|
||||||
if (!self.group.group.hasCodepoint(idx, cp, presentation)) break;
|
if (!self.group.group.hasCodepoint(idx, cp, presentation)) break;
|
||||||
} else {
|
} else {
|
||||||
// If the while completed, then we have a candidate that
|
// If the while completed, then we have a candidate that
|
||||||
|
Reference in New Issue
Block a user