editor_fonts.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /*************************************************************************/
  2. /* editor_fonts.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "editor_fonts.h"
  31. #include "builtin_fonts.gen.h"
  32. #include "core/io/dir_access.h"
  33. #include "editor/editor_scale.h"
  34. #include "editor/editor_settings.h"
  35. #include "scene/resources/default_theme/default_theme.h"
  36. #include "scene/resources/font.h"
  37. Ref<FontFile> load_external_font(const String &p_path, TextServer::Hinting p_hinting, bool p_aa, bool p_autohint, TextServer::SubpixelPositioning p_font_subpixel_positioning, bool p_msdf = false, TypedArray<Font> *r_fallbacks = nullptr) {
  38. Ref<FontFile> font;
  39. font.instantiate();
  40. Vector<uint8_t> data = FileAccess::get_file_as_array(p_path);
  41. font->set_data(data);
  42. font->set_multichannel_signed_distance_field(p_msdf);
  43. font->set_antialiased(p_aa);
  44. font->set_hinting(p_hinting);
  45. font->set_force_autohinter(p_autohint);
  46. font->set_subpixel_positioning(p_font_subpixel_positioning);
  47. if (r_fallbacks != nullptr) {
  48. r_fallbacks->push_back(font);
  49. }
  50. return font;
  51. }
  52. Ref<FontFile> load_internal_font(const uint8_t *p_data, size_t p_size, TextServer::Hinting p_hinting, bool p_aa, bool p_autohint, TextServer::SubpixelPositioning p_font_subpixel_positioning, bool p_msdf = false, TypedArray<Font> *r_fallbacks = nullptr) {
  53. Ref<FontFile> font;
  54. font.instantiate();
  55. font->set_data_ptr(p_data, p_size);
  56. font->set_multichannel_signed_distance_field(p_msdf);
  57. font->set_antialiased(p_aa);
  58. font->set_hinting(p_hinting);
  59. font->set_force_autohinter(p_autohint);
  60. font->set_subpixel_positioning(p_font_subpixel_positioning);
  61. if (r_fallbacks != nullptr) {
  62. r_fallbacks->push_back(font);
  63. }
  64. return font;
  65. }
  66. Ref<FontVariation> make_bold_font(const Ref<Font> &p_font, double p_embolden, TypedArray<Font> *r_fallbacks = nullptr) {
  67. Ref<FontVariation> font_var;
  68. font_var.instantiate();
  69. font_var->set_base_font(p_font);
  70. font_var->set_variation_embolden(p_embolden);
  71. if (r_fallbacks != nullptr) {
  72. r_fallbacks->push_back(font_var);
  73. }
  74. return font_var;
  75. }
  76. void editor_register_fonts(Ref<Theme> p_theme) {
  77. Ref<DirAccess> dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
  78. bool font_antialiased = (bool)EditorSettings::get_singleton()->get("interface/editor/font_antialiased");
  79. int font_hinting_setting = (int)EditorSettings::get_singleton()->get("interface/editor/font_hinting");
  80. TextServer::SubpixelPositioning font_subpixel_positioning = (TextServer::SubpixelPositioning)(int)EditorSettings::get_singleton()->get("interface/editor/font_subpixel_positioning");
  81. TextServer::Hinting font_hinting;
  82. switch (font_hinting_setting) {
  83. case 0:
  84. // The "Auto" setting uses the setting that best matches the OS' font rendering:
  85. // - macOS doesn't use font hinting.
  86. // - Windows uses ClearType, which is in between "Light" and "Normal" hinting.
  87. // - Linux has configurable font hinting, but most distributions including Ubuntu default to "Light".
  88. #ifdef MACOS_ENABLED
  89. font_hinting = TextServer::HINTING_NONE;
  90. #else
  91. font_hinting = TextServer::HINTING_LIGHT;
  92. #endif
  93. break;
  94. case 1:
  95. font_hinting = TextServer::HINTING_NONE;
  96. break;
  97. case 2:
  98. font_hinting = TextServer::HINTING_LIGHT;
  99. break;
  100. default:
  101. font_hinting = TextServer::HINTING_NORMAL;
  102. break;
  103. }
  104. // Load built-in fonts.
  105. const int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE;
  106. const float embolden_strength = 0.6;
  107. Ref<Font> default_font = load_internal_font(_font_NotoSans_Regular, _font_NotoSans_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false);
  108. Ref<Font> default_font_msdf = load_internal_font(_font_NotoSans_Regular, _font_NotoSans_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, true);
  109. TypedArray<Font> fallbacks;
  110. Ref<FontFile> arabic_font = load_internal_font(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  111. Ref<FontFile> bengali_font = load_internal_font(_font_NotoSansBengaliUI_Regular, _font_NotoSansBengaliUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  112. Ref<FontFile> devanagari_font = load_internal_font(_font_NotoSansDevanagariUI_Regular, _font_NotoSansDevanagariUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  113. Ref<FontFile> georgian_font = load_internal_font(_font_NotoSansGeorgian_Regular, _font_NotoSansGeorgian_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  114. Ref<FontFile> hebrew_font = load_internal_font(_font_NotoSansHebrew_Regular, _font_NotoSansHebrew_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  115. Ref<FontFile> malayalam_font = load_internal_font(_font_NotoSansMalayalamUI_Regular, _font_NotoSansMalayalamUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  116. Ref<FontFile> oriya_font = load_internal_font(_font_NotoSansOriyaUI_Regular, _font_NotoSansOriyaUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  117. Ref<FontFile> sinhala_font = load_internal_font(_font_NotoSansSinhalaUI_Regular, _font_NotoSansSinhalaUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  118. Ref<FontFile> tamil_font = load_internal_font(_font_NotoSansTamilUI_Regular, _font_NotoSansTamilUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  119. Ref<FontFile> telugu_font = load_internal_font(_font_NotoSansTeluguUI_Regular, _font_NotoSansTeluguUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  120. Ref<FontFile> thai_font = load_internal_font(_font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  121. Ref<FontFile> fallback_font = load_internal_font(_font_DroidSansFallback, _font_DroidSansFallback_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  122. Ref<FontFile> japanese_font = load_internal_font(_font_DroidSansJapanese, _font_DroidSansJapanese_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks);
  123. default_font->set_fallbacks(fallbacks);
  124. default_font_msdf->set_fallbacks(fallbacks);
  125. Ref<FontFile> default_font_bold = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false);
  126. Ref<FontFile> default_font_bold_msdf = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, true);
  127. TypedArray<Font> fallbacks_bold;
  128. Ref<FontFile> arabic_font_bold = load_internal_font(_font_NotoNaskhArabicUI_Bold, _font_NotoNaskhArabicUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  129. Ref<FontFile> bengali_font_bold = load_internal_font(_font_NotoSansBengaliUI_Bold, _font_NotoSansBengaliUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  130. Ref<FontFile> devanagari_font_bold = load_internal_font(_font_NotoSansDevanagariUI_Bold, _font_NotoSansDevanagariUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  131. Ref<FontFile> georgian_font_bold = load_internal_font(_font_NotoSansGeorgian_Bold, _font_NotoSansGeorgian_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  132. Ref<FontFile> hebrew_font_bold = load_internal_font(_font_NotoSansHebrew_Bold, _font_NotoSansHebrew_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  133. Ref<FontFile> malayalam_font_bold = load_internal_font(_font_NotoSansMalayalamUI_Bold, _font_NotoSansMalayalamUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  134. Ref<FontFile> oriya_font_bold = load_internal_font(_font_NotoSansOriyaUI_Bold, _font_NotoSansOriyaUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  135. Ref<FontFile> sinhala_font_bold = load_internal_font(_font_NotoSansSinhalaUI_Bold, _font_NotoSansSinhalaUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  136. Ref<FontFile> tamil_font_bold = load_internal_font(_font_NotoSansTamilUI_Bold, _font_NotoSansTamilUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  137. Ref<FontFile> telugu_font_bold = load_internal_font(_font_NotoSansTeluguUI_Bold, _font_NotoSansTeluguUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  138. Ref<FontFile> thai_font_bold = load_internal_font(_font_NotoSansThaiUI_Bold, _font_NotoSansThaiUI_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false, &fallbacks_bold);
  139. Ref<FontVariation> fallback_font_bold = make_bold_font(fallback_font, embolden_strength, &fallbacks_bold);
  140. Ref<FontVariation> japanese_font_bold = make_bold_font(japanese_font, embolden_strength, &fallbacks_bold);
  141. default_font_bold->set_fallbacks(fallbacks_bold);
  142. default_font_bold_msdf->set_fallbacks(fallbacks_bold);
  143. Ref<FontFile> default_font_mono = load_internal_font(_font_JetBrainsMono_Regular, _font_JetBrainsMono_Regular_size, font_hinting, font_antialiased, true, font_subpixel_positioning);
  144. default_font_mono->set_fallbacks(fallbacks);
  145. // Init base font configs and load custom fonts.
  146. String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font");
  147. String custom_font_path_bold = EditorSettings::get_singleton()->get("interface/editor/main_font_bold");
  148. String custom_font_path_source = EditorSettings::get_singleton()->get("interface/editor/code_font");
  149. Ref<FontVariation> default_fc;
  150. default_fc.instantiate();
  151. if (custom_font_path.length() > 0 && dir->file_exists(custom_font_path)) {
  152. Ref<FontFile> custom_font = load_external_font(custom_font_path, font_hinting, font_antialiased, true, font_subpixel_positioning);
  153. {
  154. TypedArray<Font> fallback_custom;
  155. fallback_custom.push_back(default_font);
  156. custom_font->set_fallbacks(fallback_custom);
  157. }
  158. default_fc->set_base_font(custom_font);
  159. } else {
  160. EditorSettings::get_singleton()->set_manually("interface/editor/main_font", "");
  161. default_fc->set_base_font(default_font);
  162. }
  163. default_fc->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
  164. default_fc->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE);
  165. Ref<FontVariation> default_fc_msdf;
  166. default_fc_msdf.instantiate();
  167. if (custom_font_path.length() > 0 && dir->file_exists(custom_font_path)) {
  168. Ref<FontFile> custom_font = load_external_font(custom_font_path, font_hinting, font_antialiased, true, font_subpixel_positioning);
  169. {
  170. TypedArray<Font> fallback_custom;
  171. fallback_custom.push_back(default_font_msdf);
  172. custom_font->set_fallbacks(fallback_custom);
  173. }
  174. default_fc_msdf->set_base_font(custom_font);
  175. } else {
  176. EditorSettings::get_singleton()->set_manually("interface/editor/main_font", "");
  177. default_fc_msdf->set_base_font(default_font_msdf);
  178. }
  179. default_fc_msdf->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
  180. default_fc_msdf->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE);
  181. Ref<FontVariation> bold_fc;
  182. bold_fc.instantiate();
  183. if (custom_font_path_bold.length() > 0 && dir->file_exists(custom_font_path_bold)) {
  184. Ref<FontFile> custom_font = load_external_font(custom_font_path_bold, font_hinting, font_antialiased, true, font_subpixel_positioning);
  185. {
  186. TypedArray<Font> fallback_custom;
  187. fallback_custom.push_back(default_font_bold);
  188. custom_font->set_fallbacks(fallback_custom);
  189. }
  190. bold_fc->set_base_font(custom_font);
  191. } else if (custom_font_path.length() > 0 && dir->file_exists(custom_font_path)) {
  192. Ref<FontFile> custom_font = load_external_font(custom_font_path, font_hinting, font_antialiased, true, font_subpixel_positioning);
  193. {
  194. TypedArray<Font> fallback_custom;
  195. fallback_custom.push_back(default_font_bold);
  196. custom_font->set_fallbacks(fallback_custom);
  197. }
  198. bold_fc->set_base_font(custom_font);
  199. bold_fc->set_variation_embolden(embolden_strength);
  200. } else {
  201. EditorSettings::get_singleton()->set_manually("interface/editor/main_font_bold", "");
  202. bold_fc->set_base_font(default_font_bold);
  203. }
  204. bold_fc->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
  205. bold_fc->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE);
  206. Ref<FontVariation> bold_fc_msdf;
  207. bold_fc_msdf.instantiate();
  208. if (custom_font_path_bold.length() > 0 && dir->file_exists(custom_font_path_bold)) {
  209. Ref<FontFile> custom_font = load_external_font(custom_font_path_bold, font_hinting, font_antialiased, true, font_subpixel_positioning);
  210. {
  211. TypedArray<Font> fallback_custom;
  212. fallback_custom.push_back(default_font_bold_msdf);
  213. custom_font->set_fallbacks(fallback_custom);
  214. }
  215. bold_fc_msdf->set_base_font(custom_font);
  216. } else if (custom_font_path.length() > 0 && dir->file_exists(custom_font_path)) {
  217. Ref<FontFile> custom_font = load_external_font(custom_font_path, font_hinting, font_antialiased, true, font_subpixel_positioning);
  218. {
  219. TypedArray<Font> fallback_custom;
  220. fallback_custom.push_back(default_font_bold_msdf);
  221. custom_font->set_fallbacks(fallback_custom);
  222. }
  223. bold_fc_msdf->set_base_font(custom_font);
  224. bold_fc_msdf->set_variation_embolden(embolden_strength);
  225. } else {
  226. EditorSettings::get_singleton()->set_manually("interface/editor/main_font_bold", "");
  227. bold_fc_msdf->set_base_font(default_font_bold_msdf);
  228. }
  229. bold_fc_msdf->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
  230. bold_fc_msdf->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE);
  231. Ref<FontVariation> mono_fc;
  232. mono_fc.instantiate();
  233. if (custom_font_path_source.length() > 0 && dir->file_exists(custom_font_path_source)) {
  234. Ref<FontFile> custom_font = load_external_font(custom_font_path_source, font_hinting, font_antialiased, true, font_subpixel_positioning);
  235. {
  236. TypedArray<Font> fallback_custom;
  237. fallback_custom.push_back(default_font_mono);
  238. custom_font->set_fallbacks(fallback_custom);
  239. }
  240. mono_fc->set_base_font(custom_font);
  241. } else {
  242. EditorSettings::get_singleton()->set_manually("interface/editor/code_font", "");
  243. mono_fc->set_base_font(default_font_mono);
  244. }
  245. mono_fc->set_spacing(TextServer::SPACING_TOP, -EDSCALE);
  246. mono_fc->set_spacing(TextServer::SPACING_BOTTOM, -EDSCALE);
  247. Ref<FontVariation> mono_other_fc = mono_fc->duplicate();
  248. // Enable contextual alternates (coding ligatures) and custom features for the source editor font.
  249. int ot_mode = EditorSettings::get_singleton()->get("interface/editor/code_font_contextual_ligatures");
  250. switch (ot_mode) {
  251. case 1: { // Disable ligatures.
  252. Dictionary ftrs;
  253. ftrs[TS->name_to_tag("calt")] = 0;
  254. mono_fc->set_opentype_features(ftrs);
  255. } break;
  256. case 2: { // Custom.
  257. Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_opentype_features")).split(",");
  258. Dictionary ftrs;
  259. for (int i = 0; i < subtag.size(); i++) {
  260. Vector<String> subtag_a = subtag[i].split("=");
  261. if (subtag_a.size() == 2) {
  262. ftrs[TS->name_to_tag(subtag_a[0])] = subtag_a[1].to_int();
  263. } else if (subtag_a.size() == 1) {
  264. ftrs[TS->name_to_tag(subtag_a[0])] = 1;
  265. }
  266. }
  267. mono_fc->set_opentype_features(ftrs);
  268. } break;
  269. default: { // Default.
  270. Dictionary ftrs;
  271. ftrs[TS->name_to_tag("calt")] = 1;
  272. mono_fc->set_opentype_features(ftrs);
  273. } break;
  274. }
  275. {
  276. // Disable contextual alternates (coding ligatures).
  277. Dictionary ftrs;
  278. ftrs[TS->name_to_tag("calt")] = 0;
  279. mono_other_fc->set_opentype_features(ftrs);
  280. }
  281. Ref<FontVariation> italic_fc = default_fc->duplicate();
  282. italic_fc->set_variation_transform(Transform2D(1.0, 0.2, 0.0, 1.0, 0.0, 0.0));
  283. // Setup theme.
  284. p_theme->set_default_font(default_fc); // Default theme font config.
  285. p_theme->set_default_font_size(default_font_size);
  286. // Main font.
  287. p_theme->set_font("main", "EditorFonts", default_fc);
  288. p_theme->set_font("main_msdf", "EditorFonts", default_fc_msdf);
  289. p_theme->set_font_size("main_size", "EditorFonts", default_font_size);
  290. p_theme->set_font("bold", "EditorFonts", bold_fc);
  291. p_theme->set_font("main_bold_msdf", "EditorFonts", bold_fc_msdf);
  292. p_theme->set_font_size("bold_size", "EditorFonts", default_font_size);
  293. // Title font.
  294. p_theme->set_font("title", "EditorFonts", bold_fc);
  295. p_theme->set_font_size("title_size", "EditorFonts", default_font_size + 1 * EDSCALE);
  296. p_theme->set_font("main_button_font", "EditorFonts", bold_fc);
  297. p_theme->set_font_size("main_button_font_size", "EditorFonts", default_font_size + 1 * EDSCALE);
  298. p_theme->set_font("font", "Label", default_fc);
  299. p_theme->set_type_variation("HeaderSmall", "Label");
  300. p_theme->set_font("font", "HeaderSmall", bold_fc);
  301. p_theme->set_font_size("font_size", "HeaderSmall", default_font_size);
  302. p_theme->set_type_variation("HeaderMedium", "Label");
  303. p_theme->set_font("font", "HeaderMedium", bold_fc);
  304. p_theme->set_font_size("font_size", "HeaderMedium", default_font_size + 1 * EDSCALE);
  305. p_theme->set_type_variation("HeaderLarge", "Label");
  306. p_theme->set_font("font", "HeaderLarge", bold_fc);
  307. p_theme->set_font_size("font_size", "HeaderLarge", default_font_size + 3 * EDSCALE);
  308. // Documentation fonts
  309. p_theme->set_font_size("doc_size", "EditorFonts", int(EDITOR_GET("text_editor/help/help_font_size")) * EDSCALE);
  310. p_theme->set_font("doc", "EditorFonts", default_fc);
  311. p_theme->set_font("doc_bold", "EditorFonts", bold_fc);
  312. p_theme->set_font("doc_italic", "EditorFonts", italic_fc);
  313. p_theme->set_font_size("doc_title_size", "EditorFonts", int(EDITOR_GET("text_editor/help/help_title_font_size")) * EDSCALE);
  314. p_theme->set_font("doc_title", "EditorFonts", bold_fc);
  315. p_theme->set_font_size("doc_source_size", "EditorFonts", int(EDITOR_GET("text_editor/help/help_source_font_size")) * EDSCALE);
  316. p_theme->set_font("doc_source", "EditorFonts", mono_fc);
  317. p_theme->set_font_size("doc_keyboard_size", "EditorFonts", (int(EDITOR_GET("text_editor/help/help_source_font_size")) - 1) * EDSCALE);
  318. p_theme->set_font("doc_keyboard", "EditorFonts", mono_fc);
  319. // Ruler font
  320. p_theme->set_font_size("rulers_size", "EditorFonts", 8 * EDSCALE);
  321. p_theme->set_font("rulers", "EditorFonts", default_fc);
  322. // Rotation widget font
  323. p_theme->set_font_size("rotation_control_size", "EditorFonts", 14 * EDSCALE);
  324. p_theme->set_font("rotation_control", "EditorFonts", default_fc);
  325. // Code font
  326. p_theme->set_font_size("source_size", "EditorFonts", int(EDITOR_GET("interface/editor/code_font_size")) * EDSCALE);
  327. p_theme->set_font("source", "EditorFonts", mono_fc);
  328. p_theme->set_font_size("expression_size", "EditorFonts", (int(EDITOR_GET("interface/editor/code_font_size")) - 1) * EDSCALE);
  329. p_theme->set_font("expression", "EditorFonts", mono_other_fc);
  330. p_theme->set_font_size("output_source_size", "EditorFonts", int(EDITOR_GET("run/output/font_size")) * EDSCALE);
  331. p_theme->set_font("output_source", "EditorFonts", mono_other_fc);
  332. p_theme->set_font_size("status_source_size", "EditorFonts", default_font_size);
  333. p_theme->set_font("status_source", "EditorFonts", mono_other_fc);
  334. }