summaryrefslogtreecommitdiff
path: root/editor/editor_fonts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_fonts.cpp')
-rw-r--r--editor/editor_fonts.cpp65
1 files changed, 53 insertions, 12 deletions
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 2ec3cdb08f..26f16e282e 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -85,6 +85,20 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p
m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); \
MAKE_FALLBACKS(m_name);
+#define MAKE_BOLD_FONT(m_name, m_size) \
+ Ref<DynamicFont> m_name; \
+ m_name.instance(); \
+ m_name->set_size(m_size); \
+ if (CustomFont.is_valid()) { \
+ m_name->set_font_data(CustomFontBold); \
+ m_name->add_fallback(DefaultFontBold); \
+ } else { \
+ m_name->set_font_data(DefaultFontBold); \
+ } \
+ m_name->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); \
+ m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); \
+ MAKE_FALLBACKS(m_name);
+
#define MAKE_SOURCE_FONT(m_name, m_size) \
Ref<DynamicFont> m_name; \
m_name.instance(); \
@@ -102,25 +116,37 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p
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");
+
+ String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font");
Ref<DynamicFontData> CustomFont;
- if (custom_font.length() > 0) {
+ if (custom_font_path.length() > 0) {
CustomFont.instance();
CustomFont->set_hinting(font_hinting);
- CustomFont->set_font_path(custom_font);
+ CustomFont->set_font_path(custom_font_path);
CustomFont->set_force_autohinter(true); //just looks better..i think?
}
+ /* Custom Bold font */
+
+ String custom_font_path_bold = EditorSettings::get_singleton()->get("interface/editor/main_font_bold");
+ Ref<DynamicFontData> CustomFontBold;
+ if (custom_font_path_bold.length() > 0) {
+ CustomFontBold.instance();
+ CustomFontBold->set_hinting(font_hinting);
+ CustomFontBold->set_font_path(custom_font_path_bold);
+ CustomFontBold->set_force_autohinter(true); //just looks better..i think?
+ }
+
/* Custom source code font */
- String custom_font_source = EditorSettings::get_singleton()->get("interface/editor/code_font");
+ String custom_font_path_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) {
+ if (custom_font_path_source.length() > 0) {
CustomFontSource.instance();
CustomFontSource->set_hinting(font_source_hinting);
- CustomFontSource->set_font_path(custom_font_source);
+ CustomFontSource->set_font_path(custom_font_path_source);
}
/* Droid Sans */
@@ -131,6 +157,12 @@ void editor_register_fonts(Ref<Theme> p_theme) {
DefaultFont->set_font_ptr(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size);
DefaultFont->set_force_autohinter(true); //just looks better..i think?
+ Ref<DynamicFontData> DefaultFontBold;
+ DefaultFontBold.instance();
+ DefaultFont->set_hinting(font_hinting);
+ DefaultFontBold->set_font_ptr(_font_NotoSansUI_Bold, _font_NotoSansUI_Bold_size);
+ DefaultFontBold->set_force_autohinter(true); // just looks better..i think?
+
Ref<DynamicFontData> FontFallback;
FontFallback.instance();
FontFallback->set_hinting(font_hinting);
@@ -170,29 +202,38 @@ void editor_register_fonts(Ref<Theme> p_theme) {
//dfd->set_force_autohinter(true); //just looks better..i think?
int default_font_size = int(EditorSettings::get_singleton()->get("interface/editor/main_font_size")) * EDSCALE;
- MAKE_DEFAULT_FONT(df, default_font_size);
+ // Default font
+ MAKE_DEFAULT_FONT(df, default_font_size);
p_theme->set_default_theme_font(df);
- MAKE_DEFAULT_FONT(df_title, default_font_size + 2 * EDSCALE);
+ // Bold font
+ MAKE_BOLD_FONT(df_bold, default_font_size);
+ p_theme->set_font("bold", "EditorFonts", df_bold);
+
+ // Title font
+ MAKE_BOLD_FONT(df_title, default_font_size + 2 * EDSCALE);
p_theme->set_font("title", "EditorFonts", df_title);
- MAKE_DEFAULT_FONT(df_doc_title, int(EDITOR_DEF("text_editor/help/help_title_font_size", 23)) * EDSCALE);
+ // Doc font
+ MAKE_BOLD_FONT(df_doc_title, int(EDITOR_DEF("text_editor/help/help_title_font_size", 23)) * EDSCALE);
MAKE_DEFAULT_FONT(df_doc, int(EDITOR_DEF("text_editor/help/help_font_size", 15)) * EDSCALE);
p_theme->set_font("doc", "EditorFonts", df_doc);
p_theme->set_font("doc_title", "EditorFonts", df_doc_title);
+ MAKE_SOURCE_FONT(df_doc_code, int(EDITOR_DEF("text_editor/help/help_source_font_size", 14)) * EDSCALE);
+ p_theme->set_font("doc_source", "EditorFonts", df_doc_code);
+
+ // Ruler font
MAKE_DEFAULT_FONT(df_rulers, 8 * EDSCALE);
p_theme->set_font("rulers", "EditorFonts", df_rulers);
+ // Code font
MAKE_SOURCE_FONT(df_code, int(EditorSettings::get_singleton()->get("interface/editor/code_font_size")) * EDSCALE);
p_theme->set_font("source", "EditorFonts", df_code);
- MAKE_SOURCE_FONT(df_doc_code, int(EDITOR_DEF("text_editor/help/help_source_font_size", 14)) * EDSCALE);
- p_theme->set_font("doc_source", "EditorFonts", df_doc_code);
-
MAKE_SOURCE_FONT(df_output_code, int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE);
p_theme->set_font("output_source", "EditorFonts", df_output_code);