summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/editor_fonts.cpp26
-rw-r--r--editor/editor_settings.cpp4
2 files changed, 27 insertions, 3 deletions
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 73438ffc0c..55cae35a4a 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -94,7 +94,31 @@ void editor_register_fonts(Ref<Theme> p_theme) {
/* Custom font */
bool font_antialiased = (bool)EditorSettings::get_singleton()->get("interface/editor/font_antialiased");
- DynamicFontData::Hinting font_hinting = (DynamicFontData::Hinting)(int)EditorSettings::get_singleton()->get("interface/editor/font_hinting");
+ int font_hinting_setting = (int)EditorSettings::get_singleton()->get("interface/editor/font_hinting");
+
+ DynamicFontData::Hinting font_hinting;
+ switch (font_hinting_setting) {
+ case 0:
+ // The "Auto" setting uses the setting that best matches the OS' font rendering:
+ // - macOS doesn't use font hinting.
+ // - Windows uses ClearType, which is in between "Light" and "Normal" hinting.
+ // - Linux has configurable font hinting, but most distributions including Ubuntu default to "Light".
+#ifdef OSX_ENABLED
+ font_hinting = DynamicFontData::HINTING_NONE;
+#else
+ font_hinting = DynamicFontData::HINTING_LIGHT;
+#endif
+ break;
+ case 1:
+ font_hinting = DynamicFontData::HINTING_NONE;
+ break;
+ case 2:
+ font_hinting = DynamicFontData::HINTING_LIGHT;
+ break;
+ default:
+ font_hinting = DynamicFontData::HINTING_NORMAL;
+ break;
+ }
String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font");
Ref<DynamicFontData> CustomFont;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index e3f2a888d6..2d2e53370d 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -324,8 +324,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/editor/code_font_size", 14);
hints["interface/editor/code_font_size"] = PropertyInfo(Variant::INT, "interface/editor/code_font_size", PROPERTY_HINT_RANGE, "8,48,1", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/font_antialiased", true);
- _initial_set("interface/editor/font_hinting", 2);
- hints["interface/editor/font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT);
+ _initial_set("interface/editor/font_hinting", 0);
+ hints["interface/editor/font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/font_hinting", PROPERTY_HINT_ENUM, "Auto,None,Light,Normal", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/main_font", "");
hints["interface/editor/main_font"] = PropertyInfo(Variant::STRING, "interface/editor/main_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/main_font_bold", "");