diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-28 09:28:37 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-28 09:28:37 +0300 |
commit | 4756b0a18d58560cc4023ed61d4940b127da63f3 (patch) | |
tree | 644c5868e4ad89e7bd1f74be92c0e9e471090630 | |
parent | 7512470f3b36d25ffd714f1013bbb4ee9fea0e2c (diff) |
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
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | res/about/license.gmi | 3 | ||||
-rw-r--r-- | res/fonts/NotoSansArabic-Regular.ttf | bin | 0 -> 140400 bytes | |||
-rw-r--r-- | res/fonts/NotoSansArabicUI-Regular.ttf | bin | 0 -> 138624 bytes | |||
-rw-r--r-- | src/ui/text.c | 8 | ||||
-rw-r--r-- | src/ui/text.h | 3 |
6 files changed, 14 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c942c864..75883966 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -64,6 +64,7 @@ set (EMBED_RESOURCES | |||
64 | res/fonts/Literata-LightItalic-opsz=10.ttf | 64 | res/fonts/Literata-LightItalic-opsz=10.ttf |
65 | res/fonts/NanumGothic-Regular.ttf | 65 | res/fonts/NanumGothic-Regular.ttf |
66 | res/fonts/NotoEmoji-Regular.ttf | 66 | res/fonts/NotoEmoji-Regular.ttf |
67 | res/fonts/NotoSansArabicUI-Regular.ttf | ||
67 | res/fonts/NotoSansJP-Regular.ttf | 68 | res/fonts/NotoSansJP-Regular.ttf |
68 | res/fonts/NotoSansSC-Regular.ttf | 69 | res/fonts/NotoSansSC-Regular.ttf |
69 | res/fonts/Nunito-Bold.ttf | 70 | res/fonts/Nunito-Bold.ttf |
@@ -188,6 +189,7 @@ set (SOURCES | |||
188 | res/about/about.gmi | 189 | res/about/about.gmi |
189 | res/about/help.gmi | 190 | res/about/help.gmi |
190 | res/about/lagrange.gmi | 191 | res/about/lagrange.gmi |
192 | res/about/license.gmi | ||
191 | res/about/version.gmi | 193 | res/about/version.gmi |
192 | ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr | 194 | ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr |
193 | ${CMAKE_CURRENT_BINARY_DIR}/embedded.c | 195 | ${CMAKE_CURRENT_BINARY_DIR}/embedded.c |
diff --git a/res/about/license.gmi b/res/about/license.gmi index d5ffe3c4..8c00f5d2 100644 --- a/res/about/license.gmi +++ b/res/about/license.gmi | |||
@@ -104,7 +104,8 @@ This application uses fonts licensed under the Open Font License. | |||
104 | => https://typeof.net/Iosevka/ Iosevka | 104 | => https://typeof.net/Iosevka/ Iosevka |
105 | => https://github.com/googlefonts/literata/blob/master/OFL.txt Literata | 105 | => https://github.com/googlefonts/literata/blob/master/OFL.txt Literata |
106 | => https://github.com/google/fonts/blob/master/ofl/nanumgothic/OFL.txt Nanum Gothic | 106 | => https://github.com/google/fonts/blob/master/ofl/nanumgothic/OFL.txt Nanum Gothic |
107 | => https://www.google.com/get/noto/help/cjk/ Noto Sans CJK JP | 107 | => https://www.google.com/get/noto/#sans-arab Noto Sans Arabic |
108 | => https://www.google.com/get/noto/help/cjk/ Noto Sans CJK (JP, SC) | ||
108 | => https://github.com/googlefonts/nunito/blob/master/OFL.txt Nunito | 109 | => https://github.com/googlefonts/nunito/blob/master/OFL.txt Nunito |
109 | => https://github.com/adobe-fonts/source-sans-pro/blob/release/LICENSE.md Source Sans Pro | 110 | => https://github.com/adobe-fonts/source-sans-pro/blob/release/LICENSE.md Source Sans Pro |
110 | 111 | ||
diff --git a/res/fonts/NotoSansArabic-Regular.ttf b/res/fonts/NotoSansArabic-Regular.ttf new file mode 100644 index 00000000..94eead4c --- /dev/null +++ b/res/fonts/NotoSansArabic-Regular.ttf | |||
Binary files differ | |||
diff --git a/res/fonts/NotoSansArabicUI-Regular.ttf b/res/fonts/NotoSansArabicUI-Regular.ttf new file mode 100644 index 00000000..89b02b31 --- /dev/null +++ b/res/fonts/NotoSansArabicUI-Regular.ttf | |||
Binary files differ | |||
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) { | |||
331 | DEFINE_FONT_SET(fontNotoSansJPRegular_Embedded), | 331 | DEFINE_FONT_SET(fontNotoSansJPRegular_Embedded), |
332 | DEFINE_FONT_SET(fontNotoSansSCRegular_Embedded), | 332 | DEFINE_FONT_SET(fontNotoSansSCRegular_Embedded), |
333 | DEFINE_FONT_SET(fontNanumGothicRegular_Embedded), /* TODO: should use Noto Sans here, too */ | 333 | DEFINE_FONT_SET(fontNanumGothicRegular_Embedded), /* TODO: should use Noto Sans here, too */ |
334 | DEFINE_FONT_SET(fontNotoSansArabicUIRegular_Embedded), | ||
334 | }; | 335 | }; |
335 | iForIndices(i, fontData) { | 336 | iForIndices(i, fontData) { |
336 | iFont *font = &d->fonts[i]; | 337 | iFont *font = &d->fonts[i]; |
@@ -584,6 +585,13 @@ iLocalDef iFont *characterFont_Font_(iFont *d, iChar ch, uint32_t *glyphIndex) { | |||
584 | return japanese; | 585 | return japanese; |
585 | } | 586 | } |
586 | } | 587 | } |
588 | /* Maybe Arabic. */ | ||
589 | if (ch >= 0x600) { | ||
590 | iFont *arabic = font_Text_(arabic_FontId + d->sizeId); | ||
591 | if (arabic != d && (*glyphIndex = glyphIndex_Font_(arabic, ch)) != 0) { | ||
592 | return arabic; | ||
593 | } | ||
594 | } | ||
587 | #if defined (iPlatformApple) | 595 | #if defined (iPlatformApple) |
588 | /* White up arrow is used for the Shift key on macOS. Symbola's glyph is not a great | 596 | /* White up arrow is used for the Shift key on macOS. Symbola's glyph is not a great |
589 | match to the other text, so use the UI font instead. */ | 597 | 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 { | |||
75 | japanese_FontId = emoji_FontId + max_FontSize, | 75 | japanese_FontId = emoji_FontId + max_FontSize, |
76 | chineseSimplified_FontId = japanese_FontId + max_FontSize, | 76 | chineseSimplified_FontId = japanese_FontId + max_FontSize, |
77 | korean_FontId = chineseSimplified_FontId + max_FontSize, | 77 | korean_FontId = chineseSimplified_FontId + max_FontSize, |
78 | max_FontId = korean_FontId + max_FontSize, | 78 | arabic_FontId = korean_FontId + max_FontSize, |
79 | max_FontId = arabic_FontId + max_FontSize, | ||
79 | 80 | ||
80 | /* Meta: */ | 81 | /* Meta: */ |
81 | mask_FontId = 0xffff, | 82 | mask_FontId = 0xffff, |