From 4756b0a18d58560cc4023ed61d4940b127da63f3 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sun, 28 Mar 2021 09:28:37 +0300 Subject: Added Noto Sans Arabic Added a font for Arabic, making the glyphs available for rendering. Of course, this doesn't solve Arabic text rendering yet. There is still the RTL direction to work out and possibly some missing glyph combining rules. IssueID #195 --- src/ui/text.c | 8 ++++++++ src/ui/text.h | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/text.c b/src/ui/text.c index 6aaf40f5..b4401abb 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -331,6 +331,7 @@ static void initFonts_Text_(iText *d) { DEFINE_FONT_SET(fontNotoSansJPRegular_Embedded), DEFINE_FONT_SET(fontNotoSansSCRegular_Embedded), DEFINE_FONT_SET(fontNanumGothicRegular_Embedded), /* TODO: should use Noto Sans here, too */ + DEFINE_FONT_SET(fontNotoSansArabicUIRegular_Embedded), }; iForIndices(i, fontData) { iFont *font = &d->fonts[i]; @@ -584,6 +585,13 @@ iLocalDef iFont *characterFont_Font_(iFont *d, iChar ch, uint32_t *glyphIndex) { return japanese; } } + /* Maybe Arabic. */ + if (ch >= 0x600) { + iFont *arabic = font_Text_(arabic_FontId + d->sizeId); + if (arabic != d && (*glyphIndex = glyphIndex_Font_(arabic, ch)) != 0) { + return arabic; + } + } #if defined (iPlatformApple) /* White up arrow is used for the Shift key on macOS. Symbola's glyph is not a great match to the other text, so use the UI font instead. */ diff --git a/src/ui/text.h b/src/ui/text.h index d86754cc..58941974 100644 --- a/src/ui/text.h +++ b/src/ui/text.h @@ -75,7 +75,8 @@ enum iFontId { japanese_FontId = emoji_FontId + max_FontSize, chineseSimplified_FontId = japanese_FontId + max_FontSize, korean_FontId = chineseSimplified_FontId + max_FontSize, - max_FontId = korean_FontId + max_FontSize, + arabic_FontId = korean_FontId + max_FontSize, + max_FontId = arabic_FontId + max_FontSize, /* Meta: */ mask_FontId = 0xffff, -- cgit v1.2.3