From 80c0ba875836247599c581254a97c447b14c26a0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 30 May 2024 14:22:42 -0700 Subject: [PATCH] font: when presentation isn't found, always fallback to any Fixes #1808 When resolving a codepoint, we first attempt to find the default presentation (if an explicit one is not given), but we were not falling back to "any" in case that presentation was not found. --- src/font/CodepointResolver.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/font/CodepointResolver.zig b/src/font/CodepointResolver.zig index e695e5a74..442a01268 100644 --- a/src/font/CodepointResolver.zig +++ b/src/font/CodepointResolver.zig @@ -211,8 +211,10 @@ pub fn getIndex( } } - // If this is already regular, we're done falling back. - if (style == .regular and p == null) return null; + // If this is regular with any matching presentation, then we are done + // there is nothing more we can do. Otherwise we fall through and do + // an any presentation search. + if (style == .regular and p_mode == .any) return null; // For non-regular fonts, we fall back to regular with any presentation return self.collection.getIndex(cp, .regular, .{ .any = {} });