2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* editor_fonts.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
2022-01-03 20:27:34 +00:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 01:10:30 +00: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-04 23:50:27 +00:00
|
|
|
|
2015-04-18 17:38:54 +00:00
|
|
|
#include "editor_fonts.h"
|
2017-01-16 07:04:19 +00:00
|
|
|
|
2017-06-23 15:03:41 +00:00
|
|
|
#include "builtin_fonts.gen.h"
|
2021-06-11 12:51:48 +00:00
|
|
|
#include "core/io/dir_access.h"
|
2016-05-30 03:28:29 +00:00
|
|
|
#include "editor_scale.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "editor_settings.h"
|
2016-05-30 03:28:29 +00:00
|
|
|
#include "scene/resources/default_theme/default_theme.h"
|
2020-09-03 11:22:16 +00:00
|
|
|
#include "scene/resources/font.h"
|
|
|
|
|
2021-07-19 08:18:52 +00:00
|
|
|
#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(FontThai); \
|
|
|
|
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); \
|
2020-09-03 11:22:16 +00:00
|
|
|
m_name->add_data(FontFallback);
|
2017-08-31 12:49:48 +00:00
|
|
|
|
2021-10-25 08:49:18 +00:00
|
|
|
#define MAKE_DEFAULT_FONT(m_name, m_variations) \
|
2020-12-27 13:30:33 +00:00
|
|
|
Ref<Font> m_name; \
|
|
|
|
m_name.instantiate(); \
|
|
|
|
if (CustomFont.is_valid()) { \
|
|
|
|
m_name->add_data(CustomFont); \
|
|
|
|
m_name->add_data(DefaultFont); \
|
|
|
|
} else { \
|
|
|
|
m_name->add_data(DefaultFont); \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
Dictionary variations; \
|
2021-12-09 09:42:46 +00:00
|
|
|
if (!m_variations.is_empty()) { \
|
2020-12-27 13:30:33 +00:00
|
|
|
Vector<String> variation_tags = m_variations.split(","); \
|
|
|
|
for (int i = 0; i < variation_tags.size(); i++) { \
|
|
|
|
Vector<String> tokens = variation_tags[i].split("="); \
|
|
|
|
if (tokens.size() == 2) { \
|
|
|
|
variations[tokens[0]] = tokens[1].to_float(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
m_name->set_variation_coordinates(variations); \
|
|
|
|
} \
|
|
|
|
m_name->set_spacing(TextServer::SPACING_TOP, -EDSCALE); \
|
|
|
|
m_name->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE); \
|
2016-05-31 06:06:40 +00:00
|
|
|
MAKE_FALLBACKS(m_name);
|
2016-05-30 22:41:32 +00:00
|
|
|
|
2021-10-25 08:49:18 +00:00
|
|
|
#define MAKE_BOLD_FONT(m_name, m_variations) \
|
2020-12-27 13:30:33 +00:00
|
|
|
Ref<Font> m_name; \
|
|
|
|
m_name.instantiate(); \
|
|
|
|
if (CustomFontBold.is_valid()) { \
|
|
|
|
m_name->add_data(CustomFontBold); \
|
|
|
|
m_name->add_data(DefaultFontBold); \
|
|
|
|
} else { \
|
|
|
|
m_name->add_data(DefaultFontBold); \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
Dictionary variations; \
|
2021-12-09 09:42:46 +00:00
|
|
|
if (!m_variations.is_empty()) { \
|
2020-12-27 13:30:33 +00:00
|
|
|
Vector<String> variation_tags = m_variations.split(","); \
|
|
|
|
for (int i = 0; i < variation_tags.size(); i++) { \
|
|
|
|
Vector<String> tokens = variation_tags[i].split("="); \
|
|
|
|
if (tokens.size() == 2) { \
|
|
|
|
variations[tokens[0]] = tokens[1].to_float(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
m_name->set_variation_coordinates(variations); \
|
|
|
|
} \
|
|
|
|
m_name->set_spacing(TextServer::SPACING_TOP, -EDSCALE); \
|
|
|
|
m_name->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE); \
|
2021-07-19 08:18:52 +00:00
|
|
|
MAKE_FALLBACKS_BOLD(m_name);
|
2018-04-10 15:26:26 +00:00
|
|
|
|
2021-10-25 08:49:18 +00:00
|
|
|
#define MAKE_SOURCE_FONT(m_name, m_variations) \
|
2020-12-27 13:30:33 +00:00
|
|
|
Ref<Font> m_name; \
|
|
|
|
m_name.instantiate(); \
|
|
|
|
if (CustomFontSource.is_valid()) { \
|
|
|
|
m_name->add_data(CustomFontSource); \
|
|
|
|
m_name->add_data(dfmono); \
|
|
|
|
} else { \
|
|
|
|
m_name->add_data(dfmono); \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
Dictionary variations; \
|
2021-12-09 09:42:46 +00:00
|
|
|
if (!m_variations.is_empty()) { \
|
2020-12-27 13:30:33 +00:00
|
|
|
Vector<String> variation_tags = m_variations.split(","); \
|
|
|
|
for (int i = 0; i < variation_tags.size(); i++) { \
|
|
|
|
Vector<String> tokens = variation_tags[i].split("="); \
|
|
|
|
if (tokens.size() == 2) { \
|
|
|
|
variations[tokens[0]] = tokens[1].to_float(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
m_name->set_variation_coordinates(variations); \
|
|
|
|
} \
|
|
|
|
m_name->set_spacing(TextServer::SPACING_TOP, -EDSCALE); \
|
|
|
|
m_name->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE); \
|
2018-01-07 19:07:47 +00:00
|
|
|
MAKE_FALLBACKS(m_name);
|
|
|
|
|
2020-12-27 13:30:33 +00:00
|
|
|
Ref<FontData> load_cached_external_font(const String &p_path, TextServer::Hinting p_hinting, bool p_aa, bool p_autohint) {
|
|
|
|
Ref<FontData> font;
|
|
|
|
font.instantiate();
|
|
|
|
|
|
|
|
Vector<uint8_t> data = FileAccess::get_file_as_array(p_path);
|
|
|
|
|
|
|
|
font->set_data(data);
|
|
|
|
font->set_antialiased(p_aa);
|
|
|
|
font->set_hinting(p_hinting);
|
|
|
|
font->set_force_autohinter(p_autohint);
|
|
|
|
|
|
|
|
return font;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<FontData> load_cached_internal_font(const uint8_t *p_data, size_t p_size, TextServer::Hinting p_hinting, bool p_aa, bool p_autohint) {
|
|
|
|
Ref<FontData> font;
|
|
|
|
font.instantiate();
|
|
|
|
|
|
|
|
font->set_data_ptr(p_data, p_size);
|
|
|
|
font->set_antialiased(p_aa);
|
|
|
|
font->set_hinting(p_hinting);
|
|
|
|
font->set_force_autohinter(p_autohint);
|
|
|
|
|
|
|
|
return font;
|
|
|
|
}
|
|
|
|
|
2015-04-18 17:38:54 +00:00
|
|
|
void editor_register_fonts(Ref<Theme> p_theme) {
|
2018-07-03 13:37:07 +00:00
|
|
|
DirAccess *dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
|
|
|
|
2017-12-26 18:14:48 +00:00
|
|
|
/* Custom font */
|
|
|
|
|
2019-07-27 23:10:51 +00:00
|
|
|
bool font_antialiased = (bool)EditorSettings::get_singleton()->get("interface/editor/font_antialiased");
|
2019-08-14 12:51:13 +00:00
|
|
|
int font_hinting_setting = (int)EditorSettings::get_singleton()->get("interface/editor/font_hinting");
|
|
|
|
|
2020-09-03 11:22:16 +00:00
|
|
|
TextServer::Hinting font_hinting;
|
2019-08-14 12:51:13 +00: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 11:22:16 +00:00
|
|
|
font_hinting = TextServer::HINTING_NONE;
|
2019-08-14 12:51:13 +00:00
|
|
|
#else
|
2020-09-03 11:22:16 +00:00
|
|
|
font_hinting = TextServer::HINTING_LIGHT;
|
2019-08-14 12:51:13 +00:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case 1:
|
2020-09-03 11:22:16 +00:00
|
|
|
font_hinting = TextServer::HINTING_NONE;
|
2019-08-14 12:51:13 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2020-09-03 11:22:16 +00:00
|
|
|
font_hinting = TextServer::HINTING_LIGHT;
|
2019-08-14 12:51:13 +00:00
|
|
|
break;
|
|
|
|
default:
|
2020-09-03 11:22:16 +00:00
|
|
|
font_hinting = TextServer::HINTING_NORMAL;
|
2019-08-14 12:51:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2018-04-10 15:26:26 +00:00
|
|
|
|
2020-09-03 11:22:16 +00:00
|
|
|
int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE;
|
|
|
|
|
2018-04-10 15:26:26 +00:00
|
|
|
String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font");
|
2020-09-03 11:22:16 +00:00
|
|
|
Ref<FontData> CustomFont;
|
2018-07-03 13:37:07 +00:00
|
|
|
if (custom_font_path.length() > 0 && dir->file_exists(custom_font_path)) {
|
2020-12-27 13:30:33 +00:00
|
|
|
CustomFont = load_cached_external_font(custom_font_path, font_hinting, font_antialiased, true);
|
2018-07-03 13:37:07 +00:00
|
|
|
} else {
|
|
|
|
EditorSettings::get_singleton()->set_manually("interface/editor/main_font", "");
|
2017-12-26 18:14:48 +00:00
|
|
|
}
|
|
|
|
|
2018-04-10 15:26:26 +00:00
|
|
|
/* Custom Bold font */
|
|
|
|
|
|
|
|
String custom_font_path_bold = EditorSettings::get_singleton()->get("interface/editor/main_font_bold");
|
2020-09-03 11:22:16 +00:00
|
|
|
Ref<FontData> CustomFontBold;
|
2018-07-03 13:37:07 +00:00
|
|
|
if (custom_font_path_bold.length() > 0 && dir->file_exists(custom_font_path_bold)) {
|
2020-12-27 13:30:33 +00:00
|
|
|
CustomFontBold = load_cached_external_font(custom_font_path_bold, font_hinting, font_antialiased, true);
|
2018-07-03 13:37:07 +00:00
|
|
|
} else {
|
|
|
|
EditorSettings::get_singleton()->set_manually("interface/editor/main_font_bold", "");
|
2018-04-10 15:26:26 +00:00
|
|
|
}
|
|
|
|
|
2018-01-07 19:07:47 +00:00
|
|
|
/* Custom source code font */
|
|
|
|
|
2018-04-10 15:26:26 +00:00
|
|
|
String custom_font_path_source = EditorSettings::get_singleton()->get("interface/editor/code_font");
|
2020-09-03 11:22:16 +00:00
|
|
|
Ref<FontData> CustomFontSource;
|
2018-07-03 13:37:07 +00:00
|
|
|
if (custom_font_path_source.length() > 0 && dir->file_exists(custom_font_path_source)) {
|
2020-12-27 13:30:33 +00:00
|
|
|
CustomFontSource = load_cached_external_font(custom_font_path_source, font_hinting, font_antialiased, true);
|
2018-07-03 13:37:07 +00:00
|
|
|
} else {
|
|
|
|
EditorSettings::get_singleton()->set_manually("interface/editor/code_font", "");
|
2018-01-07 19:07:47 +00:00
|
|
|
}
|
|
|
|
|
2018-07-03 13:37:07 +00:00
|
|
|
memdelete(dir);
|
|
|
|
|
2020-12-27 13:30:33 +00:00
|
|
|
/* Noto Sans */
|
|
|
|
|
|
|
|
Ref<FontData> DefaultFont = load_cached_internal_font(_font_NotoSans_Regular, _font_NotoSans_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> DefaultFontBold = load_cached_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontArabic = load_cached_internal_font(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontArabicBold = load_cached_internal_font(_font_NotoNaskhArabicUI_Bold, _font_NotoNaskhArabicUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontBengali = load_cached_internal_font(_font_NotoSansBengaliUI_Regular, _font_NotoSansBengaliUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontBengaliBold = load_cached_internal_font(_font_NotoSansBengaliUI_Bold, _font_NotoSansBengaliUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontDevanagari = load_cached_internal_font(_font_NotoSansDevanagariUI_Regular, _font_NotoSansDevanagariUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontDevanagariBold = load_cached_internal_font(_font_NotoSansDevanagariUI_Bold, _font_NotoSansDevanagariUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontGeorgian = load_cached_internal_font(_font_NotoSansGeorgian_Regular, _font_NotoSansGeorgian_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontGeorgianBold = load_cached_internal_font(_font_NotoSansGeorgian_Bold, _font_NotoSansGeorgian_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontHebrew = load_cached_internal_font(_font_NotoSansHebrew_Regular, _font_NotoSansHebrew_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontHebrewBold = load_cached_internal_font(_font_NotoSansHebrew_Bold, _font_NotoSansHebrew_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontMalayalam = load_cached_internal_font(_font_NotoSansMalayalamUI_Regular, _font_NotoSansMalayalamUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontMalayalamBold = load_cached_internal_font(_font_NotoSansMalayalamUI_Bold, _font_NotoSansMalayalamUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontOriya = load_cached_internal_font(_font_NotoSansOriyaUI_Regular, _font_NotoSansOriyaUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontOriyaBold = load_cached_internal_font(_font_NotoSansOriyaUI_Bold, _font_NotoSansOriyaUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontSinhala = load_cached_internal_font(_font_NotoSansSinhalaUI_Regular, _font_NotoSansSinhalaUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontSinhalaBold = load_cached_internal_font(_font_NotoSansSinhalaUI_Bold, _font_NotoSansSinhalaUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontTamil = load_cached_internal_font(_font_NotoSansTamilUI_Regular, _font_NotoSansTamilUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontTamilBold = load_cached_internal_font(_font_NotoSansTamilUI_Bold, _font_NotoSansTamilUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontTelugu = load_cached_internal_font(_font_NotoSansTeluguUI_Regular, _font_NotoSansTeluguUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontTeluguBold = load_cached_internal_font(_font_NotoSansTeluguUI_Bold, _font_NotoSansTeluguUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontThai = load_cached_internal_font(_font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontThaiBold = load_cached_internal_font(_font_NotoSansThaiUI_Bold, _font_NotoSansThaiUI_Bold_size, font_hinting, font_antialiased, true);
|
|
|
|
|
|
|
|
/* Droid Sans */
|
|
|
|
|
|
|
|
Ref<FontData> FontFallback = load_cached_internal_font(_font_DroidSansFallback, _font_DroidSansFallback_size, font_hinting, font_antialiased, true);
|
|
|
|
Ref<FontData> FontJapanese = load_cached_internal_font(_font_DroidSansJapanese, _font_DroidSansJapanese_size, font_hinting, font_antialiased, true);
|
2018-08-29 20:11:09 +00:00
|
|
|
|
2018-02-27 14:04:08 +00:00
|
|
|
/* Hack */
|
2015-04-18 17:38:54 +00:00
|
|
|
|
2020-02-13 22:55:19 +00:00
|
|
|
Ref<FontData> dfmono = load_cached_internal_font(_font_JetBrainsMono_Regular, _font_JetBrainsMono_Regular_size, font_hinting, font_antialiased, true);
|
2020-10-22 16:40:18 +00:00
|
|
|
|
2018-04-10 15:26:26 +00:00
|
|
|
// Default font
|
2021-10-25 08:49:18 +00:00
|
|
|
MAKE_DEFAULT_FONT(df, String());
|
2021-12-31 15:53:43 +00:00
|
|
|
p_theme->set_default_font(df); // Default theme font
|
|
|
|
p_theme->set_default_font_size(default_font_size);
|
2020-09-03 11:22:16 +00:00
|
|
|
|
|
|
|
p_theme->set_font_size("main_size", "EditorFonts", default_font_size);
|
2019-10-03 18:30:33 +00:00
|
|
|
p_theme->set_font("main", "EditorFonts", df);
|
2016-05-29 14:37:26 +00:00
|
|
|
|
2018-04-10 15:26:26 +00:00
|
|
|
// Bold font
|
2021-10-25 08:49:18 +00:00
|
|
|
MAKE_BOLD_FONT(df_bold, String());
|
2020-09-03 11:22:16 +00:00
|
|
|
p_theme->set_font_size("bold_size", "EditorFonts", default_font_size);
|
2018-04-10 15:26:26 +00:00
|
|
|
p_theme->set_font("bold", "EditorFonts", df_bold);
|
|
|
|
|
|
|
|
// Title font
|
2021-05-27 15:32:30 +00:00
|
|
|
p_theme->set_font_size("title_size", "EditorFonts", default_font_size + 1 * EDSCALE);
|
2020-09-03 11:22:16 +00:00
|
|
|
p_theme->set_font("title", "EditorFonts", df_bold);
|
2017-11-10 01:36:19 +00:00
|
|
|
|
2021-05-27 15:32:30 +00: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);
|
|
|
|
|
2021-07-08 13:29:15 +00:00
|
|
|
p_theme->set_font("font", "Label", df);
|
|
|
|
|
|
|
|
p_theme->set_type_variation("HeaderSmall", "Label");
|
|
|
|
p_theme->set_font("font", "HeaderSmall", df_bold);
|
|
|
|
p_theme->set_font_size("font_size", "HeaderSmall", default_font_size);
|
|
|
|
|
|
|
|
p_theme->set_type_variation("HeaderMedium", "Label");
|
|
|
|
p_theme->set_font("font", "HeaderMedium", df_bold);
|
|
|
|
p_theme->set_font_size("font_size", "HeaderMedium", default_font_size + 1 * EDSCALE);
|
|
|
|
|
|
|
|
p_theme->set_type_variation("HeaderLarge", "Label");
|
|
|
|
p_theme->set_font("font", "HeaderLarge", df_bold);
|
|
|
|
p_theme->set_font_size("font_size", "HeaderLarge", default_font_size + 3 * EDSCALE);
|
2021-05-27 15:32:30 +00:00
|
|
|
|
2019-06-15 16:18:32 +00:00
|
|
|
// Documentation fonts
|
2020-12-27 13:30:33 +00:00
|
|
|
String code_font_custom_variations = EditorSettings::get_singleton()->get("interface/editor/code_font_custom_variations");
|
2021-10-25 08:49:18 +00:00
|
|
|
MAKE_SOURCE_FONT(df_code, code_font_custom_variations);
|
2020-09-03 11:22:16 +00:00
|
|
|
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 15:26:26 +00:00
|
|
|
|
|
|
|
// Ruler font
|
2020-09-03 11:22:16 +00:00
|
|
|
p_theme->set_font_size("rulers_size", "EditorFonts", 8 * EDSCALE);
|
|
|
|
p_theme->set_font("rulers", "EditorFonts", df);
|
2017-08-29 19:50:18 +00:00
|
|
|
|
2019-10-23 09:46:26 +00:00
|
|
|
// Rotation widget font
|
2020-09-03 11:22:16 +00:00
|
|
|
p_theme->set_font_size("rotation_control_size", "EditorFonts", 14 * EDSCALE);
|
|
|
|
p_theme->set_font("rotation_control", "EditorFonts", df);
|
2019-10-23 09:46:26 +00:00
|
|
|
|
2018-04-10 15:26:26 +00:00
|
|
|
// Code font
|
2020-09-03 11:22:16 +00:00
|
|
|
p_theme->set_font_size("source_size", "EditorFonts", int(EDITOR_GET("interface/editor/code_font_size")) * EDSCALE);
|
2017-03-05 15:44:50 +00:00
|
|
|
p_theme->set_font("source", "EditorFonts", df_code);
|
2016-05-29 14:37:26 +00:00
|
|
|
|
2020-09-03 11:22:16 +00: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 12:09:39 +00:00
|
|
|
|
2020-09-03 11:22:16 +00: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 14:12:17 +00:00
|
|
|
|
2020-09-03 11:22:16 +00: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 17:38:54 +00:00
|
|
|
}
|