summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2018-02-27 15:04:08 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2018-02-28 00:12:26 +0100
commitc1544c12efe72dd584429e115ff484428f27e759 (patch)
tree5384cd48ca15591c6cc3ff64910df37751bae6bb /editor
parent636e48b707e0b3d062ca073b92e2fff47460baf5 (diff)
Add an hinting mode setting to DynamicFonts
- Editor font hinting can now be tweaked in the Editor Settings. - DynamicFonts used in projects now have tweakable hinting settings in their DynamicFontData child. Changes will be visible upon reloading the scene in the editor.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_fonts.cpp13
-rw-r--r--editor/editor_settings.cpp4
2 files changed, 16 insertions, 1 deletions
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index a58257962a..2ec3cdb08f 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -103,9 +103,11 @@ void editor_register_fonts(Ref<Theme> p_theme) {
/* Custom font */
String custom_font = EditorSettings::get_singleton()->get("interface/editor/main_font");
+ DynamicFontData::Hinting font_hinting = (DynamicFontData::Hinting)(int)EditorSettings::get_singleton()->get("interface/editor/main_font_hinting");
Ref<DynamicFontData> CustomFont;
if (custom_font.length() > 0) {
CustomFont.instance();
+ CustomFont->set_hinting(font_hinting);
CustomFont->set_font_path(custom_font);
CustomFont->set_force_autohinter(true); //just looks better..i think?
}
@@ -113,9 +115,11 @@ void editor_register_fonts(Ref<Theme> p_theme) {
/* Custom source code font */
String custom_font_source = EditorSettings::get_singleton()->get("interface/editor/code_font");
+ DynamicFontData::Hinting font_source_hinting = (DynamicFontData::Hinting)(int)EditorSettings::get_singleton()->get("interface/editor/code_font_hinting");
Ref<DynamicFontData> CustomFontSource;
if (custom_font_source.length() > 0) {
CustomFontSource.instance();
+ CustomFontSource->set_hinting(font_source_hinting);
CustomFontSource->set_font_path(custom_font_source);
}
@@ -123,38 +127,45 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<DynamicFontData> DefaultFont;
DefaultFont.instance();
+ DefaultFont->set_hinting(font_hinting);
DefaultFont->set_font_ptr(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size);
DefaultFont->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontFallback;
FontFallback.instance();
+ FontFallback->set_hinting(font_hinting);
FontFallback->set_font_ptr(_font_DroidSansFallback, _font_DroidSansFallback_size);
FontFallback->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontJapanese;
FontJapanese.instance();
+ FontJapanese->set_hinting(font_hinting);
FontJapanese->set_font_ptr(_font_DroidSansJapanese, _font_DroidSansJapanese_size);
FontJapanese->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontArabic;
FontArabic.instance();
+ FontArabic->set_hinting(font_hinting);
FontArabic->set_font_ptr(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size);
FontArabic->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontHebrew;
FontHebrew.instance();
+ FontHebrew->set_hinting(font_hinting);
FontHebrew->set_font_ptr(_font_NotoSansHebrew_Regular, _font_NotoSansHebrew_Regular_size);
FontHebrew->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontThai;
FontThai.instance();
+ FontThai->set_hinting(font_hinting);
FontThai->set_font_ptr(_font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size);
FontThai->set_force_autohinter(true); //just looks better..i think?
- /* Source Code Pro */
+ /* Hack */
Ref<DynamicFontData> dfmono;
dfmono.instance();
+ dfmono->set_hinting(font_source_hinting);
dfmono->set_font_ptr(_font_Hack_Regular, _font_Hack_Regular_size);
//dfd->set_force_autohinter(true); //just looks better..i think?
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 29363e29c1..905ee81ec8 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -290,6 +290,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/editor/main_font_size"] = PropertyInfo(Variant::INT, "interface/editor/main_font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_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,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/main_font_hinting", 2);
+ hints["interface/editor/main_font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/main_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/code_font_hinting", 2);
+ hints["interface/editor/code_font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/code_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_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 | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/code_font", "");