diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-06 18:36:24 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-06 18:36:24 +0300 |
commit | e401672251c5de266388e91123b4c3e63f2e5e54 (patch) | |
tree | a317bc3511534f72a52f45dc03d71e3e314204b5 | |
parent | 35650b13e506f0df1a03b66747b9e1514640a2cc (diff) |
Text: Fixed font lookup order
Check auxiliary fonts first, and then all primary fonts that haven't been checked yet.
-rw-r--r-- | src/ui/text.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/ui/text.c b/src/ui/text.c index 65c95ef6..25c79e23 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -710,17 +710,24 @@ iLocalDef iFont *characterFont_Font_(iFont *d, iChar ch, uint32_t *glyphIndex) { | |||
710 | return d; | 710 | return d; |
711 | } | 711 | } |
712 | /* As a fallback, check all other available fonts of this size. */ | 712 | /* As a fallback, check all other available fonts of this size. */ |
713 | for (iFont *font = font_Text_(FONT_ID(0, styleId, sizeId)); | 713 | for (int aux = 0; aux < 2; aux++) { |
714 | font < (iFont *) end_Array(&activeText_->fonts); | 714 | for (iFont *font = font_Text_(FONT_ID(0, styleId, sizeId)); |
715 | font += maxVariants_Fonts) { | 715 | font < (iFont *) end_Array(&activeText_->fonts); |
716 | if (font == d || font == overrideFont) { | 716 | font += maxVariants_Fonts) { |
717 | continue; /* already checked this one */ | 717 | const iBool isAuxiliary = (font->fontSpec->flags & auxiliary_FontSpecFlag) ? 1 : 0; |
718 | } | 718 | if (aux == isAuxiliary) { |
719 | if ((*glyphIndex = glyphIndex_Font_(font, ch)) != 0) { | 719 | /* First try auxiliary fonts, then other remaining fonts. */ |
720 | printf("using %s[%f] for %lc (%x) => %d\n", | 720 | continue; |
721 | cstr_String(&font->fontSpec->name), font->fontSpec->scaling, | 721 | } |
722 | (int) ch, ch, glyphIndex_Font_(font, ch)); | 722 | if (font == d || font == overrideFont) { |
723 | return font; | 723 | continue; /* already checked this one */ |
724 | } | ||
725 | if ((*glyphIndex = glyphIndex_Font_(font, ch)) != 0) { | ||
726 | // printf("using %s[%f] for %lc (%x) => %d\n", | ||
727 | // cstr_String(&font->fontSpec->name), font->fontSpec->scaling, | ||
728 | // (int) ch, ch, glyphIndex_Font_(font, ch)); | ||
729 | return font; | ||
730 | } | ||
724 | } | 731 | } |
725 | } | 732 | } |
726 | #if 0 | 733 | #if 0 |