Forráskód Böngészése

Added Custom Fonts to the Editors

I added a few custom fonts to each editor them. This lead me to fix a few bugs related to custom fonts.
Peter Robinson 4 éve
szülő
commit
8ea23400c4
96 módosított fájl, 292 hozzáadás és 177 törlés
  1. 0 4
      editor/EditorCore/EditorCore.cs
  2. 106 54
      editor/EditorCore/Themes/BaseTheme/BaseTheme.cs
  3. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/black ops one 12 (ansi).uft
  4. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/black ops one 14 (ansi).uft
  5. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/black ops one 16 (ansi).uft
  6. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/black ops one 18 (ansi).uft
  7. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/black ops one 19 (ansi).uft
  8. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/black ops one 20 (ansi).uft
  9. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/black ops one 24 (ansi).uft
  10. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 12 (ansi).uft
  11. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 14 (ansi).uft
  12. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 16 (ansi).uft
  13. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 18 (ansi).uft
  14. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 20 (ansi).uft
  15. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 22 (ansi).uft
  16. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 24 (ansi).uft
  17. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/raleway 12 (ansi).uft
  18. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/raleway 14 (ansi).uft
  19. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/raleway 16 (ansi).uft
  20. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/raleway 18 (ansi).uft
  21. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/raleway 20 (ansi).uft
  22. BIN
      editor/EditorCore/Themes/BaseTheme/fonts/raleway 24 (ansi).uft
  23. 6 16
      editor/EditorCore/Themes/ForestRobe/ForestRobeTheme.cs
  24. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 12 (ansi).uft
  25. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 14 (ansi).uft
  26. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 16 (ansi).uft
  27. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 18 (ansi).uft
  28. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 19 (ansi).uft
  29. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 20 (ansi).uft
  30. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 24 (ansi).uft
  31. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 12 (ansi).uft
  32. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 14 (ansi).uft
  33. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 16 (ansi).uft
  34. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 18 (ansi).uft
  35. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 20 (ansi).uft
  36. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 22 (ansi).uft
  37. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 24 (ansi).uft
  38. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/raleway 12 (ansi).uft
  39. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/raleway 14 (ansi).uft
  40. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/raleway 16 (ansi).uft
  41. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/raleway 18 (ansi).uft
  42. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/raleway 20 (ansi).uft
  43. BIN
      editor/EditorCore/Themes/ForestRobe/fonts/raleway 24 (ansi).uft
  44. 6 16
      editor/EditorCore/Themes/LabCoat/LabCoatTheme.cs
  45. BIN
      editor/EditorCore/Themes/LabCoat/fonts/roboto 12 (ansi).uft
  46. BIN
      editor/EditorCore/Themes/LabCoat/fonts/roboto 14 (ansi).uft
  47. BIN
      editor/EditorCore/Themes/LabCoat/fonts/roboto 16 (ansi).uft
  48. BIN
      editor/EditorCore/Themes/LabCoat/fonts/roboto 18 (ansi).uft
  49. BIN
      editor/EditorCore/Themes/LabCoat/fonts/roboto 20 (ansi).uft
  50. BIN
      editor/EditorCore/Themes/LabCoat/fonts/roboto 24 (ansi).uft
  51. BIN
      editor/EditorCore/Themes/LabCoat/fonts/share tech mono 12 (ansi).uft
  52. BIN
      editor/EditorCore/Themes/LabCoat/fonts/share tech mono 14 (ansi).uft
  53. BIN
      editor/EditorCore/Themes/LabCoat/fonts/share tech mono 16 (ansi).uft
  54. BIN
      editor/EditorCore/Themes/LabCoat/fonts/share tech mono 18 (ansi).uft
  55. BIN
      editor/EditorCore/Themes/LabCoat/fonts/share tech mono 20 (ansi).uft
  56. BIN
      editor/EditorCore/Themes/LabCoat/fonts/share tech mono 22 (ansi).uft
  57. BIN
      editor/EditorCore/Themes/LabCoat/fonts/share tech mono 24 (ansi).uft
  58. BIN
      editor/EditorCore/Themes/LabCoat/fonts/zen dots 12 (ansi).uft
  59. BIN
      editor/EditorCore/Themes/LabCoat/fonts/zen dots 14 (ansi).uft
  60. BIN
      editor/EditorCore/Themes/LabCoat/fonts/zen dots 16 (ansi).uft
  61. BIN
      editor/EditorCore/Themes/LabCoat/fonts/zen dots 18 (ansi).uft
  62. BIN
      editor/EditorCore/Themes/LabCoat/fonts/zen dots 19 (ansi).uft
  63. BIN
      editor/EditorCore/Themes/LabCoat/fonts/zen dots 20 (ansi).uft
  64. BIN
      editor/EditorCore/Themes/LabCoat/fonts/zen dots 24 (ansi).uft
  65. 25 0
      editor/EditorCore/Themes/ThemeManager.cs
  66. 51 34
      editor/EditorCore/Themes/TorqueSuit/TorqueSuitTheme.cs
  67. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 12 (ansi).uft
  68. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 14 (ansi).uft
  69. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 16 (ansi).uft
  70. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 18 (ansi).uft
  71. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 21 (ansi).uft
  72. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 22 (ansi).uft
  73. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 24 (ansi).uft
  74. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/raleway 12 (ansi).uft
  75. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/raleway 14 (ansi).uft
  76. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/raleway 16 (ansi).uft
  77. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/raleway 18 (ansi).uft
  78. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/raleway 20 (ansi).uft
  79. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/raleway 22 (ansi).uft
  80. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/raleway 24 (ansi).uft
  81. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/vt323 12 (ansi).uft
  82. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/vt323 14 (ansi).uft
  83. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/vt323 16 (ansi).uft
  84. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/vt323 18 (ansi).uft
  85. BIN
      editor/EditorCore/Themes/TorqueSuit/fonts/vt323 24 (ansi).uft
  86. 42 0
      engine/source/graphics/gFont_ScriptBinding.h
  87. 17 8
      engine/source/gui/containers/guiTabBookCtrl.cc
  88. 3 4
      engine/source/gui/containers/guiTabBookCtrl.h
  89. 3 6
      engine/source/gui/guiConsole.cc
  90. 0 2
      engine/source/gui/guiConsole.h
  91. 1 1
      engine/source/gui/guiMLTextCtrl.cc
  92. 21 25
      engine/source/gui/guiTextEditCtrl.cc
  93. 0 1
      engine/source/gui/guiTextEditCtrl.h
  94. 8 4
      engine/source/gui/guiTypes.cc
  95. 2 2
      engine/source/gui/guiTypes.h
  96. 1 0
      toybox/Sandbox/1/gui/guiProfiles.cs

