Merge pull request #50607 from bruvzg/add_bold_fonts

[Editor Fonts] Add Noto Sans Bold font variant for supported languages.
This commit is contained in:
Rémi Verschelde 2021-07-20 07:21:40 +02:00 committed by GitHub
commit a09088ac8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 142 additions and 46 deletions

View file

@ -40,15 +40,30 @@
#define MAKE_FALLBACKS(m_name) \
m_name->add_data(FontArabic); \
m_name->add_data(FontBengali); \
m_name->add_data(FontDevanagari); \
m_name->add_data(FontGeorgian); \
m_name->add_data(FontHebrew); \
m_name->add_data(FontMalayalam); \
m_name->add_data(FontOriya); \
m_name->add_data(FontSinhala); \
m_name->add_data(FontTamil); \
m_name->add_data(FontTelugu); \
m_name->add_data(FontHebrew); \
m_name->add_data(FontThai); \
m_name->add_data(FontHindi); \
m_name->add_data(FontJapanese); \
m_name->add_data(FontFallback);
#define MAKE_FALLBACKS_BOLD(m_name) \
m_name->add_data(FontArabicBold); \
m_name->add_data(FontBengaliBold); \
m_name->add_data(FontDevanagariBold); \
m_name->add_data(FontGeorgianBold); \
m_name->add_data(FontHebrewBold); \
m_name->add_data(FontMalayalamBold); \
m_name->add_data(FontOriyaBold); \
m_name->add_data(FontSinhalaBold); \
m_name->add_data(FontTamilBold); \
m_name->add_data(FontTeluguBold); \
m_name->add_data(FontThaiBold); \
m_name->add_data(FontJapanese); \
m_name->add_data(FontFallback);
@ -77,7 +92,7 @@
} \
m_name->set_spacing(Font::SPACING_TOP, -EDSCALE); \
m_name->set_spacing(Font::SPACING_BOTTOM, -EDSCALE); \
MAKE_FALLBACKS(m_name);
MAKE_FALLBACKS_BOLD(m_name);
#define MAKE_SOURCE_FONT(m_name) \
Ref<Font> m_name; \
@ -175,36 +190,22 @@ void editor_register_fonts(Ref<Theme> p_theme) {
memdelete(dir);
/* Droid Sans */
/* Noto Sans UI */
Ref<FontData> DefaultFont;
DefaultFont.instantiate();
DefaultFont->load_memory(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size, "ttf", default_font_size);
DefaultFont->load_memory(_font_NotoSans_Regular, _font_NotoSans_Regular_size, "ttf", default_font_size);
DefaultFont->set_antialiased(font_antialiased);
DefaultFont->set_hinting(font_hinting);
DefaultFont->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> DefaultFontBold;
DefaultFontBold.instantiate();
DefaultFontBold->load_memory(_font_NotoSansUI_Bold, _font_NotoSansUI_Bold_size, "ttf", default_font_size);
DefaultFontBold->load_memory(_font_NotoSans_Bold, _font_NotoSans_Bold_size, "ttf", default_font_size);
DefaultFontBold->set_antialiased(font_antialiased);
DefaultFontBold->set_hinting(font_hinting);
DefaultFontBold->set_force_autohinter(true); // just looks better..i think?
Ref<FontData> FontFallback;
FontFallback.instantiate();
FontFallback->load_memory(_font_DroidSansFallback, _font_DroidSansFallback_size, "ttf", default_font_size);
FontFallback->set_antialiased(font_antialiased);
FontFallback->set_hinting(font_hinting);
FontFallback->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontJapanese;
FontJapanese.instantiate();
FontJapanese->load_memory(_font_DroidSansJapanese, _font_DroidSansJapanese_size, "ttf", default_font_size);
FontJapanese->set_antialiased(font_antialiased);
FontJapanese->set_hinting(font_hinting);
FontJapanese->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontArabic;
FontArabic.instantiate();
FontArabic->load_memory(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size, "ttf", default_font_size);
@ -212,13 +213,41 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontArabic->set_hinting(font_hinting);
FontArabic->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontArabicBold;
FontArabicBold.instantiate();
FontArabicBold->load_memory(_font_NotoNaskhArabicUI_Bold, _font_NotoNaskhArabicUI_Bold_size, "ttf", default_font_size);
FontArabicBold->set_antialiased(font_antialiased);
FontArabicBold->set_hinting(font_hinting);
FontArabicBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontBengali;
FontBengali.instantiate();
FontBengali->load_memory(_font_NotoSansBengali_Regular, _font_NotoSansBengali_Regular_size, "ttf", default_font_size);
FontBengali->load_memory(_font_NotoSansBengaliUI_Regular, _font_NotoSansBengaliUI_Regular_size, "ttf", default_font_size);
FontBengali->set_antialiased(font_antialiased);
FontBengali->set_hinting(font_hinting);
FontBengali->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontBengaliBold;
FontBengaliBold.instantiate();
FontBengaliBold->load_memory(_font_NotoSansBengaliUI_Bold, _font_NotoSansBengaliUI_Bold_size, "ttf", default_font_size);
FontBengaliBold->set_antialiased(font_antialiased);
FontBengaliBold->set_hinting(font_hinting);
FontBengaliBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontDevanagari;
FontDevanagari.instantiate();
FontDevanagari->load_memory(_font_NotoSansDevanagariUI_Regular, _font_NotoSansDevanagariUI_Regular_size, "ttf", default_font_size);
FontDevanagari->set_antialiased(font_antialiased);
FontDevanagari->set_hinting(font_hinting);
FontDevanagari->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontDevanagariBold;
FontDevanagariBold.instantiate();
FontDevanagariBold->load_memory(_font_NotoSansDevanagariUI_Bold, _font_NotoSansDevanagariUI_Bold_size, "ttf", default_font_size);
FontDevanagariBold->set_antialiased(font_antialiased);
FontDevanagariBold->set_hinting(font_hinting);
FontDevanagariBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontGeorgian;
FontGeorgian.instantiate();
FontGeorgian->load_memory(_font_NotoSansGeorgian_Regular, _font_NotoSansGeorgian_Regular_size, "ttf", default_font_size);
@ -226,6 +255,13 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontGeorgian->set_hinting(font_hinting);
FontGeorgian->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontGeorgianBold;
FontGeorgianBold.instantiate();
FontGeorgianBold->load_memory(_font_NotoSansGeorgian_Bold, _font_NotoSansGeorgian_Bold_size, "ttf", default_font_size);
FontGeorgianBold->set_antialiased(font_antialiased);
FontGeorgianBold->set_hinting(font_hinting);
FontGeorgianBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontHebrew;
FontHebrew.instantiate();
FontHebrew->load_memory(_font_NotoSansHebrew_Regular, _font_NotoSansHebrew_Regular_size, "ttf", default_font_size);
@ -233,6 +269,13 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontHebrew->set_hinting(font_hinting);
FontHebrew->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontHebrewBold;
FontHebrewBold.instantiate();
FontHebrewBold->load_memory(_font_NotoSansHebrew_Bold, _font_NotoSansHebrew_Bold_size, "ttf", default_font_size);
FontHebrewBold->set_antialiased(font_antialiased);
FontHebrewBold->set_hinting(font_hinting);
FontHebrewBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontMalayalam;
FontMalayalam.instantiate();
FontMalayalam->load_memory(_font_NotoSansMalayalamUI_Regular, _font_NotoSansMalayalamUI_Regular_size, "ttf", default_font_size);
@ -240,6 +283,13 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontMalayalam->set_hinting(font_hinting);
FontMalayalam->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontMalayalamBold;
FontMalayalamBold.instantiate();
FontMalayalamBold->load_memory(_font_NotoSansMalayalamUI_Bold, _font_NotoSansMalayalamUI_Bold_size, "ttf", default_font_size);
FontMalayalamBold->set_antialiased(font_antialiased);
FontMalayalamBold->set_hinting(font_hinting);
FontMalayalamBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontOriya;
FontOriya.instantiate();
FontOriya->load_memory(_font_NotoSansOriyaUI_Regular, _font_NotoSansOriyaUI_Regular_size, "ttf", default_font_size);
@ -247,6 +297,13 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontOriya->set_hinting(font_hinting);
FontOriya->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontOriyaBold;
FontOriyaBold.instantiate();
FontOriyaBold->load_memory(_font_NotoSansOriyaUI_Bold, _font_NotoSansOriyaUI_Bold_size, "ttf", default_font_size);
FontOriyaBold->set_antialiased(font_antialiased);
FontOriyaBold->set_hinting(font_hinting);
FontOriyaBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontSinhala;
FontSinhala.instantiate();
FontSinhala->load_memory(_font_NotoSansSinhalaUI_Regular, _font_NotoSansSinhalaUI_Regular_size, "ttf", default_font_size);
@ -254,6 +311,13 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontSinhala->set_hinting(font_hinting);
FontSinhala->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontSinhalaBold;
FontSinhalaBold.instantiate();
FontSinhalaBold->load_memory(_font_NotoSansSinhalaUI_Bold, _font_NotoSansSinhalaUI_Bold_size, "ttf", default_font_size);
FontSinhalaBold->set_antialiased(font_antialiased);
FontSinhalaBold->set_hinting(font_hinting);
FontSinhalaBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontTamil;
FontTamil.instantiate();
FontTamil->load_memory(_font_NotoSansTamilUI_Regular, _font_NotoSansTamilUI_Regular_size, "ttf", default_font_size);
@ -261,6 +325,13 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontTamil->set_hinting(font_hinting);
FontTamil->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontTamilBold;
FontTamilBold.instantiate();
FontTamilBold->load_memory(_font_NotoSansTamilUI_Bold, _font_NotoSansTamilUI_Bold_size, "ttf", default_font_size);
FontTamilBold->set_antialiased(font_antialiased);
FontTamilBold->set_hinting(font_hinting);
FontTamilBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontTelugu;
FontTelugu.instantiate();
FontTelugu->load_memory(_font_NotoSansTeluguUI_Regular, _font_NotoSansTeluguUI_Regular_size, "ttf", default_font_size);
@ -268,6 +339,13 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontTelugu->set_hinting(font_hinting);
FontTelugu->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontTeluguBold;
FontTeluguBold.instantiate();
FontTeluguBold->load_memory(_font_NotoSansTeluguUI_Bold, _font_NotoSansTeluguUI_Bold_size, "ttf", default_font_size);
FontTeluguBold->set_antialiased(font_antialiased);
FontTeluguBold->set_hinting(font_hinting);
FontTeluguBold->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontThai;
FontThai.instantiate();
FontThai->load_memory(_font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size, "ttf", default_font_size);
@ -275,12 +353,30 @@ void editor_register_fonts(Ref<Theme> p_theme) {
FontThai->set_hinting(font_hinting);
FontThai->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontHindi;
FontHindi.instantiate();
FontHindi->load_memory(_font_NotoSansDevanagariUI_Regular, _font_NotoSansDevanagariUI_Regular_size, "ttf", default_font_size);
FontHindi->set_antialiased(font_antialiased);
FontHindi->set_hinting(font_hinting);
FontHindi->set_force_autohinter(true); //just looks better..i think?
Ref<FontData> FontThaiBold;
FontThaiBold.instantiate();
FontThaiBold->load_memory(_font_NotoSansThaiUI_Bold, _font_NotoSansThaiUI_Bold_size, "ttf", default_font_size);
FontThaiBold->set_antialiased(font_antialiased);
FontThaiBold->set_hinting(font_hinting);
FontThaiBold->set_force_autohinter(true); //just looks better..i think?
/* Droid Sans Fallback */
Ref<FontData> FontFallback;
FontFallback.instantiate();
FontFallback->load_memory(_font_DroidSansFallback, _font_DroidSansFallback_size, "ttf", default_font_size);
FontFallback->set_antialiased(font_antialiased);
FontFallback->set_hinting(font_hinting);
FontFallback->set_force_autohinter(true); //just looks better..i think?
/* Droid Sans Japanese */
Ref<FontData> FontJapanese;
FontJapanese.instantiate();
FontJapanese->load_memory(_font_DroidSansJapanese, _font_DroidSansJapanese_size, "ttf", default_font_size);
FontJapanese->set_antialiased(font_antialiased);
FontJapanese->set_hinting(font_hinting);
FontJapanese->set_force_autohinter(true); //just looks better..i think?
/* Hack */

View file

@ -55,7 +55,7 @@ TEST_SUITE("[[TextServer]") {
for (int i = 0; i < TextServerManager::get_interface_count(); i++) {
TextServer *ts = TextServerManager::initialize(i, err);
RID font = ts->create_font_memory(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size, "ttf");
RID font = ts->create_font_memory(_font_NotoSans_Regular, _font_NotoSans_Regular_size, "ttf");
TEST_FAIL_COND(font == RID(), "Loading font failed.");
ts->free(font);
}
@ -66,7 +66,7 @@ TEST_SUITE("[[TextServer]") {
TextServer *ts = TextServerManager::initialize(i, err);
Vector<RID> font;
font.push_back(ts->create_font_memory(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size, "ttf"));
font.push_back(ts->create_font_memory(_font_NotoSans_Regular, _font_NotoSans_Regular_size, "ttf"));
font.push_back(ts->create_font_memory(_font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size, "ttf"));
String test = U"คนอ้วน khon uan ראה";
@ -112,7 +112,7 @@ TEST_SUITE("[[TextServer]") {
}
Vector<RID> font;
font.push_back(ts->create_font_memory(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size, "ttf"));
font.push_back(ts->create_font_memory(_font_NotoSans_Regular, _font_NotoSans_Regular_size, "ttf"));
font.push_back(ts->create_font_memory(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size, "ttf"));
String test = U"Arabic (اَلْعَرَبِيَّةُ, al-ʿarabiyyah)";
@ -156,7 +156,7 @@ TEST_SUITE("[[TextServer]") {
// 5^ 10^
Vector<RID> font;
font.push_back(ts->create_font_memory(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size, "ttf"));
font.push_back(ts->create_font_memory(_font_NotoSans_Regular, _font_NotoSans_Regular_size, "ttf"));
font.push_back(ts->create_font_memory(_font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size, "ttf"));
RID ctx = ts->create_shaped_text();
@ -186,7 +186,7 @@ TEST_SUITE("[[TextServer]") {
TextServer *ts = TextServerManager::initialize(i, err);
Vector<RID> font;
font.push_back(ts->create_font_memory(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size, "ttf"));
font.push_back(ts->create_font_memory(_font_NotoSans_Regular, _font_NotoSans_Regular_size, "ttf"));
font.push_back(ts->create_font_memory(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size, "ttf"));
String test_1 = U"الحمد";

View file

@ -123,9 +123,9 @@ Files extracted from upstream source:
## fonts
- `NotoSans*.ttf`, `NotoNaskhArabicUI_Regular.ttf`:
* Upstream: https://github.com/googlei18n/noto-fonts
* Version: 1.06 (2017)
- `NotoSans*.ttf`, `NotoNaskhArabicUI_*.ttf`:
* Upstream: https://github.com/googlefonts/noto-fonts
* Version: v2017-10-24-phase3-second-cleanup
* License: OFL-1.1
* Comment: Use UI font variant if available, because it has tight vertical metrics and
good for UI.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
thirdparty/fonts/NotoSansHebrew_Bold.ttf vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
thirdparty/fonts/NotoSansThaiUI_Bold.ttf vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
thirdparty/fonts/NotoSans_Bold.ttf vendored Normal file

Binary file not shown.

BIN
thirdparty/fonts/NotoSans_Regular.ttf vendored Normal file

Binary file not shown.