2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* editor_fonts.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
2021-01-01 20:13:46 +01:00
|
|
|
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 02:10:30 +01:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2015-04-18 19:38:54 +02:00
|
|
|
#include "editor_fonts.h"
|
2017-01-16 08:04:19 +01:00
|
|
|
|
2017-06-23 17:03:41 +02:00
|
|
|
#include "builtin_fonts.gen.h"
|
2021-06-11 14:51:48 +02:00
|
|
|
#include "core/io/dir_access.h"
|
2016-05-30 05:28:29 +02:00
|
|
|
#include "editor_scale.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "editor_settings.h"
|
2016-05-30 05:28:29 +02:00
|
|
|
#include "scene/resources/default_theme/default_theme.h"
|
2020-09-03 13:22:16 +02:00
|
|
|
#include "scene/resources/font.h"
|
|
|
|
|
|
|
|
#define MAKE_FALLBACKS(m_name) \
|
|
|
|
m_name->add_data(FontArabic); \
|
|
|
|
m_name->add_data(FontBengali); \
|
|
|
|
m_name->add_data(FontGeorgian); \
|
|
|
|
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);
|
2017-08-31 14:49:48 +02:00
|
|
|
|
2017-09-03 08:49:31 +02:00
|
|
|
// the custom spacings might only work with Noto Sans
|
2020-09-03 13:22:16 +02:00
|
|
|
#define MAKE_DEFAULT_FONT(m_name) \
|
|
|
|
Ref<Font> m_name; \
|
|
|
|
m_name.instance(); \
|
|
|
|
if (CustomFont.is_valid()) { \
|
|
|
|
m_name->add_data(CustomFont); \
|
|
|
|
m_name->add_data(DefaultFont); \
|
|
|
|
} else { \
|
|
|
|
m_name->add_data(DefaultFont); \
|
|
|
|
} \
|
|
|
|
m_name->set_spacing(Font::SPACING_TOP, -EDSCALE); \
|
|
|
|
m_name->set_spacing(Font::SPACING_BOTTOM, -EDSCALE); \
|
2016-05-31 08:06:40 +02:00
|
|
|
MAKE_FALLBACKS(m_name);
|
2016-05-31 00:41:32 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
#define MAKE_BOLD_FONT(m_name) \
|
|
|
|
Ref<Font> m_name; \
|
|
|
|
m_name.instance(); \
|
|
|
|
if (CustomFontBold.is_valid()) { \
|
|
|
|
m_name->add_data(CustomFontBold); \
|
|
|
|
m_name->add_data(DefaultFontBold); \
|
|
|
|
} else { \
|
|
|
|
m_name->add_data(DefaultFontBold); \
|
|
|
|
} \
|
|
|
|
m_name->set_spacing(Font::SPACING_TOP, -EDSCALE); \
|
|
|
|
m_name->set_spacing(Font::SPACING_BOTTOM, -EDSCALE); \
|
2018-04-10 17:26:26 +02:00
|
|
|
MAKE_FALLBACKS(m_name);
|
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
#define MAKE_SOURCE_FONT(m_name) \
|
|
|
|
Ref<Font> m_name; \
|
|
|
|
m_name.instance(); \
|
|
|
|
if (CustomFontSource.is_valid()) { \
|
|
|
|
m_name->add_data(CustomFontSource); \
|
|
|
|
m_name->add_data(dfmono); \
|
|
|
|
} else { \
|
|
|
|
m_name->add_data(dfmono); \
|
|
|
|
} \
|
|
|
|
m_name->set_spacing(Font::SPACING_TOP, -EDSCALE); \
|
|
|
|
m_name->set_spacing(Font::SPACING_BOTTOM, -EDSCALE); \
|
2018-01-07 20:07:47 +01:00
|
|
|
MAKE_FALLBACKS(m_name);
|
|
|
|
|
2015-04-18 19:38:54 +02:00
|
|
|
void editor_register_fonts(Ref<Theme> p_theme) {
|
2018-07-03 15:37:07 +02:00
|
|
|
DirAccess *dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
|
|
|
|
2017-12-26 19:14:48 +01:00
|
|
|
/* Custom font */
|
|
|
|
|
2019-07-28 01:10:51 +02:00
|
|
|
bool font_antialiased = (bool)EditorSettings::get_singleton()->get("interface/editor/font_antialiased");
|
2019-08-14 14:51:13 +02:00
|
|
|
int font_hinting_setting = (int)EditorSettings::get_singleton()->get("interface/editor/font_hinting");
|
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
TextServer::Hinting font_hinting;
|
2019-08-14 14:51:13 +02:00
|
|
|
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
|
2020-09-03 13:22:16 +02:00
|
|
|
font_hinting = TextServer::HINTING_NONE;
|
2019-08-14 14:51:13 +02:00
|
|
|
#else
|
2020-09-03 13:22:16 +02:00
|
|
|
font_hinting = TextServer::HINTING_LIGHT;
|
2019-08-14 14:51:13 +02:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case 1:
|
2020-09-03 13:22:16 +02:00
|
|
|
font_hinting = TextServer::HINTING_NONE;
|
2019-08-14 14:51:13 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2020-09-03 13:22:16 +02:00
|
|
|
font_hinting = TextServer::HINTING_LIGHT;
|
2019-08-14 14:51:13 +02:00
|
|
|
break;
|
|
|
|
default:
|
2020-09-03 13:22:16 +02:00
|
|
|
font_hinting = TextServer::HINTING_NORMAL;
|
2019-08-14 14:51:13 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-04-10 17:26:26 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE;
|
|
|
|
|
2018-04-10 17:26:26 +02:00
|
|
|
String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font");
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> CustomFont;
|
2018-07-03 15:37:07 +02:00
|
|
|
if (custom_font_path.length() > 0 && dir->file_exists(custom_font_path)) {
|
2017-12-26 19:14:48 +01:00
|
|
|
CustomFont.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
CustomFont->load_resource(custom_font_path, default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
CustomFont->set_antialiased(font_antialiased);
|
2018-02-27 15:04:08 +01:00
|
|
|
CustomFont->set_hinting(font_hinting);
|
2017-12-26 19:14:48 +01:00
|
|
|
CustomFont->set_force_autohinter(true); //just looks better..i think?
|
2018-07-03 15:37:07 +02:00
|
|
|
} else {
|
|
|
|
EditorSettings::get_singleton()->set_manually("interface/editor/main_font", "");
|
2017-12-26 19:14:48 +01:00
|
|
|
}
|
|
|
|
|
2018-04-10 17:26:26 +02:00
|
|
|
/* Custom Bold font */
|
|
|
|
|
|
|
|
String custom_font_path_bold = EditorSettings::get_singleton()->get("interface/editor/main_font_bold");
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> CustomFontBold;
|
2018-07-03 15:37:07 +02:00
|
|
|
if (custom_font_path_bold.length() > 0 && dir->file_exists(custom_font_path_bold)) {
|
2018-04-10 17:26:26 +02:00
|
|
|
CustomFontBold.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
CustomFontBold->load_resource(custom_font_path_bold, default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
CustomFontBold->set_antialiased(font_antialiased);
|
2018-04-10 17:26:26 +02:00
|
|
|
CustomFontBold->set_hinting(font_hinting);
|
|
|
|
CustomFontBold->set_force_autohinter(true); //just looks better..i think?
|
2018-07-03 15:37:07 +02:00
|
|
|
} else {
|
|
|
|
EditorSettings::get_singleton()->set_manually("interface/editor/main_font_bold", "");
|
2018-04-10 17:26:26 +02:00
|
|
|
}
|
|
|
|
|
2018-01-07 20:07:47 +01:00
|
|
|
/* Custom source code font */
|
|
|
|
|
2018-04-10 17:26:26 +02:00
|
|
|
String custom_font_path_source = EditorSettings::get_singleton()->get("interface/editor/code_font");
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> CustomFontSource;
|
2018-07-03 15:37:07 +02:00
|
|
|
if (custom_font_path_source.length() > 0 && dir->file_exists(custom_font_path_source)) {
|
2018-01-07 20:07:47 +01:00
|
|
|
CustomFontSource.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
CustomFontSource->load_resource(custom_font_path_source, default_font_size);
|
2019-07-28 01:10:51 +02:00
|
|
|
CustomFontSource->set_antialiased(font_antialiased);
|
|
|
|
CustomFontSource->set_hinting(font_hinting);
|
2020-10-22 18:40:18 +02:00
|
|
|
|
|
|
|
Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_variations")).split(",");
|
|
|
|
for (int i = 0; i < subtag.size(); i++) {
|
|
|
|
Vector<String> subtag_a = subtag[i].split("=");
|
|
|
|
if (subtag_a.size() == 2) {
|
|
|
|
CustomFontSource->set_variation(subtag_a[0], subtag_a[1].to_float());
|
|
|
|
}
|
|
|
|
}
|
2018-07-03 15:37:07 +02:00
|
|
|
} else {
|
|
|
|
EditorSettings::get_singleton()->set_manually("interface/editor/code_font", "");
|
2018-01-07 20:07:47 +01:00
|
|
|
}
|
|
|
|
|
2018-07-03 15:37:07 +02:00
|
|
|
memdelete(dir);
|
|
|
|
|
2016-05-31 00:41:32 +02:00
|
|
|
/* Droid Sans */
|
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> DefaultFont;
|
2017-08-31 14:49:48 +02:00
|
|
|
DefaultFont.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
DefaultFont->load_memory(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size, "ttf", default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
DefaultFont->set_antialiased(font_antialiased);
|
2018-02-27 15:04:08 +01:00
|
|
|
DefaultFont->set_hinting(font_hinting);
|
2017-08-31 14:49:48 +02:00
|
|
|
DefaultFont->set_force_autohinter(true); //just looks better..i think?
|
2016-05-31 00:41:32 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> DefaultFontBold;
|
2018-04-10 17:26:26 +02:00
|
|
|
DefaultFontBold.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
DefaultFontBold->load_memory(_font_NotoSansUI_Bold, _font_NotoSansUI_Bold_size, "ttf", default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
DefaultFontBold->set_antialiased(font_antialiased);
|
|
|
|
DefaultFontBold->set_hinting(font_hinting);
|
2018-04-10 17:26:26 +02:00
|
|
|
DefaultFontBold->set_force_autohinter(true); // just looks better..i think?
|
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> FontFallback;
|
2017-08-31 14:49:48 +02:00
|
|
|
FontFallback.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
FontFallback->load_memory(_font_DroidSansFallback, _font_DroidSansFallback_size, "ttf", default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
FontFallback->set_antialiased(font_antialiased);
|
2018-02-27 15:04:08 +01:00
|
|
|
FontFallback->set_hinting(font_hinting);
|
2017-08-31 14:49:48 +02:00
|
|
|
FontFallback->set_force_autohinter(true); //just looks better..i think?
|
2016-05-31 00:41:32 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> FontJapanese;
|
2017-08-31 14:49:48 +02:00
|
|
|
FontJapanese.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
FontJapanese->load_memory(_font_DroidSansJapanese, _font_DroidSansJapanese_size, "ttf", default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
FontJapanese->set_antialiased(font_antialiased);
|
2018-02-27 15:04:08 +01:00
|
|
|
FontJapanese->set_hinting(font_hinting);
|
2017-08-31 14:49:48 +02:00
|
|
|
FontJapanese->set_force_autohinter(true); //just looks better..i think?
|
2016-05-31 00:41:32 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> FontArabic;
|
2017-08-31 14:49:48 +02:00
|
|
|
FontArabic.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
FontArabic->load_memory(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size, "ttf", default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
FontArabic->set_antialiased(font_antialiased);
|
2018-02-27 15:04:08 +01:00
|
|
|
FontArabic->set_hinting(font_hinting);
|
2017-08-31 14:49:48 +02:00
|
|
|
FontArabic->set_force_autohinter(true); //just looks better..i think?
|
2016-05-31 00:41:32 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> FontBengali;
|
|
|
|
FontBengali.instance();
|
|
|
|
FontBengali->load_memory(_font_NotoSansBengali_Regular, _font_NotoSansBengali_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> FontGeorgian;
|
|
|
|
FontGeorgian.instance();
|
|
|
|
FontGeorgian->load_memory(_font_NotoSansGeorgian_Regular, _font_NotoSansGeorgian_Regular_size, "ttf", default_font_size);
|
|
|
|
FontGeorgian->set_antialiased(font_antialiased);
|
|
|
|
FontGeorgian->set_hinting(font_hinting);
|
|
|
|
FontGeorgian->set_force_autohinter(true); //just looks better..i think?
|
|
|
|
|
|
|
|
Ref<FontData> FontHebrew;
|
2017-08-31 14:49:48 +02:00
|
|
|
FontHebrew.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
FontHebrew->load_memory(_font_NotoSansHebrew_Regular, _font_NotoSansHebrew_Regular_size, "ttf", default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
FontHebrew->set_antialiased(font_antialiased);
|
2018-02-27 15:04:08 +01:00
|
|
|
FontHebrew->set_hinting(font_hinting);
|
2017-08-31 14:49:48 +02:00
|
|
|
FontHebrew->set_force_autohinter(true); //just looks better..i think?
|
2016-05-31 00:41:32 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> FontMalayalam;
|
|
|
|
FontMalayalam.instance();
|
|
|
|
FontMalayalam->load_memory(_font_NotoSansMalayalamUI_Regular, _font_NotoSansMalayalamUI_Regular_size, "ttf", default_font_size);
|
|
|
|
FontMalayalam->set_antialiased(font_antialiased);
|
|
|
|
FontMalayalam->set_hinting(font_hinting);
|
|
|
|
FontMalayalam->set_force_autohinter(true); //just looks better..i think?
|
|
|
|
|
|
|
|
Ref<FontData> FontOriya;
|
|
|
|
FontOriya.instance();
|
|
|
|
FontOriya->load_memory(_font_NotoSansOriyaUI_Regular, _font_NotoSansOriyaUI_Regular_size, "ttf", default_font_size);
|
|
|
|
FontOriya->set_antialiased(font_antialiased);
|
|
|
|
FontOriya->set_hinting(font_hinting);
|
|
|
|
FontOriya->set_force_autohinter(true); //just looks better..i think?
|
|
|
|
|
|
|
|
Ref<FontData> FontSinhala;
|
|
|
|
FontSinhala.instance();
|
|
|
|
FontSinhala->load_memory(_font_NotoSansSinhalaUI_Regular, _font_NotoSansSinhalaUI_Regular_size, "ttf", default_font_size);
|
|
|
|
FontSinhala->set_antialiased(font_antialiased);
|
|
|
|
FontSinhala->set_hinting(font_hinting);
|
|
|
|
FontSinhala->set_force_autohinter(true); //just looks better..i think?
|
|
|
|
|
|
|
|
Ref<FontData> FontTamil;
|
|
|
|
FontTamil.instance();
|
|
|
|
FontTamil->load_memory(_font_NotoSansTamilUI_Regular, _font_NotoSansTamilUI_Regular_size, "ttf", default_font_size);
|
|
|
|
FontTamil->set_antialiased(font_antialiased);
|
|
|
|
FontTamil->set_hinting(font_hinting);
|
|
|
|
FontTamil->set_force_autohinter(true); //just looks better..i think?
|
|
|
|
|
|
|
|
Ref<FontData> FontTelugu;
|
|
|
|
FontTelugu.instance();
|
|
|
|
FontTelugu->load_memory(_font_NotoSansTeluguUI_Regular, _font_NotoSansTeluguUI_Regular_size, "ttf", default_font_size);
|
|
|
|
FontTelugu->set_antialiased(font_antialiased);
|
|
|
|
FontTelugu->set_hinting(font_hinting);
|
|
|
|
FontTelugu->set_force_autohinter(true); //just looks better..i think?
|
|
|
|
|
|
|
|
Ref<FontData> FontThai;
|
2017-08-31 14:49:48 +02:00
|
|
|
FontThai.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
FontThai->load_memory(_font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size, "ttf", default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
FontThai->set_antialiased(font_antialiased);
|
2018-02-27 15:04:08 +01:00
|
|
|
FontThai->set_hinting(font_hinting);
|
2017-08-31 14:49:48 +02:00
|
|
|
FontThai->set_force_autohinter(true); //just looks better..i think?
|
2016-05-31 00:41:32 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> FontHindi;
|
2018-08-29 22:11:09 +02:00
|
|
|
FontHindi.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
FontHindi->load_memory(_font_NotoSansDevanagariUI_Regular, _font_NotoSansDevanagariUI_Regular_size, "ttf", default_font_size);
|
2018-11-10 22:07:32 +01:00
|
|
|
FontHindi->set_antialiased(font_antialiased);
|
2018-08-29 22:11:09 +02:00
|
|
|
FontHindi->set_hinting(font_hinting);
|
|
|
|
FontHindi->set_force_autohinter(true); //just looks better..i think?
|
|
|
|
|
2018-02-27 15:04:08 +01:00
|
|
|
/* Hack */
|
2015-04-18 19:38:54 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
Ref<FontData> dfmono;
|
2016-05-29 16:37:26 +02:00
|
|
|
dfmono.instance();
|
2020-09-03 13:22:16 +02:00
|
|
|
dfmono->load_memory(_font_Hack_Regular, _font_Hack_Regular_size, "ttf", default_font_size);
|
2019-07-28 01:10:51 +02:00
|
|
|
dfmono->set_antialiased(font_antialiased);
|
|
|
|
dfmono->set_hinting(font_hinting);
|
2016-05-29 16:37:26 +02:00
|
|
|
|
2020-10-22 18:40:18 +02:00
|
|
|
Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_variations")).split(",");
|
|
|
|
Dictionary ftrs;
|
|
|
|
for (int i = 0; i < subtag.size(); i++) {
|
|
|
|
Vector<String> subtag_a = subtag[i].split("=");
|
|
|
|
if (subtag_a.size() == 2) {
|
|
|
|
dfmono->set_variation(subtag_a[0], subtag_a[1].to_float());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-10 17:26:26 +02:00
|
|
|
// Default font
|
2020-09-03 13:22:16 +02:00
|
|
|
MAKE_DEFAULT_FONT(df);
|
|
|
|
p_theme->set_default_theme_font(df); // Default theme font
|
|
|
|
p_theme->set_default_theme_font_size(default_font_size);
|
|
|
|
|
|
|
|
p_theme->set_font_size("main_size", "EditorFonts", default_font_size);
|
2019-10-03 20:30:33 +02:00
|
|
|
p_theme->set_font("main", "EditorFonts", df);
|
2016-05-29 16:37:26 +02:00
|
|
|
|
2018-04-10 17:26:26 +02:00
|
|
|
// Bold font
|
2020-09-03 13:22:16 +02:00
|
|
|
MAKE_BOLD_FONT(df_bold);
|
|
|
|
p_theme->set_font_size("bold_size", "EditorFonts", default_font_size);
|
2018-04-10 17:26:26 +02:00
|
|
|
p_theme->set_font("bold", "EditorFonts", df_bold);
|
|
|
|
|
|
|
|
// Title font
|
2021-05-27 17:32:30 +02:00
|
|
|
p_theme->set_font_size("title_size", "EditorFonts", default_font_size + 1 * EDSCALE);
|
2020-09-03 13:22:16 +02:00
|
|
|
p_theme->set_font("title", "EditorFonts", df_bold);
|
2017-11-10 02:36:19 +01:00
|
|
|
|
2021-05-27 17:32:30 +02:00
|
|
|
p_theme->set_font_size("main_button_font_size", "EditorFonts", default_font_size + 1 * EDSCALE);
|
|
|
|
p_theme->set_font("main_button_font", "EditorFonts", df_bold);
|
|
|
|
|
|
|
|
p_theme->set_font("font", "Label", df_bold);
|
|
|
|
|
2019-06-15 18:18:32 +02:00
|
|
|
// Documentation fonts
|
2020-09-03 13:22:16 +02:00
|
|
|
MAKE_SOURCE_FONT(df_code);
|
|
|
|
p_theme->set_font_size("doc_size", "EditorFonts", int(EDITOR_GET("text_editor/help/help_font_size")) * EDSCALE);
|
|
|
|
p_theme->set_font("doc", "EditorFonts", df);
|
|
|
|
p_theme->set_font_size("doc_bold_size", "EditorFonts", int(EDITOR_GET("text_editor/help/help_font_size")) * EDSCALE);
|
|
|
|
p_theme->set_font("doc_bold", "EditorFonts", df_bold);
|
|
|
|
p_theme->set_font_size("doc_title_size", "EditorFonts", int(EDITOR_GET("text_editor/help/help_title_font_size")) * EDSCALE);
|
|
|
|
p_theme->set_font("doc_title", "EditorFonts", df_bold);
|
|
|
|
p_theme->set_font_size("doc_source_size", "EditorFonts", int(EDITOR_GET("text_editor/help/help_source_font_size")) * EDSCALE);
|
|
|
|
p_theme->set_font("doc_source", "EditorFonts", df_code);
|
|
|
|
p_theme->set_font_size("doc_keyboard_size", "EditorFonts", (int(EDITOR_GET("text_editor/help/help_source_font_size")) - 1) * EDSCALE);
|
|
|
|
p_theme->set_font("doc_keyboard", "EditorFonts", df_code);
|
2018-04-10 17:26:26 +02:00
|
|
|
|
|
|
|
// Ruler font
|
2020-09-03 13:22:16 +02:00
|
|
|
p_theme->set_font_size("rulers_size", "EditorFonts", 8 * EDSCALE);
|
|
|
|
p_theme->set_font("rulers", "EditorFonts", df);
|
2017-08-29 21:50:18 +02:00
|
|
|
|
2019-10-23 11:46:26 +02:00
|
|
|
// Rotation widget font
|
2020-09-03 13:22:16 +02:00
|
|
|
p_theme->set_font_size("rotation_control_size", "EditorFonts", 14 * EDSCALE);
|
|
|
|
p_theme->set_font("rotation_control", "EditorFonts", df);
|
2019-10-23 11:46:26 +02:00
|
|
|
|
2018-04-10 17:26:26 +02:00
|
|
|
// Code font
|
2020-09-03 13:22:16 +02:00
|
|
|
p_theme->set_font_size("source_size", "EditorFonts", int(EDITOR_GET("interface/editor/code_font_size")) * EDSCALE);
|
2017-03-05 16:44:50 +01:00
|
|
|
p_theme->set_font("source", "EditorFonts", df_code);
|
2016-05-29 16:37:26 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
p_theme->set_font_size("expression_size", "EditorFonts", (int(EDITOR_GET("interface/editor/code_font_size")) - 1) * EDSCALE);
|
|
|
|
p_theme->set_font("expression", "EditorFonts", df_code);
|
2019-05-12 14:09:39 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
p_theme->set_font_size("output_source_size", "EditorFonts", int(EDITOR_GET("run/output/font_size")) * EDSCALE);
|
|
|
|
p_theme->set_font("output_source", "EditorFonts", df_code);
|
2017-09-25 16:12:17 +02:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
p_theme->set_font_size("status_source_size", "EditorFonts", default_font_size);
|
|
|
|
p_theme->set_font("status_source", "EditorFonts", df_code);
|
2015-04-18 19:38:54 +02:00
|
|
|
}
|