+ 0 - 4
editor/EditorCore/EditorCore.cs

@@ -23,10 +23,6 @@
 function EditorCore::create( %this )
 {
 	exec("./Themes/ThemeManager.cs");
-	exec("./Themes/BaseTheme.cs");
-	exec("./Themes/LabCoatTheme.cs");
-	exec("./Themes/ForestRobeTheme.cs");
-	exec("./Themes/TorqueSuitTheme.cs");
 
 	new ScriptObject(ThemeManager);
 

+ 106 - 54
editor/EditorCore/Themes/BaseTheme.cs → editor/EditorCore/Themes/BaseTheme/BaseTheme.cs

@@ -2,15 +2,47 @@ function BaseTheme::onAdd(%this)
 {
 	%this.init();
 
+	%this.emptyBorder = new GuiBorderProfile()
+	{
+		// Default margin
+		margin = 0;
+		marginHL = 0;
+		marginSL = 0;
+		marginNA = 0;
+		//Default Border
+		border = 0;
+		borderHL = 0;
+		borderSL = 0;
+		borderNA = 0;
+		//Default border color
+		borderColor   = $color1;
+	    borderColorHL = AdjustColorValue($color1, 10);
+	    borderColorSL = AdjustColorValue($color1, 10);
+	    borderColorNA = SetColorAlpha($color1, 100);
+		//Default Padding
+		padding = 0;
+		paddingHL = 0;
+		paddingSL = 0;
+		paddingNA = 0;
+		//Default underfill
+		underfill = true;
+	};
+
 	%this.emptyProfile = new GuiControlProfile()
 	{
 		fillColor = "0 0 0 0";
+		fillColorHL = "0 0 0 0";
+		fillColorSL = "0 0 0 0";
+		fillColorNA = "0 0 0 0";
 
-		fontType = %this.font;
+		fontType = %this.font[1];
+		fontDirectory = %this.fontDirectory;
 		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		align = center;
 		vAlign = middle;
+
+		borderDefault = %this.emptyBorder;
 	};
 
 	%this.makeTipProfile();
@@ -27,21 +59,12 @@ function BaseTheme::init(%this)
 {
 	%this.name = "Construction Vest";
 	//fonts and font sizes
-	%this.font = "monaco";
-	%this.fontSize = 12;
-	if ($platform $= "windows")
-	{
-		%this.font = "lucida console";
-	}
-	else if ($platform $= "Android")
-	{
-		%this.font = "Droid";
-		%this.fontSize = 14;
-	}
-	else if($platform $= "ios")
-	{
-		%this.fontSize = 18;
-	}
+	%this.fontCount = 3;
+	%this.font[1] = "raleway";//Most common font
+	%this.font[2] = "black ops one";//Title fontType
+	%this.font[3] = "fira code semibold";//Code and console font
+	%this.fontDirectory = expandPath("^EditorCore/Themes/BaseTheme/Fonts");
+	%this.fontSize = 20;
 
 	%this.color1 = "10 10 10 255";//Most commonly used for backgrounds
 	%this.color2 = "70 70 70 255";//Normally used for things that stand off the background but are still background
@@ -70,8 +93,9 @@ function BaseTheme::makeTipProfile(%this)
 	{
 		fillColor = %this.setAlpha(%this.color3, 220);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize;
+		fontType = %this.font[1];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize - 2;
 		fontColor = %this.color1;
 
 		borderDefault = %tipBorder;
@@ -85,8 +109,9 @@ function BaseTheme::makeGeneralProfiles(%this)
 	{
 		fillColor = %this.setAlpha(%this.color1, 150);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize;
+		fontType = %this.font[1];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize - 2;
 		fontColor = %this.color4;
 	};
 
@@ -101,8 +126,9 @@ function BaseTheme::makeGeneralProfiles(%this)
 	{
 		fillColor = %this.color1;
 
-		fontType = %this.font;
-		fontSize = %this.fontSize;
+		fontType = %this.font[1];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize - 2;
 		fontColor = %this.color4;
 		align = center;
 		vAlign = middle;
@@ -121,8 +147,9 @@ function BaseTheme::makeGeneralProfiles(%this)
 	{
 		fillColor = %this.color1;
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[1];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		align = center;
 		vAlign = middle;
@@ -149,11 +176,6 @@ function BaseTheme::makePanelProfile(%this)
 
 	%panelBorderV = new GuiBorderProfile()
 	{
-		padding = 4;
-		paddingHL = 4;
-		paddingSL = 4;
-		paddingNA = 4;
-
 		border = 1;
 		borderHL = 1;
 		borderSL = 1;
@@ -172,8 +194,9 @@ function BaseTheme::makePanelProfile(%this)
 		fillColorSL = %this.adjustValue(%this.color2, 5);
 		fillColorNA = %this.setAlpha(%this.color2, 80);
 
-		fontType = %this.font;
-		fontSize = 14;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize - 1;
 		fontColor = %this.color5;
 		fontColorHL = %this.adjustValue(%this.color5, 10);
 		fontColorSL = %this.adjustValue(%this.color5, 20);
@@ -229,7 +252,8 @@ function BaseTheme::makePanelProfile(%this)
 		fillColorSL = %this.color2;
 		fillColorNA = %this.setAlpha(%this.color2, 50);
 
-		fontType = %this.font;
+		fontType = %this.font[1];
+		fontDirectory = %this.fontDirectory;
 		fontColor = %this.color3;
 		fontColorHL = %this.adjustValue(%this.color3, 10);
 		fontColorSL = %this.color5;
@@ -292,8 +316,9 @@ function BaseTheme::makeButtonProfile(%this)
 		fillColorSL = %this.color3;
 		fillColorNA = %this.setAlpha(%this.color2, 80);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = "0 0 0 255";
@@ -320,10 +345,10 @@ function BaseTheme::makeTabProfile(%this)
 		borderSL = 2;
 		borderNA = 2;
 
-		padding = 5;
-		paddingHL = 6;
-		paddingSL = 7;
-		paddingNA = 5;
+		padding = 3;
+		paddingHL = 4;
+		paddingSL = 5;
+		paddingNA = 3;
 
 		borderColor = "255 255 255 90";
 		borderColorHL = "255 255 255 90";
@@ -343,10 +368,10 @@ function BaseTheme::makeTabProfile(%this)
 		borderSL = 2;
 		borderNA = 2;
 
-		padding = 5;
-		paddingHL = 6;
-		paddingSL = 7;
-		paddingNA = 5;
+		padding = 3;
+		paddingHL = 4;
+		paddingSL = 5;
+		paddingNA = 3;
 
 		borderColor = "0 0 0 90";
 		borderColorHL = "0 0 0 90";
@@ -415,13 +440,15 @@ function BaseTheme::makeTabProfile(%this)
 		fillColorSL = %this.color5;
 		fillColorNA = %this.setAlpha(%this.color3, 150);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = %this.color1;
 		fontColorNA = %this.setAlpha(%this.color4, 100);
 		align = Center;
+		vAlign = Middle;
 
 		borderTop = %tabBorderTop;
 		borderLeft = %tabBorderLeft;
@@ -436,8 +463,9 @@ function BaseTheme::makeTabProfile(%this)
 		fillColorSL = %this.color5;
 		fillColorNA = %this.setAlpha(%this.color3, 150);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = %this.color1;
@@ -457,8 +485,9 @@ function BaseTheme::makeTabProfile(%this)
 		fillColorSL = %this.color5;
 		fillColorNA = %this.setAlpha(%this.color3, 150);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = %this.color1;
@@ -478,8 +507,9 @@ function BaseTheme::makeTabProfile(%this)
 		fillColorSL = %this.color5;
 		fillColorNA = %this.setAlpha(%this.color3, 150);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = %this.color1;
@@ -541,6 +571,24 @@ function BaseTheme::makeTabProfile(%this)
 
 function BaseTheme::makeTextEditProfile(%this)
 {
+	%labelBorder = new GuiBorderProfile()
+	{
+		padding = 2;
+	};
+	%this.labelProfile = new GuiControlProfile()
+	{
+		fillColor = "0 0 0 0";
+
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize - 2;
+		fontColor = %this.color4;
+		align = "left";
+		vAlign = "top";
+
+		borderDefault = %labelBorder;
+	};
+
 	//border for text boxes never use the HL state.
 	%textBorderV = new GuiBorderProfile()
 	{
@@ -579,8 +627,9 @@ function BaseTheme::makeTextEditProfile(%this)
 		fillColorSL = %this.color4;
 		fillColorNA = %this.setAlpha(%this.color4, 80);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[3];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.setAlpha(%this.color1, 220);
 		fontColorHL = %this.adjustValue(%this.color1, 10);
 		fontColorSL = %this.color1;
@@ -675,7 +724,8 @@ function BaseTheme::makeScrollProfile(%this)
 		fillColorSL = %this.color5;
 		fillColorNA = %this.setAlpha(%this.color3, 80);
 
-		fontType = %this.font;
+		fontType = %this.font[1];
+		fontDirectory = %this.fontDirectory;
 		fontColor = %this.color2;
 		fontColorHL = %this.color2;
 		fontColorSL = %this.color4;
@@ -705,7 +755,9 @@ function BaseTheme::makeConsoleProfile(%this)
 {
 	%this.consoleProfile = new GuiControlProfile()
 	{
-		fontType = %this.font;
+		fontType = %this.font[3];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize + 2;
 		fontColor = %this.color4; //Normal text
 		fontColorHL = %this.setAlpha(%this.color4, 140); //Warnings
 		fontColorNA = "255 0 0 255"; //Errors

BIN
editor/EditorCore/Themes/BaseTheme/fonts/black ops one 12 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/black ops one 14 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/black ops one 16 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/black ops one 18 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/black ops one 19 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/black ops one 20 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/black ops one 24 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 12 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 14 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 16 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 18 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 20 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 22 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/fira code semibold 24 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/raleway 12 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/raleway 14 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/raleway 16 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/raleway 18 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/raleway 20 (ansi).uft


BIN
editor/EditorCore/Themes/BaseTheme/fonts/raleway 24 (ansi).uft


+ 6 - 16
editor/EditorCore/Themes/ForestRobeTheme.cs → editor/EditorCore/Themes/ForestRobe/ForestRobeTheme.cs

@@ -1,23 +1,13 @@
 function ForestRobeTheme::init(%this)
 {
 	%this.name = "Forest Robe";
-
 	//fonts and font sizes
-	%this.font = "monaco";
-	%this.fontSize = 12;
-	if ($platform $= "windows")
-	{
-		%this.font = "lucida console";
-	}
-	else if ($platform $= "Android")
-	{
-		%this.font = "Droid";
-		%this.fontSize = 14;
-	}
-	else if($platform $= "ios")
-	{
-		%this.fontSize = 18;
-	}
+	%this.fontCount = 3;
+	%this.font[1] = "raleway";//Most common font
+	%this.font[2] = "cinzel decorative bold";//Title fontType
+	%this.font[3] = "fira code semibold";//Code and console font
+	%this.fontDirectory = expandPath("^EditorCore/Themes/ForestRobe/Fonts");
+	%this.fontSize = 20;
 
 	%this.color1 = "43 53 66 255";
 	%this.color2 = "48 88 84 255";

BIN
editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 12 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 14 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 16 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 18 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 19 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 20 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/cinzel decorative bold 24 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 12 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 14 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 16 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 18 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 20 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 22 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/fira code semibold 24 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/raleway 12 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/raleway 14 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/raleway 16 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/raleway 18 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/raleway 20 (ansi).uft


BIN
editor/EditorCore/Themes/ForestRobe/fonts/raleway 24 (ansi).uft


+ 6 - 16
editor/EditorCore/Themes/LabCoatTheme.cs → editor/EditorCore/Themes/LabCoat/LabCoatTheme.cs

@@ -1,23 +1,13 @@
 function LabCoatTheme::init(%this)
 {
 	%this.name = "Lab Coat";
-
 	//fonts and font sizes
-	%this.font = "monaco";
-	%this.fontSize = 12;
-	if ($platform $= "windows")
-	{
-		%this.font = "lucida console";
-	}
-	else if ($platform $= "Android")
-	{
-		%this.font = "Droid";
-		%this.fontSize = 14;
-	}
-	else if($platform $= "ios")
-	{
-		%this.fontSize = 18;
-	}
+	%this.fontCount = 3;
+	%this.font[1] = "roboto";//Most common font
+	%this.font[2] = "zen dots";//Title fontType
+	%this.font[3] = "share tech mono";//Code and console font
+	%this.fontDirectory = expandPath("^EditorCore/Themes/LabCoat/Fonts");
+	%this.fontSize = 20;
 
 	%this.color1 = "255 255 255 255";
 	%this.color2 = "203 217 222 255";

BIN
editor/EditorCore/Themes/LabCoat/fonts/roboto 12 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/roboto 14 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/roboto 16 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/roboto 18 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/roboto 20 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/roboto 24 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/share tech mono 12 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/share tech mono 14 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/share tech mono 16 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/share tech mono 18 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/share tech mono 20 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/share tech mono 22 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/share tech mono 24 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/zen dots 12 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/zen dots 14 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/zen dots 16 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/zen dots 18 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/zen dots 19 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/zen dots 20 (ansi).uft


BIN
editor/EditorCore/Themes/LabCoat/fonts/zen dots 24 (ansi).uft


+ 25 - 0
editor/EditorCore/Themes/ThemeManager.cs

@@ -22,6 +22,11 @@
 
 function ThemeManager::onAdd(%this)
 {
+	exec("./BaseTheme/BaseTheme.cs");
+	exec("./LabCoat/LabCoatTheme.cs");
+	exec("./ForestRobe/ForestRobeTheme.cs");
+	exec("./TorqueSuit/TorqueSuitTheme.cs");
+
 	%this.themeList = new SimSet();
 	%this.controlList = new SimSet();
 
@@ -135,3 +140,23 @@ function ThemeManager::createProfile(%this, %profileName, %parentName, %settings
 
 	%this.themeList.callOnChildren("createProfile", %profileName, %parentName, %settings);
 }
+
+function ThemeManager::populateFonts(%this)
+{
+	echo("ThemeManager: Populating fonts...");
+	%oldPath = $GUI::fontCacheDirectory;
+	$GUI::fontCacheDirectory = %this.activeTheme.fontDirectory;
+	echo("  Path set to" SPC $GUI::fontCacheDirectory);
+
+	for(%i = 1; %i <= %this.activeTheme.fontCount; %i++)
+	{
+		echo("  Populating" SPC %this.activeTheme.font[%i]);
+		populateFontCacheRange(%this.activeTheme.font[%i],12,0,65535);
+		populateFontCacheRange(%this.activeTheme.font[%i],14,0,65535);
+		populateFontCacheRange(%this.activeTheme.font[%i],16,0,65535);
+		populateFontCacheRange(%this.activeTheme.font[%i],18,0,65535);
+		populateFontCacheRange(%this.activeTheme.font[%i],24,0,65535);
+		writeSingleFontCache(%this.activeTheme.font[%i]);
+	}
+	$GUI::fontCacheDirectory = %oldPath;
+}

+ 51 - 34
editor/EditorCore/Themes/TorqueSuitTheme.cs → editor/EditorCore/Themes/TorqueSuit/TorqueSuitTheme.cs

@@ -1,23 +1,13 @@
 function TorqueSuitTheme::init(%this)
 {
 	%this.name = "Torque Suit";
-
 	//fonts and font sizes
-	%this.font = "monaco";
-	%this.fontSize = 12;
-	if ($platform $= "windows")
-	{
-		%this.font = "lucida console";
-	}
-	else if ($platform $= "Android")
-	{
-		%this.font = "Droid";
-		%this.fontSize = 14;
-	}
-	else if($platform $= "ios")
-	{
-		%this.fontSize = 18;
-	}
+	%this.fontCount = 3;
+	%this.font[1] = "raleway";//Most common font
+	%this.font[2] = "Audiowide";//Title fontType
+	%this.font[3] = "vt323";//Code and console font
+	%this.fontDirectory = expandPath("^EditorCore/Themes/TorqueSuit/Fonts");
+	%this.fontSize = 22;
 
 	%this.color1 = "34 19 30 255";
 	%this.color2 = "62 32 52 255";
@@ -45,8 +35,9 @@ function TorqueSuitTheme::makeButtonProfile(%this)
 		fillColorSL = %this.adjustValue(%this.color2, -20);
 		fillColorNA = %this.setAlpha(%this.color2, 80);
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = "255 255 255 150";
@@ -110,8 +101,9 @@ function TorqueSuitTheme::makeTabProfile(%this)
 		fillColorSL = %this.color4;
 		fillColorNA = %this.color2;
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = %this.color1;
@@ -131,8 +123,9 @@ function TorqueSuitTheme::makeTabProfile(%this)
 		fillColorSL = %this.color4;
 		fillColorNA = %this.color2;
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = %this.color1;
@@ -152,8 +145,9 @@ function TorqueSuitTheme::makeTabProfile(%this)
 		fillColorSL = %this.color4;
 		fillColorNA = %this.color2;
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = %this.color1;
@@ -173,8 +167,9 @@ function TorqueSuitTheme::makeTabProfile(%this)
 		fillColorSL = %this.color4;
 		fillColorNA = %this.color2;
 
-		fontType = %this.font;
-		fontSize = %this.fontSize + 2;
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
 		fontColorSL = %this.color1;
@@ -249,6 +244,24 @@ function TorqueSuitTheme::makeTabProfile(%this)
 
 function TorqueSuitTheme::makeTextEditProfile(%this)
 {
+	%labelBorder = new GuiBorderProfile()
+	{
+		padding = 2;
+	};
+	%this.labelProfile = new GuiControlProfile()
+	{
+		fillColor = "0 0 0 0";
+
+		fontType = %this.font[2];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize - 2;
+		fontColor = %this.color4;
+		align = "left";
+		vAlign = "top";
+
+		borderDefault = %labelBorder;
+	};
+
 	//border for text boxes never use the HL state.
 	%textBorderV = new GuiBorderProfile()
 	{
@@ -311,7 +324,8 @@ function TorqueSuitTheme::makeTextEditProfile(%this)
 		fillColorSL = %this.color1;
 		fillColorNA = %this.setAlpha(%this.color1, 80);
 
-		fontType = %this.font;
+		fontType = %this.font[3];
+		fontDirectory = %this.fontDirectory;
 		fontSize = %this.fontSize + 2;
 		fontColor = %this.setAlpha(%this.color4, 220);
 		fontColorHL = %this.adjustValue(%this.color4, 10);
@@ -341,11 +355,11 @@ function TorqueSuitTheme::makeScrollProfile(%this)
 
 	%this.trackProfile = new GuiControlProfile()
 	{
-			fillColor = %this.setAlpha(%this.color2, 150);
-			fillColorHL = %this.setAlpha(%this.color2, 100);
-			fillColorSL = %this.setAlpha(%this.adjustValue(%this.color2, 10), 150);
-			fillColorNA = %this.setAlpha(%this.color2, 50);
-			borderDefault = %trackBorder;
+		fillColor = %this.setAlpha(%this.color2, 150);
+		fillColorHL = %this.setAlpha(%this.color2, 100);
+		fillColorSL = %this.setAlpha(%this.adjustValue(%this.color2, 10), 150);
+		fillColorNA = %this.setAlpha(%this.color2, 50);
+		borderDefault = %trackBorder;
 	};
 
 	%thumbBorder = new GuiBorderProfile()
@@ -381,7 +395,8 @@ function TorqueSuitTheme::makeScrollProfile(%this)
 		fillColorSL = %this.color5;
 		fillColorNA = %this.setAlpha(%this.color3, 80);
 
-		fontType = %this.font;
+		fontType = %this.font[1];
+		fontDirectory = %this.fontDirectory;
 		fontColor = %this.color2;
 		fontColorHL = %this.color2;
 		fontColorSL = %this.adjustValue(%this.color5, -20);
@@ -409,7 +424,9 @@ function TorqueSuitTheme::makeConsoleProfile(%this)
 {
 	%this.consoleProfile = new GuiControlProfile()
 	{
-		fontType = %this.font;
+		fontType = %this.font[3];
+		fontDirectory = %this.fontDirectory;
+		fontSize = %this.fontSize + 2;
 		fontColor = %this.color4; //Normal text
 		fontColorHL = %this.setAlpha(%this.color4, 140); //Warnings
 		fontColorNA = %this.color5; //Errors

BIN
editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 12 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 14 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 16 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 18 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 21 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 22 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/Audiowide 24 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/raleway 12 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/raleway 14 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/raleway 16 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/raleway 18 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/raleway 20 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/raleway 22 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/raleway 24 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/vt323 12 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/vt323 14 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/vt323 16 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/vt323 18 (ansi).uft


BIN
editor/EditorCore/Themes/TorqueSuit/fonts/vt323 24 (ansi).uft


+ 42 - 0
engine/source/graphics/gFont_ScriptBinding.h

@@ -166,6 +166,48 @@ ConsoleFunctionWithDocs(writeFontCache, ConsoleVoid, 1, 1, ())
    }
 }
 
+/*! Force all cached fonts with a given font name in their paths to serialize themselves to the cache.
+	@param fontName The name of the font to search for in the path. Will save if found.
+	@return No return value
+*/
+ConsoleFunctionWithDocs(writeSingleFontCache, ConsoleVoid, 2, 2, (fontName))
+{
+	FindMatch match("*.uft", 4096);
+	ResourceManager->findMatches(&match);
+
+	Con::printf("--------------------------------------------------------------------------");
+	Con::printf("   Writing font cache for font face %s to disk", argv[1]);
+
+	for (U32 i = 0; i < (U32)match.numMatches(); i++)
+	{
+		char *curMatch = match.matchList[i];
+		if(dStrstr(curMatch, argv[1]) != NULL )
+		{
+			Resource<GFont> font = ResourceManager->load(curMatch);
+
+			// Deal with inexplicably missing or failed to load fonts.
+			if (font.isNull())
+			{
+				Con::errorf(" o Couldn't find font : %s", curMatch);
+				continue;
+			}
+
+			// Ok, dump info!
+			FileStream stream;
+			if (ResourceManager->openFileForWrite(stream, curMatch))
+			{
+				Con::printf("      o Writing '%s' to disk...", curMatch);
+				font->write(stream);
+				stream.close();
+			}
+			else
+			{
+				Con::errorf("      o Could not open '%s' for write!", curMatch);
+			}
+		}
+	}
+}
+
 /*! 
     Populate the font cache for all fonts with characters from the specified string.
     @param inString The string to use to set the font caches

+ 17 - 8
engine/source/gui/containers/guiTabBookCtrl.cc

@@ -50,7 +50,7 @@ IMPLEMENT_CONOBJECT(GuiTabBookCtrl);
 GuiTabBookCtrl::GuiTabBookCtrl()
 {
    VECTOR_SET_ASSOCIATION(mPages);
-   mLastFontHeight = 0;
+   mFontHeight = 0;
    mTabPosition = GuiTabBookCtrl::AlignTop;
    mLastTabPosition = mTabPosition;
    mActivePage = NULL;
@@ -197,6 +197,7 @@ void GuiTabBookCtrl::setControlTabProfile(GuiControlProfile* prof)
     if (mAwake)
         mTabProfile->incRefCount();
 
+	calculatePageTabs();
 }
 
 void GuiTabBookCtrl::addNewPage()
@@ -487,17 +488,18 @@ void GuiTabBookCtrl::solveDirty()
       mLastTabPosition = mTabPosition;
       dirty = true;
    }
-
-   if( mTabProfile != NULL && mTabProfile->mFont != NULL && mTabProfile->mFont->getHeight() != mLastFontHeight )
+   else if( mTabProfile != NULL && mTabProfile->mFont != NULL && mTabProfile->mFont->getHeight() != mFontHeight )
    {
-	   mLastFontHeight = mTabProfile->mFont->getHeight();
       dirty = true;
    }
-
-   if( mTabWidth != mLastTabWidth )
+   else if(mPages.size() > 0 && mTabProfile != NULL && mTabProfile->mFont != NULL)
    {
-      mLastTabWidth = mTabWidth;
-      dirty = true;
+	   S32 tabWidth = calculatePageTabWidth(mPages[0].Page);
+	   tabWidth = getMax(tabWidth, mMinTabWidth);
+	   if(mTabWidth != tabWidth)
+	   {
+		  dirty = true;
+	   }
    }
 
    if( dirty )
@@ -547,6 +549,7 @@ void GuiTabBookCtrl::calculatePageTabs()
    S32 tabHeight  = 0;
    RectI innerRect = getInnerRect(mBounds.point, mBounds.extent, NormalState, mProfile);
    Point2I fontBasedBounds = getOuterExtent(Point2I(mTabProfile->mFont->getHeight(), mTabProfile->mFont->getHeight()), NormalState, mTabProfile);
+   mFontHeight = mTabProfile->mFont->getHeight();
 
    if (mTabPosition == AlignTop || mTabPosition == AlignBottom)
    {
@@ -562,6 +565,12 @@ void GuiTabBookCtrl::calculatePageTabs()
       // Fetch Tab Width
       S32 tabWidth = calculatePageTabWidth( mPages[i].Page );
       tabWidth = getMax( tabWidth, mMinTabWidth );
+
+	  if (i == 0)
+	  {
+		  mTabWidth = tabWidth;
+	  }
+
       TabHeaderInfo &info = mPages[i];
       switch( mTabPosition )
       {

+ 3 - 4
engine/source/gui/containers/guiTabBookCtrl.h

@@ -91,10 +91,9 @@ private:
    S32                     mMinTabWidth;     ///< Minimum Width a tab will display as.
    TabPosition             mTabPosition;     ///< Current tab position (see alignment)
    TabPosition             mLastTabPosition; ///< Last known tab position, stored to compare to tabPosition to know when to resize children
-   S32                     mLastFontHeight;  ///< Last known font height
-   S32                     mTabWidth;        ///< Current tab width
-   S32                     mLastTabWidth;    ///< Last know tab width, stored to compare to current tabWidth to know when to resize children
-
+   S32                     mFontHeight;      ///< Last known font height
+   S32                     mTabWidth;        ///< Current tab width of the first tab
+   
    enum
    {
 		TabSelected = 0,		///< Index of selected tab texture

+ 3 - 6
engine/source/gui/guiConsole.cc

@@ -41,9 +41,6 @@ bool GuiConsole::onWake()
    if (! Parent::onWake())
       return false;
 
-   //get the font
-   mFont = mProfile->mFont;
-
    return true;
 }
 
@@ -60,7 +57,7 @@ S32 GuiConsole::getMaxWidth(S32 startIndex, S32 endIndex)
 
    S32 result = 0;
    for(S32 i = startIndex; i <= endIndex; i++)
-      result = getMax(result, (S32)(mFont->getStrWidth((const UTF8 *)log[i].mString)));
+      result = getMax(result, (S32)(mProfile->mFont->getStrWidth((const UTF8 *)log[i].mString)));
    
    Con::unlockLog();
    
@@ -92,7 +89,7 @@ void GuiConsole::onPreRender()
       //find the max cell width for the new entries
       S32 newMax = getMaxWidth(0, size - 1);
       if(newMax > mCellSize.x)
-         mCellSize.set(newMax, mFont->getHeight());
+         mCellSize.set(newMax, mProfile->mFont->getHeight());
 
       //set the array size
       mSize.set(1, size);
@@ -121,7 +118,7 @@ void GuiConsole::onRenderCell(Point2I offset, Point2I cell, bool selected, bool
       case ConsoleLogEntry::Error:    dglSetBitmapModulation(mProfile->mFontColorNA); break;
       case ConsoleLogEntry::NUM_CLASS: Con::errorf("Unhandled case in GuiConsole::onRenderCell, NUM_CLASS");
    }
-   dglDrawText(mFont, Point2I(offset.x + 3, offset.y), entry.mString, mProfile->mFontColors);
+   dglDrawText(mProfile->mFont, Point2I(offset.x + 3, offset.y), entry.mString, mProfile->mFontColors);
    
    Con::unlockLog();
 }

+ 0 - 2
engine/source/gui/guiConsole.h

@@ -32,8 +32,6 @@ class GuiConsole : public GuiArrayCtrl
    private:
       typedef GuiArrayCtrl Parent;
 
-      Resource<GFont> mFont;
-
       S32 getMaxWidth(S32 startIndex, S32 endIndex);
 
    public:

+ 1 - 1
engine/source/gui/guiMLTextCtrl.cc

@@ -936,7 +936,7 @@ GuiMLTextCtrl::Font *GuiMLTextCtrl::allocFont(const char *faceName, U32 faceName
    ret->faceNameLen = faceNameLen;
    ret->size = size;
    ret->next = mFontList;
-   ret->fontRes = GFont::create(ret->faceName, size, GuiControlProfile::sFontCacheDirectory);
+   ret->fontRes = GFont::create(ret->faceName, size, mProfile->mFontDirectory);
    if(bool(ret->fontRes))
    {
       ret->next = mFontList;

+ 21 - 25
engine/source/gui/guiTextEditCtrl.cc

@@ -146,9 +146,6 @@ bool GuiTextEditCtrl::onWake()
    if (! Parent::onWake())
       return false;
 
-   mFont = mProfile->mFont;
-   AssertFatal(mFont, "GuiTextCtrl::onWake: invalid font in profile");
-
    if (mConsoleVariable[0])
    {
 	   const char *txt = Con::getVariable(mConsoleVariable);
@@ -178,7 +175,6 @@ bool GuiTextEditCtrl::onWake()
 void GuiTextEditCtrl::onSleep()
 {
    Parent::onSleep();
-   mFont = NULL;
 
    // If this is the last awake text edit control, disable keyboard translation
    --smNumAwake;
@@ -249,10 +245,9 @@ void GuiTextEditCtrl::setText( const UTF8 *txt )
 
 	//Make sure we have a font
 	mProfile->incRefCount();
-	mFont = mProfile->mFont;
 
 	//If the font isn't found, we want to decrement the profile usage and return now or we may crash!
-	if (mFont.isNull())
+	if (mProfile->mFont.isNull())
 	{
 		//decrement the profile referrence
 		mProfile->decRefCount();
@@ -366,13 +361,13 @@ S32 GuiTextEditCtrl::setCursorPos( const Point2I &offset )
    for(count=0; count< (S32)mTextBuffer.length(); count++)
    {
       UTF16 c = mTextBuffer.getChar(count);
-      if(!mPasswordText && !mFont->isValidChar(c))
+      if(!mPasswordText && !mProfile->mFont->isValidChar(c))
          continue;
          
       if(mPasswordText)
-         charLength += mFont->getCharXIncrement( mPasswordMask[0] );
+         charLength += mProfile->mFont->getCharXIncrement( mPasswordMask[0] );
       else
-         charLength += mFont->getCharXIncrement( c );
+         charLength += mProfile->mFont->getCharXIncrement( c );
 
       if ( charLength > curX )
          break;      
@@ -1041,10 +1036,10 @@ dealWithBackspace:
          return Parent::onKeyDown( event );
    }
 
-   if(mFont.isNull())
+   if(mProfile->mFont.isNull())
        return false;
 
-   if ( mFont->isValidChar( event.ascii ) )
+   if ( mProfile->mFont->isValidChar( event.ascii ) )
    {
       // Get the character ready to add to a UTF8 string.
       UTF16 convertedChar[2] = { event.ascii, 0 };
@@ -1265,11 +1260,12 @@ void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentSt
 	   }
 
 	   // Center vertically:
-	   drawPoint.y += ( ( drawRect.extent.y - mFont->getHeight() ) / 2 );
+	   S32 h = mProfile->mFont->getHeight();
+	   drawPoint.y += ( ( drawRect.extent.y - h ) / 2 );
 
 	   // Align horizontally:
    
-	   S32 textWidth = mFont->getStrNWidth(textBuffer.getPtr(), textBuffer.length());
+	   S32 textWidth = mProfile->mFont->getStrNWidth(textBuffer.getPtr(), textBuffer.length());
 
 	   if ( drawRect.extent.x > textWidth )
 	   {
@@ -1318,13 +1314,13 @@ void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentSt
 		  // Alright, we want to terminate things momentarily.
 		  if(mCursorPos > 0)
 		  {
-			 cursorOffset = mFont->getStrNWidth(textBuffer.getPtr(), mCursorPos);
+			 cursorOffset = mProfile->mFont->getStrNWidth(textBuffer.getPtr(), mCursorPos);
 		  }
 		  else
 			 cursorOffset = 0;
 
 		  if ( tempChar )
-			 charWidth = mFont->getCharWidth( tempChar );
+			 charWidth = mProfile->mFont->getCharWidth( tempChar );
 		  else
 			 charWidth = 0;
 
@@ -1353,7 +1349,7 @@ void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentSt
 		  cursorStart.x = mTextOffset.x + cursorOffset;
 		  cursorEnd.x = cursorStart.x;
 
-		  S32 cursorHeight = mFont->getHeight();
+		  S32 cursorHeight = mProfile->mFont->getHeight();
 		  if ( cursorHeight < drawRect.extent.y )
 		  {
 			 cursorStart.y = drawPoint.y;
@@ -1382,8 +1378,8 @@ void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentSt
 		  dglSetBitmapModulation( fontColor );
 
 		  const UTF16* preString2 = textBuffer.getPtr();
-		  dglDrawTextN( mFont, tempOffset, preString2, mBlockStart, mProfile->mFontColors);
-		  tempOffset.x += mFont->getStrNWidth(preString2, mBlockStart);
+		  dglDrawTextN( mProfile->mFont, tempOffset, preString2, mBlockStart, mProfile->mFontColors);
+		  tempOffset.x += mProfile->mFont->getStrNWidth(preString2, mBlockStart);
 	   }
 
 	   //draw the hilighted portion
@@ -1392,14 +1388,14 @@ void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentSt
 		  const UTF16* highlightBuff = textBuffer.getPtr() + mBlockStart;
 		  U32 highlightBuffLen = mBlockEnd-mBlockStart;
 
-		  S32 highlightWidth = mFont->getStrNWidth(highlightBuff, highlightBuffLen);
+		  S32 highlightWidth = mProfile->mFont->getStrNWidth(highlightBuff, highlightBuffLen);
 
 		  dglDrawRectFill( Point2I( tempOffset.x, drawRect.point.y + 1 ),
 			 Point2I( tempOffset.x + highlightWidth, drawRect.point.y + drawRect.extent.y - 1),
 			 mProfile->mFillColorHL );
 
 		  dglSetBitmapModulation( mProfile->mFontColorHL );
-		  dglDrawTextN( mFont, tempOffset, highlightBuff, highlightBuffLen, mProfile->mFontColors );
+		  dglDrawTextN( mProfile->mFont, tempOffset, highlightBuff, highlightBuffLen, mProfile->mFontColors );
 		  tempOffset.x += highlightWidth;
 	   }
 
@@ -1416,7 +1412,7 @@ void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentSt
 			  U32 finalBuffLen = truncatedBuffer.length();
 
 			  dglSetBitmapModulation( fontColor );
-			  dglDrawTextN( mFont, tempOffset, truncatedBufferPtr, finalBuffLen, mProfile->mFontColors );
+			  dglDrawTextN( mProfile->mFont, tempOffset, truncatedBufferPtr, finalBuffLen, mProfile->mFontColors );
 		   }
 		   else
 		   {
@@ -1424,7 +1420,7 @@ void GuiTextEditCtrl::drawText( const RectI &drawRect, GuiControlState currentSt
 			  U32 finalBuffLen = mTextBuffer.length() - mBlockEnd;
 
 			  dglSetBitmapModulation( fontColor );
-			  dglDrawTextN( mFont, tempOffset, finalBuff, finalBuffLen, mProfile->mFontColors );
+			  dglDrawTextN( mProfile->mFont, tempOffset, finalBuff, finalBuffLen, mProfile->mFontColors );
 		   }
 	   }
 
@@ -1490,7 +1486,7 @@ StringBuffer GuiTextEditCtrl::truncate(StringBuffer buffer, StringBuffer termina
 			break;
 
 		UTF16 c = buffer.getChar(i);
-		currentWidth += mFont->getCharXIncrement(c);
+		currentWidth += mProfile->mFont->getCharXIncrement(c);
 		count++;
 	}
 
@@ -1510,10 +1506,10 @@ S32 GuiTextEditCtrl::textBufferWidth(StringBuffer buffer)
 	for (S32 count = 0; count < (S32)buffer.length(); count++)
 	{
 		UTF16 c = buffer.getChar(count);
-		if (!mFont->isValidChar(c))
+		if (!mProfile->mFont->isValidChar(c))
 			continue;
 
-		charLength += mFont->getCharXIncrement(c);
+		charLength += mProfile->mFont->getCharXIncrement(c);
 	}
 
 	return charLength;

+ 0 - 1
engine/source/gui/guiTextEditCtrl.h

@@ -40,7 +40,6 @@ private:
 protected:
 
 	S32 mMaxStrLen;   // max string len, must be less then or equal to 255
-	Resource<GFont> mFont;
 	bool     mTruncateWhenUnfocused;
    StringBuffer mTextBuffer;
 

+ 8 - 4
engine/source/gui/guiTypes.cc

@@ -293,8 +293,6 @@ static EnumTable::Enums charsetEnums[]=
 
 static EnumTable gCharsetTable(NUMCHARSETENUMS, &charsetEnums[0]);
 
-StringTableEntry GuiControlProfile::sFontCacheDirectory = "";
-
 GuiControlProfile::GuiControlProfile(void) :
    mFontColor(mFontColors[BaseColor]),
    mFontColorHL(mFontColors[ColorHL]),
@@ -323,6 +321,7 @@ GuiControlProfile::GuiControlProfile(void) :
 	
 	// default font
 	mFontType      = StringTable->EmptyString;
+	mFontDirectory = StringTable->EmptyString;
 	mFontSize      = 12;
 	mFontCharset   = TGE_ANSI_CHARSET;
 	mFontColors[BaseColor].set(255,255,255,255);
@@ -366,6 +365,7 @@ GuiControlProfile::GuiControlProfile(void) :
 
       // default font
       mFontType = def->mFontType;
+	  mFontDirectory = def->mFontDirectory;
       mFontSize = def->mFontSize;
       mFontCharset = def->mFontCharset;
 
@@ -414,8 +414,10 @@ void GuiControlProfile::initPersistFields()
    addField("borderTop",     TypeString, Offset(mTopProfileName, GuiControlProfile));
    addField("borderBottom",  TypeString, Offset(mBottomProfileName, GuiControlProfile));
 
+   addGroup("Font");
    addField("fontType",      TypeString,     Offset(mFontType, GuiControlProfile));
    addField("fontSize",      TypeS32,        Offset(mFontSize, GuiControlProfile));
+   addField("fontDirectory", TypeString,	 Offset(mFontDirectory, GuiControlProfile));
    addField("fontCharset",   TypeEnum,       Offset(mFontCharset, GuiControlProfile), 1, &gCharsetTable);
    addField("fontColors",    TypeColorI,     Offset(mFontColors, GuiControlProfile), 10);
    addField("fontColor",     TypeColorI,     Offset(mFontColors[BaseColor], GuiControlProfile));
@@ -424,6 +426,7 @@ void GuiControlProfile::initPersistFields()
    addField("fontColorSL",   TypeColorI,     Offset(mFontColors[ColorSL], GuiControlProfile));
    addField("fontColorLink", TypeColorI,     Offset(mFontColors[ColorUser0], GuiControlProfile));
    addField("fontColorLinkHL", TypeColorI,     Offset(mFontColors[ColorUser1], GuiControlProfile));
+   endGroup("Font");
 
    addField("align", TypeEnum, Offset(mAlignment, GuiControlProfile), 1, &gAlignTable);
    addField("vAlign", TypeEnum, Offset(mVAlignment, GuiControlProfile), 1, &gVAlignTable);
@@ -732,10 +735,11 @@ void GuiControlProfile::incRefCount()
 {
 	if(!mRefCount)
 	{
-		sFontCacheDirectory = Con::getVariable("$GUI::fontCacheDirectory");
+		if(mFontDirectory == StringTable->EmptyString)
+			mFontDirectory = Con::getVariable("$GUI::fontCacheDirectory");
 
 		//verify the font
-		mFont = GFont::create(mFontType, mFontSize, sFontCacheDirectory);
+		mFont = GFont::create(mFontType, mFontSize, mFontDirectory);
 		if (mFont.isNull())
 			Con::errorf("Failed to load/create profile font (%s/%d)", mFontType, mFontSize);
 

+ 2 - 2
engine/source/gui/guiTypes.h

@@ -166,7 +166,6 @@ public:
    S32  mRefCount;                                 ///< Used to determine if any controls are using this profile
    bool mTabable;                                  ///< True if this object is accessable from using the tab key
 
-   static StringTableEntry  sFontCacheDirectory;
    bool mCanKeyFocus;                              ///< True if the object can be given keyboard focus (in other words, made a first responder @see GuiControl)
    bool mUseInput;                                 ///< True if input events like a click can be passed to this object. False will pass events to the parent and this object and its children will not be evaluated.
 
@@ -190,7 +189,8 @@ public:
    GuiBorderProfile* mBorderRight;
 
    // font members
-   StringTableEntry  mFontType;                    ///< Font face name for the control
+   StringTableEntry  mFontType;
+   StringTableEntry  mFontDirectory;                    ///< Font face name for the control
    S32               mFontSize;                    ///< Font size for the control
    enum {
       BaseColor = 0,

+ 1 - 0
toybox/Sandbox/1/gui/guiProfiles.cs

@@ -147,6 +147,7 @@ if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile)
 
     // font
     fontType = $platformFontType;
+	fontDirectory = expandPath( "^AppCore/fonts" );
     fontSize = $platformFontSize;
     fontColor = "255 255 255 255";
 	align = center;