mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
font: don't fallback styles when searching for a codepoint
see comment
This commit is contained in:
@ -296,6 +296,9 @@ pub fn init(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We don't support auto-italics. If we don't have an italic font
|
||||
// face let the user know so they aren't surprised (if they look
|
||||
// at logs).
|
||||
if (group.getFace(.italic) == null) {
|
||||
log.warn("no italic font face available, italics will not render", .{});
|
||||
}
|
||||
|
@ -198,8 +198,15 @@ pub fn indexForCodepoint(
|
||||
// If we can find the exact value, then return that.
|
||||
if (self.indexForCodepointExact(cp, style, p)) |value| return value;
|
||||
|
||||
// Try looking for another font that will satisfy this request.
|
||||
if (font.Discover != void) {
|
||||
// If we're not a regular font style, try looking for a regular font
|
||||
// that will satisfy this request. Blindly looking for unmatched styled
|
||||
// fonts to satisfy one codepoint results in some ugly rendering.
|
||||
if (style != .regular) {
|
||||
if (self.indexForCodepoint(cp, .regular, p)) |value| return value;
|
||||
}
|
||||
|
||||
// If we are regular, try looking for a fallback using discovery.
|
||||
if (style == .regular and font.Discover != void) {
|
||||
if (self.discover) |*disco| discover: {
|
||||
var disco_it = disco.discover(.{
|
||||
.codepoint = cp,
|
||||
|
Reference in New Issue
Block a user