diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index e2b5a655e77..c77aa15c6c0 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -273,6 +273,11 @@ Comment: DroidSans font
Copyright: 2008, The Android Open Source Project
License: Apache-2.0
+Files: thirdparty/fonts/Inter*.woff2
+Comment: Inter font
+Copyright: 2016, The Inter Project Authors
+License: OFL-1.1
+
Files: thirdparty/fonts/JetBrainsMono_Regular.woff2
Comment: JetBrains Mono font
Copyright: 2020, JetBrains s.r.o.
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index b73dc5a54cf..8d6b6aeeff0 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -927,6 +927,7 @@
List of custom OpenType features to use, if supported by the currently configured main font. Check what OpenType features are supported by your font first.
The string should follow the OpenType specification, e.g. [code]ss01,tnum,calt=false[/code]. Microsoft's documentation contains a list of [url=https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist]all registered features[/url].
+ [b]Note:[/b] The default editor main font ([url=https://rsms.me/inter]Inter[/url]) has custom OpenType features in its font file, with [code]ss04[/code] and [code]tnum[/code] enabled and [code]calt[/code] disabled by default. Supported features can be found at its website.
The size of the font in the editor interface.
diff --git a/editor/themes/editor_fonts.cpp b/editor/themes/editor_fonts.cpp
index 34b80be4dbd..91810c923c7 100644
--- a/editor/themes/editor_fonts.cpp
+++ b/editor/themes/editor_fonts.cpp
@@ -154,8 +154,13 @@ void editor_register_fonts(const Ref &p_theme) {
const int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE;
const float embolden_strength = 0.6;
- Ref default_font = load_internal_font(_font_NotoSans_Regular, _font_NotoSans_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false);
- Ref default_font_msdf = load_internal_font(_font_NotoSans_Regular, _font_NotoSans_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
+ Ref default_font = load_internal_font(_font_Inter_Regular, _font_Inter_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false);
+ Ref default_font_msdf = load_internal_font(_font_Inter_Regular, _font_Inter_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
+
+ Dictionary default_features;
+ default_features["calt"] = false; // Disable contextual alternates by default.
+ default_features["ss04"] = true; // Serifed I, tailed l for better distinction.
+ default_features["tnum"] = true; // Tabular numbers for better alignment.
String noto_cjk_path;
String noto_cjk_bold_path;
@@ -189,8 +194,8 @@ void editor_register_fonts(const Ref &p_theme) {
default_font->set_fallbacks(fallbacks);
default_font_msdf->set_fallbacks(fallbacks);
- Ref default_font_bold = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false);
- Ref default_font_bold_msdf = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
+ Ref default_font_bold = load_internal_font(_font_Inter_Bold, _font_Inter_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false);
+ Ref default_font_bold_msdf = load_internal_font(_font_Inter_Bold, _font_Inter_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
TypedArray fallbacks_bold;
Ref arabic_font_bold = load_internal_font(_font_Vazirmatn_Bold, _font_Vazirmatn_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
@@ -246,6 +251,7 @@ void editor_register_fonts(const Ref &p_theme) {
default_fc->set_base_font(custom_font);
} else {
EditorSettings::get_singleton()->set_manually("interface/editor/main_font", "");
+ default_fc->set_opentype_features(default_features);
default_fc->set_base_font(default_font);
}
default_fc->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
@@ -265,6 +271,7 @@ void editor_register_fonts(const Ref &p_theme) {
default_fc_msdf->set_base_font(custom_font);
} else {
EditorSettings::get_singleton()->set_manually("interface/editor/main_font", "");
+ default_fc_msdf->set_opentype_features(default_features);
default_fc_msdf->set_base_font(default_font_msdf);
}
default_fc_msdf->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
@@ -292,6 +299,7 @@ void editor_register_fonts(const Ref &p_theme) {
}
} else {
EditorSettings::get_singleton()->set_manually("interface/editor/main_font_bold", "");
+ bold_fc->set_opentype_features(default_features);
bold_fc->set_base_font(default_font_bold);
}
bold_fc->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
@@ -321,6 +329,7 @@ void editor_register_fonts(const Ref &p_theme) {
}
} else {
EditorSettings::get_singleton()->set_manually("interface/editor/main_font_bold", "");
+ bold_fc_msdf->set_opentype_features(default_features);
bold_fc_msdf->set_base_font(default_font_bold_msdf);
}
bold_fc_msdf->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
diff --git a/tests/scene/test_fontfile.h b/tests/scene/test_fontfile.h
index 27b1baf4149..c9e57e8eb5d 100644
--- a/tests/scene/test_fontfile.h
+++ b/tests/scene/test_fontfile.h
@@ -101,13 +101,13 @@ TEST_CASE("[FontFile] Create font file and check data") {
ERR_PRINT_ON
// Load a valid file.
- CHECK(font_file->load_dynamic_font("thirdparty/fonts/NotoSans_Regular.woff2") == OK);
+ CHECK(font_file->load_dynamic_font("thirdparty/fonts/Inter_Regular.woff2") == OK);
// Check fontfile data.
CHECK_MESSAGE(font_file->get_data().is_empty() == false, "Fontfile should have been loaded.");
- CHECK_MESSAGE(font_file->get_font_name() == "Noto Sans", "Loaded correct font name.");
+ CHECK_MESSAGE(font_file->get_font_name() == "Inter", "Loaded correct font name.");
CHECK_MESSAGE(font_file->get_font_style_name() == "Regular", "Loaded correct font style.");
- CHECK_MESSAGE(font_file->get_data().size() == 148480llu, "Whole fontfile was loaded.");
+ CHECK_MESSAGE(font_file->get_data().size() == 111268llu, "Whole fontfile was loaded.");
// Valid glyphs.
CHECK_MESSAGE(font_file->get_glyph_index(2, 'a', 0) != 0, "Glyph index for 'a' is valid.");
diff --git a/tests/servers/test_text_server.h b/tests/servers/test_text_server.h
index f386a375249..f88be65b47d 100644
--- a/tests/servers/test_text_server.h
+++ b/tests/servers/test_text_server.h
@@ -50,7 +50,7 @@ TEST_SUITE("[TextServer]") {
}
RID font = ts->create_font();
- ts->font_set_data_ptr(font, _font_NotoSans_Regular, _font_NotoSans_Regular_size);
+ ts->font_set_data_ptr(font, _font_Inter_Regular, _font_Inter_Regular_size);
CHECK_FALSE_MESSAGE(font == RID(), "Loading font failed.");
ts->free_rid(font);
}
@@ -66,7 +66,7 @@ TEST_SUITE("[TextServer]") {
}
RID font1 = ts->create_font();
- ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size);
+ ts->font_set_data_ptr(font1, _font_Inter_Regular, _font_Inter_Regular_size);
ts->font_set_allow_system_fallback(font1, false);
RID font2 = ts->create_font();
ts->font_set_data_ptr(font2, _font_NotoSansThai_Regular, _font_NotoSansThai_Regular_size);
@@ -118,7 +118,7 @@ TEST_SUITE("[TextServer]") {
}
RID font1 = ts->create_font();
- ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size);
+ ts->font_set_data_ptr(font1, _font_Inter_Regular, _font_Inter_Regular_size);
RID font2 = ts->create_font();
ts->font_set_data_ptr(font2, _font_Vazirmatn_Regular, _font_Vazirmatn_Regular_size);
@@ -167,7 +167,7 @@ TEST_SUITE("[TextServer]") {
}
RID font1 = ts->create_font();
- ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size);
+ ts->font_set_data_ptr(font1, _font_Inter_Regular, _font_Inter_Regular_size);
ts->font_set_allow_system_fallback(font1, false);
RID font2 = ts->create_font();
ts->font_set_data_ptr(font2, _font_NotoSansThai_Regular, _font_NotoSansThai_Regular_size);
@@ -565,7 +565,7 @@ TEST_SUITE("[TextServer]") {
// 5^ 10^
RID font1 = ts->create_font();
- ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size);
+ ts->font_set_data_ptr(font1, _font_Inter_Regular, _font_Inter_Regular_size);
RID font2 = ts->create_font();
ts->font_set_data_ptr(font2, _font_NotoSansThai_Regular, _font_NotoSansThai_Regular_size);
@@ -620,7 +620,7 @@ TEST_SUITE("[TextServer]") {
}
RID font1 = ts->create_font();
- ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size);
+ ts->font_set_data_ptr(font1, _font_Inter_Regular, _font_Inter_Regular_size);
RID font2 = ts->create_font();
ts->font_set_data_ptr(font2, _font_Vazirmatn_Regular, _font_Vazirmatn_Regular_size);
@@ -931,7 +931,7 @@ TEST_SUITE("[TextServer]") {
}
RID font1 = ts->create_font();
- ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size);
+ ts->font_set_data_ptr(font1, _font_Inter_Regular, _font_Inter_Regular_size);
Array font = { font1 };
RID ctx = ts->create_shaped_text();
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 49c24897ca2..b0db7affd7d 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -274,14 +274,14 @@ Patches:
* Upstream: https://android.googlesource.com/platform/frameworks/base/+/master/data/fonts/
* Version: ? (pre-2014 commit when DroidSansJapanese.ttf was obsoleted)
* License: Apache 2.0
+- `Inter*.woff2`:
+ * Upstream: https://github.com/rsms/inter
+ * Version: v4.1 (e3a3d4c57d5ecc01453a575621882a384c1995a3, 2024)
+ * License: OFL-1.1
- `JetBrainsMono_Regular.woff2`:
* Upstream: https://github.com/JetBrains/JetBrainsMono
* Version: 2.304 (cd5227bd1f61dff3bbd6c814ceaf7ffd95e947d9, 2023)
* License: OFL-1.1
-- `NotoSans*.woff2`:
- * Upstream: https://github.com/notofonts/latin-greek-cyrillic
- * Version: 2.012 (9ea0c8d37bff0c0067b03777f40aa04f2bf78f99, 2023)
- * License: OFL-1.1
- `NotoSansBengali*.woff2`:
* Upstream: https://github.com/notofonts/bengali
* Version: 2.003 (020a5701f6fc6a363d5eccbae45e37714c0ad686, 2022)
diff --git a/thirdparty/fonts/Inter_Bold.woff2 b/thirdparty/fonts/Inter_Bold.woff2
new file mode 100644
index 00000000000..b9e3cb3b1fd
Binary files /dev/null and b/thirdparty/fonts/Inter_Bold.woff2 differ
diff --git a/thirdparty/fonts/Inter_Regular.woff2 b/thirdparty/fonts/Inter_Regular.woff2
new file mode 100644
index 00000000000..2bcd222ecfa
Binary files /dev/null and b/thirdparty/fonts/Inter_Regular.woff2 differ
diff --git a/thirdparty/fonts/LICENSE.Inter.txt b/thirdparty/fonts/LICENSE.Inter.txt
new file mode 100644
index 00000000000..9b2ca37b3ff
--- /dev/null
+++ b/thirdparty/fonts/LICENSE.Inter.txt
@@ -0,0 +1,92 @@
+Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION AND CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/thirdparty/fonts/NotoSans_Bold.woff2 b/thirdparty/fonts/NotoSans_Bold.woff2
deleted file mode 100644
index 09a3297a6a2..00000000000
Binary files a/thirdparty/fonts/NotoSans_Bold.woff2 and /dev/null differ
diff --git a/thirdparty/fonts/NotoSans_Regular.woff2 b/thirdparty/fonts/NotoSans_Regular.woff2
deleted file mode 100644
index 59c252ede18..00000000000
Binary files a/thirdparty/fonts/NotoSans_Regular.woff2 and /dev/null differ