瀏覽代碼

FontSizeAdjust

With this change, the field FontSizeAdjust can be set on any GuiControl to change the font size for just that control. Rather than simply overriding the profile's FontSize, the FontSizeAdjust is a decimal value that is multiplied by the FontSize to produce a final, actual font size. So a FontSizeAdjust of 1 does nothing. If the FontSize is 12 and the FontSizeAdjust is 0.5, then the calulated font size is 6. This is an extremely useful feature that will eliminate the need to create profiles at every font size.
Peter Robinson 3 年之前
父節點
當前提交
128750d883

+ 4 - 2
editor/EditorCore/scripts/EditorProjectSelector.cs

@@ -52,10 +52,12 @@ function EditorProjectSelector::onAdd(%this)
 	{
 	{
 		HorizSizing="left";
 		HorizSizing="left";
 		VertSizing="bottom";
 		VertSizing="bottom";
-		Position = "924 64";
-		Extent = "100 20";
+		Position = "824 62";
+		Extent = "200 20";
 		Text = getEngineVersion();
 		Text = getEngineVersion();
 		Visible = false;
 		Visible = false;
+		FontSizeAdjust = 1.2;
+		Align = "right";
 	};
 	};
 	ThemeManager.setProfile(%this.versionText, "codeProfile");
 	ThemeManager.setProfile(%this.versionText, "codeProfile");
 	%this.add(%this.versionText);
 	%this.add(%this.versionText);

+ 2 - 2
engine/source/2d/gui/SceneWindow.cc

@@ -2047,11 +2047,11 @@ void SceneWindow::renderMetricsOverlay( Point2I offset, const RectI& updateRect
     // Finish if should not or cannot render.
     // Finish if should not or cannot render.
     if (    ( !fullMetrics && !fpsMetrics ) ||
     if (    ( !fullMetrics && !fpsMetrics ) ||
             mProfile == NULL ||
             mProfile == NULL ||
-            mProfile->mFont.isNull() )            
+            !mProfile->getFont(mFontSizeAdjust) )
             return;
             return;
 
 
     // Fetch the font.
     // Fetch the font.
-    Resource<GFont>& font = mProfile->mFont;    
+    GFont* font = mProfile->getFont(mFontSizeAdjust);
 
 
     // Blending for banner background.
     // Blending for banner background.
     glEnable        ( GL_BLEND );
     glEnable        ( GL_BLEND );

+ 1 - 1
engine/source/gui/containers/guiRolloutCtrl.cc

@@ -331,7 +331,7 @@ void GuiRolloutCtrl::processTick()
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void GuiRolloutCtrl::onRender(Point2I offset, const RectI &updateRect)
 void GuiRolloutCtrl::onRender(Point2I offset, const RectI &updateRect)
 {
 {
-   if( !mProfile || mProfile->mFont.isNull() )
+   if( !mProfile || !mProfile->getFont(mFontSizeAdjust) )
       return;
       return;
   
   
    // Calculate actual world bounds for rendering
    // Calculate actual world bounds for rendering

+ 7 - 6
engine/source/gui/containers/guiTabBookCtrl.cc

@@ -423,16 +423,17 @@ void GuiTabBookCtrl::setUpdate()
 void GuiTabBookCtrl::solveDirty()
 void GuiTabBookCtrl::solveDirty()
 {
 {
    bool dirty = false;
    bool dirty = false;
+   GFont* font = mTabProfile->getFont(mFontSizeAdjust);
    if( mTabPosition != mLastTabPosition )
    if( mTabPosition != mLastTabPosition )
    {
    {
       mLastTabPosition = mTabPosition;
       mLastTabPosition = mTabPosition;
       dirty = true;
       dirty = true;
    }
    }
-   else if( mTabProfile != NULL && mTabProfile->mFont != NULL && mTabProfile->mFont->getHeight() != mFontHeight )
+   else if( mTabProfile != NULL && font != NULL && font->getHeight() != mFontHeight )
    {
    {
       dirty = true;
       dirty = true;
    }
    }
-   else if(mPages.size() > 0 && mTabProfile != NULL && mTabProfile->mFont != NULL)
+   else if(mPages.size() > 0 && mTabProfile != NULL && font != NULL)
    {
    {
 	   S32 tabWidth = calculatePageTabWidth(mPages[0].Page);
 	   S32 tabWidth = calculatePageTabWidth(mPages[0].Page);
 	   tabWidth = getMax(tabWidth, mMinTabWidth);
 	   tabWidth = getMax(tabWidth, mMinTabWidth);
@@ -456,10 +457,10 @@ S32 GuiTabBookCtrl::calculatePageTabWidth( GuiTabPageCtrl *page )
 
 
    StringTableEntry text = page->getText();
    StringTableEntry text = page->getText();
 
 
-   if( !text || dStrlen(text) == 0 || !mTabProfile || !mTabProfile->mFont || mTabProfile->mFont == '\0' )
+   if( !text || dStrlen(text) == 0 || !mTabProfile )
       return mTabWidth;
       return mTabWidth;
 
 
-	S32 textLength = mTabProfile->mFont->getStrNWidth(text, dStrlen(text));
+	S32 textLength = mTabProfile->getFont(mFontSizeAdjust)->getStrNWidth(text, dStrlen(text));
 
 
    Point2I innerExtent = Point2I(textLength, textLength);
    Point2I innerExtent = Point2I(textLength, textLength);
 	Point2I outerExtent = getOuterExtent(innerExtent, NormalState, mTabProfile);
 	Point2I outerExtent = getOuterExtent(innerExtent, NormalState, mTabProfile);
@@ -489,9 +490,9 @@ void GuiTabBookCtrl::calculatePageTabs()
    S32 currY      = 0;
    S32 currY      = 0;
    S32 tabHeight  = 0;
    S32 tabHeight  = 0;
    RectI innerRect = getInnerRect(mBounds.point, mBounds.extent, NormalState, mProfile);
    RectI innerRect = getInnerRect(mBounds.point, mBounds.extent, NormalState, mProfile);
-   Point2I innerExtent = Point2I(mTabProfile->mFont->getHeight(), mTabProfile->mFont->getHeight());
+   mFontHeight = mTabProfile->getFont(mFontSizeAdjust)->getHeight();
+   Point2I innerExtent = Point2I(mFontHeight, mFontHeight);
    Point2I fontBasedBounds = getOuterExtent(innerExtent, NormalState, mTabProfile);
    Point2I fontBasedBounds = getOuterExtent(innerExtent, NormalState, mTabProfile);
-   mFontHeight = mTabProfile->mFont->getHeight();
 
 
    if (mTabPosition == AlignTop || mTabPosition == AlignBottom)
    if (mTabPosition == AlignTop || mTabPosition == AlignBottom)
    {
    {

+ 3 - 3
engine/source/gui/editor/guiInspectorTypes.cc

@@ -467,7 +467,7 @@ GuiControl * GuiInspectorTypeS32::constructEditControl(S32 width)
 
 
 	  retCtrl->mBounds.set(mGroup->mInspector->mControlOffset, Point2I(width - mGroup->mInspector->mControlOffset.x, 30));
 	  retCtrl->mBounds.set(mGroup->mInspector->mControlOffset, Point2I(width - mGroup->mInspector->mControlOffset.x, 30));
 
 
-	  U32 labelWidth = mGroup->mInspector->mLabelProfile->mFont->getStrWidth("00");
+	  U32 labelWidth = mGroup->mInspector->mLabelProfile->getFont(mFontSizeAdjust)->getStrWidth("00");
 	  U32 x = 0, y = 0;
 	  U32 x = 0, y = 0;
       for (U32 i = 0; i < mCount; i++)
       for (U32 i = 0; i < mCount; i++)
       {
       {
@@ -479,7 +479,7 @@ GuiControl * GuiInspectorTypeS32::constructEditControl(S32 width)
          registerEditControl(checkBox);
          registerEditControl(checkBox);
 		 checkBox->setControlProfile(mGroup->mInspector->mCheckboxProfile);
 		 checkBox->setControlProfile(mGroup->mInspector->mCheckboxProfile);
 		 checkBox->setTextOffset(Point2I(2,0));
 		 checkBox->setTextOffset(Point2I(2,0));
-		 checkBox->setTextExtent(Point2I(labelWidth + 2, checkBox->mProfile->mFont->getHeight() + 2));
+		 checkBox->setTextExtent(Point2I(labelWidth + 2, checkBox->mProfile->getFont(mFontSizeAdjust)->getHeight() + 2));
 		 checkBox->setBoxOffset(Point2I(checkBox->getTextExtent().x + 2, 0));
 		 checkBox->setBoxOffset(Point2I(checkBox->getTextExtent().x + 2, 0));
 		 checkBox->setText(szName);
 		 checkBox->setText(szName);
 
 
@@ -520,7 +520,7 @@ GuiControl * GuiInspectorTypeS32::constructEditControl(S32 width)
 
 
       allButton->setText("All");
       allButton->setText("All");
       noneButton->setText("None");
       noneButton->setText("None");
-      Point2I innerExt = Point2I(noneButton->mProfile->mFont->getStrWidth("None"), noneButton->mProfile->mFont->getHeight());
+      Point2I innerExt = Point2I(noneButton->mProfile->getFont(mFontSizeAdjust)->getStrWidth("None"), noneButton->mProfile->getFont(mFontSizeAdjust)->getHeight());
 	   Point2I buttonExt = noneButton->getOuterExtent(innerExt, NormalState, noneButton->mProfile);
 	   Point2I buttonExt = noneButton->getOuterExtent(innerExt, NormalState, noneButton->mProfile);
 
 
       retCtrl->mCellSizeX = getMax(x, (U32)buttonExt.x);
       retCtrl->mCellSizeX = getMax(x, (U32)buttonExt.x);

+ 5 - 5
engine/source/gui/editor/guiMenuBarCtrl.cc

@@ -147,7 +147,7 @@ void GuiMenuBarCtrl::calculateMenus()
 		GuiControl *ctrl = static_cast<GuiControl *>(*i);
 		GuiControl *ctrl = static_cast<GuiControl *>(*i);
 		if (ctrl->isVisible())
 		if (ctrl->isVisible())
 		{
 		{
-			S32 width = ctrl->mProfile->mFont->getStrWidth((const UTF8*)ctrl->getText());
+			S32 width = ctrl->mProfile->getFont(mFontSizeAdjust)->getStrWidth((const UTF8*)ctrl->getText());
 			Point2I innerExtent = Point2I(width, 0);
 			Point2I innerExtent = Point2I(width, 0);
 			Point2I outerExtent = getOuterExtent(innerExtent, NormalState, ctrl->mProfile);
 			Point2I outerExtent = getOuterExtent(innerExtent, NormalState, ctrl->mProfile);
 			ctrl->mBounds.set(Point2I(length, 0), Point2I(outerExtent.x, innerRect.extent.y));
 			ctrl->mBounds.set(Point2I(length, 0), Point2I(outerExtent.x, innerRect.extent.y));
@@ -1298,13 +1298,13 @@ bool GuiMenuListCtrl::onRenderItem(RectI &itemRect, GuiMenuItemCtrl *item)
 		if(item->mDisplayType == GuiMenuItemCtrl::DisplayType::Toggle)
 		if(item->mDisplayType == GuiMenuItemCtrl::DisplayType::Toggle)
 		{
 		{
 			ColorI itemColor = item->mIsOn ? profile->getFillColor(HighlightState) : profile->getFillColor(NormalState);
 			ColorI itemColor = item->mIsOn ? profile->getFillColor(HighlightState) : profile->getFillColor(NormalState);
-			S32 size = profile->mFont->getHeight();
+			S32 size = profile->getFont(mFontSizeAdjust)->getHeight();
 			renderColorBullet(leftIconRect, itemColor, getMin(size, 16));
 			renderColorBullet(leftIconRect, itemColor, getMin(size, 16));
 		}
 		}
 		else if (item->mDisplayType == GuiMenuItemCtrl::DisplayType::Radio)
 		else if (item->mDisplayType == GuiMenuItemCtrl::DisplayType::Radio)
 		{
 		{
 			ColorI itemColor = item->mIsOn ? profile->getFillColor(HighlightState) : profile->getFillColor(NormalState);
 			ColorI itemColor = item->mIsOn ? profile->getFillColor(HighlightState) : profile->getFillColor(NormalState);
-			S32 size = profile->mFont->getHeight();
+			S32 size = profile->getFont(mFontSizeAdjust)->getHeight();
 			renderColorBullet(leftIconRect, itemColor, getMin(size, 16), true);
 			renderColorBullet(leftIconRect, itemColor, getMin(size, 16), true);
 		}
 		}
 
 
@@ -1312,7 +1312,7 @@ bool GuiMenuListCtrl::onRenderItem(RectI &itemRect, GuiMenuItemCtrl *item)
 		RectI rightIconRect = RectI(Point2I(itemRect.point.x + itemRect.extent.x - itemRect.extent.y, itemRect.point.y), leftIconRect.extent);
 		RectI rightIconRect = RectI(Point2I(itemRect.point.x + itemRect.extent.x - itemRect.extent.y, itemRect.point.y), leftIconRect.extent);
 		if (item->mDisplayType == GuiMenuItemCtrl::DisplayType::Menu)
 		if (item->mDisplayType == GuiMenuItemCtrl::DisplayType::Menu)
 		{
 		{
-			S32 size = (profile->mFont->getHeight() / 2);
+			S32 size = (profile->getFont(mFontSizeAdjust)->getHeight() / 2);
 			rightIconRect.inset(2, 0);
 			rightIconRect.inset(2, 0);
 			ColorI color = ColorI(profile->getFontColor(currentState));
 			ColorI color = ColorI(profile->getFontColor(currentState));
 			renderTriangleIcon(rightIconRect, color, GuiDirection::Right, size);
 			renderTriangleIcon(rightIconRect, color, GuiDirection::Right, size);
@@ -1349,7 +1349,7 @@ void GuiMenuListCtrl::updateSize()
 	if (!profile)
 	if (!profile)
 		return;
 		return;
 
 
-	GFont *font = profile->mFont;
+	GFont *font = profile->getFont(mFontSizeAdjust);
 	Point2I contentSize = Point2I(10, font->getHeight() + 2);
 	Point2I contentSize = Point2I(10, font->getHeight() + 2);
 	Point2I spacerSize = Point2I(10, 0);
 	Point2I spacerSize = Point2I(10, 0);
 
 

+ 2 - 2
engine/source/gui/editor/guiParticleGraphInspector.cc

@@ -261,7 +261,7 @@ void GuiParticleGraphInspector::onRender(Point2I offset, const RectI &updateRect
 	RectI contentRect = applyPadding(fillRect.point, fillRect.extent, NormalState, mProfile);
 	RectI contentRect = applyPadding(fillRect.point, fillRect.extent, NormalState, mProfile);
 
 
 	//Make room for the graph labels
 	//Make room for the graph labels
-	GFont *font = mProfile->mFont;
+	GFont *font = mProfile->getFont(mFontSizeAdjust);
 	U32 fontHeight = font->getHeight();
 	U32 fontHeight = font->getHeight();
 	contentRect.extent.y -= fontHeight;
 	contentRect.extent.y -= fontHeight;
 	U8 xReduction = getMax(getMax(fontHeight, font->getStrWidth(mMaxYLabel)), font->getStrWidth(mMinYLabel));
 	U8 xReduction = getMax(getMax(fontHeight, font->getStrWidth(mMaxYLabel)), font->getStrWidth(mMinYLabel));
@@ -293,7 +293,7 @@ void GuiParticleGraphInspector::onRender(Point2I offset, const RectI &updateRect
 
 
 void GuiParticleGraphInspector::renderLabels(const RectI &contentRect, const ColorI &labelColor)
 void GuiParticleGraphInspector::renderLabels(const RectI &contentRect, const ColorI &labelColor)
 {
 {
-	GFont *font = mProfile->mFont;
+	GFont *font = mProfile->getFont(mFontSizeAdjust);
 	U32 fontHeight = font->getHeight();
 	U32 fontHeight = font->getHeight();
 	U32 textWidth;
 	U32 textWidth;
 	Point2I textPoint;
 	Point2I textPoint;

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

@@ -45,7 +45,7 @@ bool GuiArrayCtrl::onWake()
       return false;
       return false;
 
 
    //get the font
    //get the font
-   mFont = mProfile->mFont;
+   mFont = mProfile->getFont(mFontSizeAdjust);
 
 
    return true;
    return true;
 }
 }

+ 1 - 1
engine/source/gui/guiArrayCtrl.h

@@ -42,7 +42,7 @@ protected:
    Point2I mSelectedCell;
    Point2I mSelectedCell;
    Point2I mMouseOverCell;
    Point2I mMouseOverCell;
 
 
-   Resource<GFont> mFont;
+   GFont* mFont;
 
 
    bool cellSelected(Point2I cell);
    bool cellSelected(Point2I cell);
    virtual void onCellSelected(Point2I cell);
    virtual void onCellSelected(Point2I cell);

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

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

+ 11 - 9
engine/source/gui/guiControl.cc

@@ -97,8 +97,9 @@ GuiControl::GuiControl()
    mText                = StringTable->EmptyString;
    mText                = StringTable->EmptyString;
    mTextID              = StringTable->EmptyString;
    mTextID              = StringTable->EmptyString;
 
 
-   mAlignment = AlignmentType::DefaultAlign;
-   mVAlignment = VertAlignmentType::DefaultVAlign;
+   mAlignment           = AlignmentType::DefaultAlign;
+   mVAlignment          = VertAlignmentType::DefaultVAlign;
+   mFontSizeAdjust      = 1;
 
 
    mLangTable           = NULL;
    mLangTable           = NULL;
    mFirstResponder      = NULL;
    mFirstResponder      = NULL;
@@ -229,6 +230,7 @@ void GuiControl::initPersistFields()
    addField("textExtend", TypeBool, Offset(mTextExtend, GuiControl), &writeTextExtendFn, "If true, extent will change based on the size of the control's text when possible.");
    addField("textExtend", TypeBool, Offset(mTextExtend, GuiControl), &writeTextExtendFn, "If true, extent will change based on the size of the control's text when possible.");
    addField("align", TypeEnum, Offset(mAlignment, GuiControl), 1, &gAlignCtrlTable);
    addField("align", TypeEnum, Offset(mAlignment, GuiControl), 1, &gAlignCtrlTable);
    addField("vAlign", TypeEnum, Offset(mVAlignment, GuiControl), 1, &gVAlignCtrlTable);
    addField("vAlign", TypeEnum, Offset(mVAlignment, GuiControl), 1, &gVAlignCtrlTable);
+   addField("fontSizeAdjust", TypeF32, Offset(mFontSizeAdjust, GuiControl), "A decimal value that is multiplied with the profile's fontSize to determine the control's actual font size.");
    endGroup("Text");
    endGroup("Text");
 }
 }
 
 
@@ -685,7 +687,7 @@ bool GuiControl::renderTooltip(Point2I &cursorPos, const char* tipText )
     if (!mTooltipProfile)
     if (!mTooltipProfile)
 		setField("TooltipProfile", "GuiTooltipProfile");
 		setField("TooltipProfile", "GuiTooltipProfile");
 
 
-    GFont *font = mTooltipProfile->mFont;
+    GFont *font = mTooltipProfile->getFont();
    
    
     // Set text bounds.
     // Set text bounds.
     Point2I textBounds( 0, 0 );
     Point2I textBounds( 0, 0 );
@@ -1789,7 +1791,7 @@ void GuiControl::renderText(const Point2I& offset, const Point2I& extent, const
     {
     {
         dglSetClipRect(clipRect);
         dglSetClipRect(clipRect);
 
 
-        const S32 textHeight = profile->mFont->getHeight();
+        const S32 textHeight = profile->getFont(mFontSizeAdjust)->getHeight();
         S32 totalWidth = (rot == tRotateNone) ? extent.x : extent.y;
         S32 totalWidth = (rot == tRotateNone) ? extent.x : extent.y;
         S32 totalHeight = (rot == tRotateNone) ? extent.y : extent.x;
         S32 totalHeight = (rot == tRotateNone) ? extent.y : extent.x;
 
 
@@ -1809,7 +1811,7 @@ void GuiControl::renderText(const Point2I& offset, const Point2I& extent, const
             }
             }
             else
             else
             {
             {
-                extent.x = getOuterWidth(profile->mFont->getStrWidth(text), NormalState, profile);
+                extent.x = getOuterWidth(profile->getFont(mFontSizeAdjust)->getStrWidth(text), NormalState, profile);
             }
             }
             setExtent(extent);
             setExtent(extent);
         }
         }
@@ -1834,7 +1836,7 @@ void GuiControl::renderText(const Point2I& offset, const Point2I& extent, const
 
 
 void GuiControl::renderLineList(const Point2I& offset, const Point2I& extent, const S32 startOffsetY, const vector<string> lineList, GuiControlProfile* profile, const TextRotationOptions rot)
 void GuiControl::renderLineList(const Point2I& offset, const Point2I& extent, const S32 startOffsetY, const vector<string> lineList, GuiControlProfile* profile, const TextRotationOptions rot)
 {
 {
-    const S32 textHeight = profile->mFont->getHeight();
+    const S32 textHeight = profile->getFont(mFontSizeAdjust)->getHeight();
     S32 totalWidth = (rot == tRotateNone) ? extent.x : extent.y;
     S32 totalWidth = (rot == tRotateNone) ? extent.x : extent.y;
 
 
 	//Now print each line
 	//Now print each line
@@ -1846,7 +1848,7 @@ void GuiControl::renderLineList(const Point2I& offset, const Point2I& extent, co
 	{
 	{
 		// align the horizontal
 		// align the horizontal
         string trimmedLine = Utility::trim_copy(line);
         string trimmedLine = Utility::trim_copy(line);
-		U32 textWidth = profile->mFont->getStrWidth(trimmedLine.c_str());
+		U32 textWidth = profile->getFont(mFontSizeAdjust)->getStrWidth(trimmedLine.c_str());
 		if(textWidth < totalWidth)
 		if(textWidth < totalWidth)
 		{
 		{
             offsetX = getTextHorizontalOffset(textWidth, totalWidth, getAlignmentType(profile));
             offsetX = getTextHorizontalOffset(textWidth, totalWidth, getAlignmentType(profile));
@@ -1883,7 +1885,7 @@ void GuiControl::renderLineList(const Point2I& offset, const Point2I& extent, co
 
 
 vector<string> GuiControl::getLineList(const char* text, GuiControlProfile* profile, S32 totalWidth)
 vector<string> GuiControl::getLineList(const char* text, GuiControlProfile* profile, S32 totalWidth)
 {
 {
-    GFont* font = profile->mFont;
+    GFont* font = profile->getFont(mFontSizeAdjust);
     vector<string> lineList = vector<string>();
     vector<string> lineList = vector<string>();
 
 
     if (!mTextWrap)
     if (!mTextWrap)
@@ -1948,7 +1950,7 @@ vector<string> GuiControl::getLineList(const char* text, GuiControlProfile* prof
 
 
 void GuiControl::renderTextLine(const Point2I& startPoint, const string line, GuiControlProfile* profile, F32 rotationInDegrees, U32, U32)
 void GuiControl::renderTextLine(const Point2I& startPoint, const string line, GuiControlProfile* profile, F32 rotationInDegrees, U32, U32)
 {
 {
-    dglDrawText(profile->mFont, startPoint, line.c_str(), profile->mFontColors, 9, rotationInDegrees);
+    dglDrawText(profile->getFont(mFontSizeAdjust), startPoint, line.c_str(), profile->mFontColors, 9, rotationInDegrees);
 }
 }
 
 
 S32 GuiControl::getTextHorizontalOffset(S32 textWidth, S32 totalWidth, AlignmentType align)
 S32 GuiControl::getTextHorizontalOffset(S32 textWidth, S32 totalWidth, AlignmentType align)

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

@@ -212,6 +212,7 @@ protected:
 
 
     AlignmentType       mAlignment;
     AlignmentType       mAlignment;
     VertAlignmentType   mVAlignment;
     VertAlignmentType   mVAlignment;
+    F32                 mFontSizeAdjust;
 
 
     /// @}
     /// @}
 
 

+ 2 - 2
engine/source/gui/guiListBoxCtrl.cc

@@ -587,10 +587,10 @@ void GuiListBoxCtrl::setItemText( S32 index, StringTableEntry text )
 #pragma region Sizing
 #pragma region Sizing
 void GuiListBoxCtrl::updateSize()
 void GuiListBoxCtrl::updateSize()
 {
 {
-   if( !mProfile || !mProfile->mFont )
+   if( !mProfile || !mProfile->getFont(mFontSizeAdjust))
       return;
       return;
 
 
-   GFont *font = mProfile->mFont;
+   GFont *font = mProfile->getFont(mFontSizeAdjust);
    Point2I contentSize = Point2I(10, font->getHeight() + 2);
    Point2I contentSize = Point2I(10, font->getHeight() + 2);
 
 
    if (!mFitParentWidth)
    if (!mFitParentWidth)

+ 21 - 17
engine/source/gui/guiMessageVectorCtrl.cc

@@ -194,7 +194,7 @@ void GuiMessageVectorCtrl::lineInserted(const U32 arg)
       numLines += mLineWrappings[i].numLines;
       numLines += mLineWrappings[i].numLines;
    }
    }
 
 
-   U32 newHeight = (mProfile->mFont->getHeight() + mLineSpacingPixels) * getMax(numLines, U32(1));
+   U32 newHeight = (mProfile->getFont(mFontSizeAdjust)->getHeight() + mLineSpacingPixels) * getMax(numLines, U32(1));
    resize(mBounds.point, Point2I(mBounds.extent.x, newHeight));
    resize(mBounds.point, Point2I(mBounds.extent.x, newHeight));
    if(fullyScrolled)
    if(fullyScrolled)
       pScroll->scrollTo(0, 0x7FFFFFFF);
       pScroll->scrollTo(0, 0x7FFFFFFF);
@@ -240,7 +240,7 @@ void GuiMessageVectorCtrl::lineDeleted(const U32 arg)
       numLines += mLineWrappings[i].numLines;
       numLines += mLineWrappings[i].numLines;
    }
    }
 
 
-   U32 newHeight = (mProfile->mFont->getHeight() + mLineSpacingPixels) * getMax(numLines, U32(1));
+   U32 newHeight = (mProfile->getFont(mFontSizeAdjust)->getHeight() + mLineSpacingPixels) * getMax(numLines, U32(1));
    resize(mBounds.point, Point2I(mBounds.extent.x, newHeight));
    resize(mBounds.point, Point2I(mBounds.extent.x, newHeight));
 }
 }
 
 
@@ -251,7 +251,7 @@ void GuiMessageVectorCtrl::vectorDeleted()
    AssertFatal(mLineWrappings.size() == 0, "Error, line wrappings not properly cleared out!");
    AssertFatal(mLineWrappings.size() == 0, "Error, line wrappings not properly cleared out!");
 
 
    mMessageVector = NULL;
    mMessageVector = NULL;
-   U32 newHeight = mProfile->mFont->getHeight() + mLineSpacingPixels;
+   U32 newHeight = mProfile->getFont(mFontSizeAdjust)->getHeight() + mLineSpacingPixels;
    resize(mBounds.point, Point2I(mBounds.extent.x, newHeight));
    resize(mBounds.point, Point2I(mBounds.extent.x, newHeight));
 }
 }
 
 
@@ -387,13 +387,13 @@ void GuiMessageVectorCtrl::createLineWrapping(LineWrapping& rWrapping, const cha
       }
       }
 
 
       // Ok, there's some actual text in this line.  How long is it?
       // Ok, there's some actual text in this line.  How long is it?
-      U32 baseLength = mProfile->mFont->getStrNWidthPrecise((const UTF8 *)&string[rLine.start], rLine.end-rLine.start+1);
+      U32 baseLength = mProfile->getFont(mFontSizeAdjust)->getStrNWidthPrecise((const UTF8 *)&string[rLine.start], rLine.end-rLine.start+1);
       if (baseLength > splitWidth) {
       if (baseLength > splitWidth) {
          // DMMNOTE: Replace with bin search eventually
          // DMMNOTE: Replace with bin search eventually
          U32 currPos;
          U32 currPos;
          U32 breakPos;
          U32 breakPos;
          for (currPos = 0; currPos < (U32)(rLine.end-rLine.start+1); currPos++) {
          for (currPos = 0; currPos < (U32)(rLine.end-rLine.start+1); currPos++) {
-            U32 currLength = mProfile->mFont->getStrNWidthPrecise((const UTF8 *)&string[rLine.start], currPos+1);
+            U32 currLength = mProfile->getFont(mFontSizeAdjust)->getStrNWidthPrecise((const UTF8 *)&string[rLine.start], currPos+1);
             if (currLength > splitWidth) {
             if (currLength > splitWidth) {
                // Make sure that the currPos has advanced, then set the breakPoint.
                // Make sure that the currPos has advanced, then set the breakPoint.
                breakPos = currPos != 0 ? currPos - 1 : 0;
                breakPos = currPos != 0 ? currPos - 1 : 0;
@@ -568,15 +568,16 @@ bool GuiMessageVectorCtrl::onWake()
    if (Parent::onWake() == false)
    if (Parent::onWake() == false)
       return false;
       return false;
 
 
-   if (bool(mProfile->mFont) == false)
+   GFont* font = mProfile->getFont(mFontSizeAdjust);
+   if (bool(font) == false)
       return false;
       return false;
 
 
    mMinSensibleWidth = 1;
    mMinSensibleWidth = 1;
 
 
    for (U32 i = 0; i < 256; i++) {
    for (U32 i = 0; i < 256; i++) {
-      if (mProfile->mFont->isValidChar(U8(i))) {
-         if (mProfile->mFont->getCharWidth(U8(i)) > mMinSensibleWidth)
-            mMinSensibleWidth = mProfile->mFont->getCharWidth(U8(i));
+      if (font->isValidChar(U8(i))) {
+         if (font->getCharWidth(U8(i)) > mMinSensibleWidth)
+            mMinSensibleWidth = font->getCharWidth(U8(i));
       }
       }
    }
    }
 
 
@@ -600,8 +601,11 @@ void GuiMessageVectorCtrl::onRender(Point2I      offset,
                                     const RectI& updateRect)
                                     const RectI& updateRect)
 {
 {
    Parent::onRender(offset, updateRect);
    Parent::onRender(offset, updateRect);
+
+   GFont* font = mProfile->getFont(mFontSizeAdjust);
+
    if (isAttached()) {
    if (isAttached()) {
-      U32 linePixels = mProfile->mFont->getHeight() + mLineSpacingPixels;
+      U32 linePixels = font->getHeight() + mLineSpacingPixels;
       U32 currLine   = 0;
       U32 currLine   = 0;
       for (U32 i = 0; i < mMessageVector->getNumLines(); i++) {
       for (U32 i = 0; i < mMessageVector->getNumLines(); i++) {
 
 
@@ -612,7 +616,7 @@ void GuiMessageVectorCtrl::onRender(Point2I      offset,
 
 
             Point2I globalCheck  = localToGlobalCoord(localStart);
             Point2I globalCheck  = localToGlobalCoord(localStart);
             U32 globalRangeStart = globalCheck.y;
             U32 globalRangeStart = globalCheck.y;
-            U32 globalRangeEnd   = globalCheck.y + mProfile->mFont->getHeight();
+            U32 globalRangeEnd   = globalCheck.y + font->getHeight();
             if (globalRangeStart > (U32)(updateRect.point.y + updateRect.extent.y) ||
             if (globalRangeStart > (U32)(updateRect.point.y + updateRect.extent.y) ||
                 globalRangeEnd   < (U32)updateRect.point.y) {
                 globalRangeEnd   < (U32)updateRect.point.y) {
                currLine++;
                currLine++;
@@ -631,14 +635,14 @@ void GuiMessageVectorCtrl::onRender(Point2I      offset,
                if (walkAcross->specialReference == -1) {
                if (walkAcross->specialReference == -1) {
                   dglSetBitmapModulation(lastColor);
                   dglSetBitmapModulation(lastColor);
                   dglSetTextAnchorColor(mProfile->mFontColor);
                   dglSetTextAnchorColor(mProfile->mFontColor);
-                  strWidth = dglDrawTextN(mProfile->mFont, globalStart, &mMessageVector->getLine(i).message[walkAcross->start],
+                  strWidth = dglDrawTextN(font, globalStart, &mMessageVector->getLine(i).message[walkAcross->start],
                                           walkAcross->end - walkAcross->start + 1, mProfile->mFontColors, mMaxColorIndex);
                                           walkAcross->end - walkAcross->start + 1, mProfile->mFontColors, mMaxColorIndex);
                   dglGetBitmapModulation(&lastColor);
                   dglGetBitmapModulation(&lastColor);
                } else {
                } else {
                   dglGetBitmapModulation(&lastColor);
                   dglGetBitmapModulation(&lastColor);
                   dglSetBitmapModulation(mSpecialColor);
                   dglSetBitmapModulation(mSpecialColor);
                   dglSetTextAnchorColor(mProfile->mFontColor);
                   dglSetTextAnchorColor(mProfile->mFontColor);
-                  strWidth = dglDrawTextN(mProfile->mFont, globalStart, &mMessageVector->getLine(i).message[walkAcross->start],
+                  strWidth = dglDrawTextN(font, globalStart, &mMessageVector->getLine(i).message[walkAcross->start],
                                           walkAcross->end - walkAcross->start + 1);
                                           walkAcross->end - walkAcross->start + 1);
 
 
                   // in case we have 2 in a row...
                   // in case we have 2 in a row...
@@ -648,9 +652,9 @@ void GuiMessageVectorCtrl::onRender(Point2I      offset,
                if (walkAcross->specialReference != -1) {
                if (walkAcross->specialReference != -1) {
                   Point2I lineStart = localStart;
                   Point2I lineStart = localStart;
                   Point2I lineEnd   = localStart;
                   Point2I lineEnd   = localStart;
-                  lineStart.y += mProfile->mFont->getBaseline() + 1;
+                  lineStart.y += font->getBaseline() + 1;
                   lineEnd.x += strWidth;
                   lineEnd.x += strWidth;
-                  lineEnd.y += mProfile->mFont->getBaseline() + 1;
+                  lineEnd.y += font->getBaseline() + 1;
 
 
                   dglDrawLine(localToGlobalCoord(lineStart),
                   dglDrawLine(localToGlobalCoord(lineStart),
                               localToGlobalCoord(lineEnd),
                               localToGlobalCoord(lineEnd),
@@ -702,7 +706,7 @@ void GuiMessageVectorCtrl::findSpecialFromCoord(const Point2I& point, S32* speci
       return;
       return;
    }
    }
 
 
-   U32 linePixels = mProfile->mFont->getHeight() + mLineSpacingPixels;
+   U32 linePixels = mProfile->getFont(mFontSizeAdjust)->getHeight() + mLineSpacingPixels;
 
 
    if ((point.x < 0 || point.x >= mBounds.extent.x) ||
    if ((point.x < 0 || point.x >= mBounds.extent.x) ||
        (point.y < 0 || point.y >= mBounds.extent.y)) {
        (point.y < 0 || point.y >= mBounds.extent.y)) {
@@ -764,7 +768,7 @@ void GuiMessageVectorCtrl::findSpecialFromCoord(const Point2I& point, S32* speci
    }
    }
 
 
    while (line) {
    while (line) {
-      U32 newX = currX + mProfile->mFont->getStrNWidth((const UTF8 *)mMessageVector->getLine(elemIndex).message,
+      U32 newX = currX + mProfile->getFont(mFontSizeAdjust)->getStrNWidth((const UTF8 *)mMessageVector->getLine(elemIndex).message,
                                                        line->end - line->start + 1);
                                                        line->end - line->start + 1);
       if (point.x < (S32)newX) {
       if (point.x < (S32)newX) {
          // That's the one!
          // That's the one!

+ 3 - 3
engine/source/gui/guiSliderCtrl.cc

@@ -76,7 +76,7 @@ bool GuiSliderCtrl::onWake()
     if (!Parent::onWake())
     if (!Parent::onWake())
         return false;
         return false;
 
 
-    if (mThumbSize.y + mProfile->mFont->getHeight() - 4 <= (U32) mBounds.extent.y)
+    if (mThumbSize.y + mProfile->getFont(mFontSizeAdjust)->getHeight() - 4 <= (U32) mBounds.extent.y)
         mDisplayValue = true;
         mDisplayValue = true;
     else
     else
         mDisplayValue = false;
         mDisplayValue = false;
@@ -450,7 +450,7 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
 
 
         Point2I textStart = thumb.point;
         Point2I textStart = thumb.point;
 
 
-        S32 txt_w = mProfile->mFont->getStrWidth((const UTF8 *) buf);
+        S32 txt_w = mProfile->getFont(mFontSizeAdjust)->getStrWidth((const UTF8 *) buf);
 
 
         textStart.x += (S32) ((thumb.extent.x / 2.0f));
         textStart.x += (S32) ((thumb.extent.x / 2.0f));
         textStart.y += thumb.extent.y - 2; //19
         textStart.y += thumb.extent.y - 2; //19
@@ -461,7 +461,7 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
             textStart.x -= ((textStart.x + txt_w) - (offset.x + mBounds.extent.x));
             textStart.x -= ((textStart.x + txt_w) - (offset.x + mBounds.extent.x));
 
 
         dglSetBitmapModulation(mProfile->mFontColor);
         dglSetBitmapModulation(mProfile->mFontColor);
-        dglDrawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
+        dglDrawText(mProfile->getFont(mFontSizeAdjust), textStart, buf, mProfile->mFontColors);
     }
     }
     renderChildControls(offset, mBounds, updateRect);
     renderChildControls(offset, mBounds, updateRect);
 }
 }

+ 38 - 36
engine/source/gui/guiTextEditCtrl.cc

@@ -46,7 +46,7 @@ GuiTextEditTextBlock::GuiTextEditTextBlock()
     mLineStartIbeamValue = 0;
     mLineStartIbeamValue = 0;
 }
 }
 
 
-void GuiTextEditTextBlock::render(const RectI& bounds, string line, U32 ibeamStartValue, GuiControlProfile* profile, GuiControlState currentState, GuiTextEditSelection& selector, AlignmentType align)
+void GuiTextEditTextBlock::render(const RectI& bounds, string line, U32 ibeamStartValue, GuiControlProfile* profile, GuiControlState currentState, GuiTextEditSelection& selector, AlignmentType align, GFont* font)
 {
 {
     mGlobalBounds.set(bounds.point, bounds.extent);
     mGlobalBounds.set(bounds.point, bounds.extent);
     mText.assign(line);
     mText.assign(line);
@@ -62,27 +62,27 @@ void GuiTextEditTextBlock::render(const RectI& bounds, string line, U32 ibeamSta
         U32 lengthOfPostBlockText = mClamp(line.length() - (selEnd - mLineStartIbeamValue), 0, line.length());
         U32 lengthOfPostBlockText = mClamp(line.length() - (selEnd - mLineStartIbeamValue), 0, line.length());
         U32 lengthOfHighlightBlockText = mClamp(line.length() - (lengthOfPreBlockText + lengthOfPostBlockText), 0, line.length());
         U32 lengthOfHighlightBlockText = mClamp(line.length() - (lengthOfPreBlockText + lengthOfPostBlockText), 0, line.length());
 
 
-        processTextAlignment(line, profile, align);
+        processTextAlignment(line, font, align);
         Point2I movingStartPoint = getGlobalTextStart();
         Point2I movingStartPoint = getGlobalTextStart();
-        movingStartPoint.x += renderTextSection(movingStartPoint, 0, lengthOfPreBlockText, profile, currentState);
-        movingStartPoint.x += renderTextSection(movingStartPoint, lengthOfPreBlockText, lengthOfHighlightBlockText, profile, currentState, true);
-        movingStartPoint.x += renderTextSection(movingStartPoint, lengthOfPreBlockText + lengthOfHighlightBlockText, lengthOfPostBlockText, profile, currentState);
+        movingStartPoint.x += renderTextSection(movingStartPoint, 0, lengthOfPreBlockText, profile, currentState, font);
+        movingStartPoint.x += renderTextSection(movingStartPoint, lengthOfPreBlockText, lengthOfHighlightBlockText, profile, currentState, font, true);
+        movingStartPoint.x += renderTextSection(movingStartPoint, lengthOfPreBlockText + lengthOfHighlightBlockText, lengthOfPostBlockText, profile, currentState, font);
     }
     }
 
 
     Point2I textStartPoint = getGlobalTextStart();
     Point2I textStartPoint = getGlobalTextStart();
-    if (selector.renderIbeam(textStartPoint, mGlobalBounds.extent, line, mLineStartIbeamValue, mLineStartIbeamValue + line.length(), profile))
+    if (selector.renderIbeam(textStartPoint, mGlobalBounds.extent, line, mLineStartIbeamValue, mLineStartIbeamValue + line.length(), profile, font))
     {
     {
         Point2I cursorCenter = selector.getCursorCenter();
         Point2I cursorCenter = selector.getCursorCenter();
         performScrollJumpX(cursorCenter.x, clipRect.point.x, clipRect.point.x + clipRect.extent.x);
         performScrollJumpX(cursorCenter.x, clipRect.point.x, clipRect.point.x + clipRect.extent.x);
     }
     }
 }
 }
 
 
-U32 GuiTextEditTextBlock::renderTextSection(const Point2I& startPoint, const U32 subStrStart, const U32 subStrLen, GuiControlProfile* profile, const GuiControlState currentState, bool isSelectedText)
+U32 GuiTextEditTextBlock::renderTextSection(const Point2I& startPoint, const U32 subStrStart, const U32 subStrLen, GuiControlProfile* profile, const GuiControlState currentState, GFont* font, bool isSelectedText)
 {
 {
     if (subStrLen != 0)
     if (subStrLen != 0)
     {
     {
         string sectionText = mText.substr(subStrStart, subStrLen);
         string sectionText = mText.substr(subStrStart, subStrLen);
-        U32 blockStrWidth = profile->mFont->getStrWidth(sectionText.c_str());
+        U32 blockStrWidth = font->getStrWidth(sectionText.c_str());
         Point2I pointToDraw = Point2I(startPoint.x, startPoint.y);
         Point2I pointToDraw = Point2I(startPoint.x, startPoint.y);
         if (isSelectedText)
         if (isSelectedText)
         {
         {
@@ -95,7 +95,7 @@ U32 GuiTextEditTextBlock::renderTextSection(const Point2I& startPoint, const U32
             const ColorI& fontColor = profile->getFontColor(currentState);
             const ColorI& fontColor = profile->getFontColor(currentState);
             dglSetBitmapModulation(fontColor);
             dglSetBitmapModulation(fontColor);
         }
         }
-        dglDrawText(profile->mFont, pointToDraw, sectionText.c_str(), profile->mFontColors);
+        dglDrawText(font, pointToDraw, sectionText.c_str(), profile->mFontColors);
         return blockStrWidth;
         return blockStrWidth;
     }
     }
     return 0;
     return 0;
@@ -115,7 +115,7 @@ void GuiTextEditTextBlock::performScrollJumpX(const S32 targetX, const S32 areaS
     mTextScrollX += diff;
     mTextScrollX += diff;
 }
 }
 
 
-U32 GuiTextEditTextBlock::calculateIbeamPositionInLine(const S32 targetX, GuiControlProfile* profile)
+U32 GuiTextEditTextBlock::calculateIbeamPositionInLine(const S32 targetX, GFont* font)
 {
 {
     if (mText.length() == 0)
     if (mText.length() == 0)
         return mLineStartIbeamValue;
         return mLineStartIbeamValue;
@@ -126,11 +126,11 @@ U32 GuiTextEditTextBlock::calculateIbeamPositionInLine(const S32 targetX, GuiCon
     for (U32 count = 0; count < mText.length(); count++)
     for (U32 count = 0; count < mText.length(); count++)
     {
     {
         char c = mText[count];
         char c = mText[count];
-        if (!profile->mFont->isValidChar(c))
+        if (!font->isValidChar(c))
             continue;
             continue;
 
 
         S32 backDiff = mAbs(curX - targetX);
         S32 backDiff = mAbs(curX - targetX);
-        curX += profile->mFont->getCharXIncrement(c);
+        curX += font->getCharXIncrement(c);
 
 
         if (curX > targetX)
         if (curX > targetX)
         {
         {
@@ -146,26 +146,26 @@ U32 GuiTextEditTextBlock::calculateIbeamPositionInLine(const S32 targetX, GuiCon
     return result;
     return result;
 }
 }
 
 
-void GuiTextEditTextBlock::processScrollVelocity(const S32 delta, const S32 extentX, GuiControlProfile* profile)
+void GuiTextEditTextBlock::processScrollVelocity(const S32 delta, const S32 extentX, GFont* font)
 {
 {
-    U32 max = profile->mFont->getStrWidth(mText.c_str()) - extentX;
+    U32 max = font->getStrWidth(mText.c_str()) - extentX;
     mTextScrollX = mClamp(mTextScrollX + delta, 0, max);
     mTextScrollX = mClamp(mTextScrollX + delta, 0, max);
 }
 }
 
 
-void GuiTextEditTextBlock::processTextAlignment(const string line, GuiControlProfile* profile, AlignmentType align)
+void GuiTextEditTextBlock::processTextAlignment(const string line, GFont* font, AlignmentType align)
 {
 {
     if (align == AlignmentType::LeftAlign ||
     if (align == AlignmentType::LeftAlign ||
-        mGlobalBounds.extent.x < profile->mFont->getStrWidth(line.c_str()))
+        mGlobalBounds.extent.x < font->getStrWidth(line.c_str()))
     {
     {
         mTextOffsetX = 0;
         mTextOffsetX = 0;
     }
     }
     else if (align == AlignmentType::RightAlign)
     else if (align == AlignmentType::RightAlign)
     {
     {
-        mTextOffsetX = mGlobalBounds.extent.x - profile->mFont->getStrWidth(line.c_str());
+        mTextOffsetX = mGlobalBounds.extent.x - font->getStrWidth(line.c_str());
     }
     }
     else if (align == AlignmentType::CenterAlign)
     else if (align == AlignmentType::CenterAlign)
     {
     {
-        mTextOffsetX = (S32)mRound((mGlobalBounds.extent.x - profile->mFont->getStrWidth(line.c_str())) / 2);
+        mTextOffsetX = (S32)mRound((mGlobalBounds.extent.x - font->getStrWidth(line.c_str())) / 2);
     }
     }
 }
 }
 #pragma endregion
 #pragma endregion
@@ -188,7 +188,7 @@ GuiTextEditSelection::GuiTextEditSelection()
     mCursorOn = false;
     mCursorOn = false;
 }
 }
 
 
-bool GuiTextEditSelection::renderIbeam(const Point2I& startPoint, const Point2I& extent, const string line, const U32 start, const U32 end, GuiControlProfile* profile)
+bool GuiTextEditSelection::renderIbeam(const Point2I& startPoint, const Point2I& extent, const string line, const U32 start, const U32 end, GuiControlProfile* profile, GFont* font)
 {
 {
     if (!mIsFirstResponder || !mCursorOn ||
     if (!mIsFirstResponder || !mCursorOn ||
         (mCursorAtEOL && mCursorPos == start && mCursorPos != 0) ||
         (mCursorAtEOL && mCursorPos == start && mCursorPos != 0) ||
@@ -199,7 +199,7 @@ bool GuiTextEditSelection::renderIbeam(const Point2I& startPoint, const Point2I&
     }
     }
 
 
     string blockText = line.substr(0, mCursorPos - start);
     string blockText = line.substr(0, mCursorPos - start);
-    U32 blockStrWidth = profile->mFont->getStrWidth(blockText.c_str());
+    U32 blockStrWidth = font->getStrWidth(blockText.c_str());
     RectI ibeamRect = RectI(startPoint.x + blockStrWidth - 1, startPoint.y, 2, extent.y);
     RectI ibeamRect = RectI(startPoint.x + blockStrWidth - 1, startPoint.y, 2, extent.y);
     setCursorRect(ibeamRect);
     setCursorRect(ibeamRect);
 
 
@@ -600,10 +600,11 @@ S32 GuiTextEditCtrl::calculateIbeamPosition(const Point2I& globalMousePoint, con
         return 0;
         return 0;
 
 
     string textBuffer = applyPasswordMasking();
     string textBuffer = applyPasswordMasking();
+    GFont* font = mProfile->getFont(mFontSizeAdjust);
 
 
     if (!mTextWrap)
     if (!mTextWrap)
     {
     {
-        return mTextBlockList.front().calculateIbeamPositionInLine(globalMousePoint.x, mProfile);
+        return mTextBlockList.front().calculateIbeamPositionInLine(globalMousePoint.x, font);
     }
     }
     else
     else
     {
     {
@@ -624,13 +625,13 @@ S32 GuiTextEditCtrl::calculateIbeamPosition(const Point2I& globalMousePoint, con
             curY += height;
             curY += height;
             if (curY > globalMousePoint.y)
             if (curY > globalMousePoint.y)
             {
             {
-                U32 pos = block.calculateIbeamPositionInLine(globalMousePoint.x, mProfile);
+                U32 pos = block.calculateIbeamPositionInLine(globalMousePoint.x, font);
                 mSelector.setCursorAtEOL(block.calculateCursorAtEOL(pos));
                 mSelector.setCursorAtEOL(block.calculateCursorAtEOL(pos));
                 return pos + block.getStartValue();
                 return pos + block.getStartValue();
             }
             }
         }
         }
         mSelector.setCursorAtEOL(true);
         mSelector.setCursorAtEOL(true);
-        return mTextBlockList.back().calculateIbeamPositionInLine(globalMousePoint.x, mProfile);
+        return mTextBlockList.back().calculateIbeamPositionInLine(globalMousePoint.x, font);
     }
     }
 }
 }
 
 
@@ -741,7 +742,7 @@ bool GuiTextEditCtrl::onMouseWheelUp(const GuiEvent& event)
     {
     {
         mScrollVelocity = 0;
         mScrollVelocity = 0;
         mSuspendVerticalScrollJump = true;
         mSuspendVerticalScrollJump = true;
-        mTextOffsetY = getMax(mTextOffsetY - static_cast<S32>(mProfile->mFont->getHeight()), 0);
+        mTextOffsetY = getMax(mTextOffsetY - static_cast<S32>(mProfile->getFont(mFontSizeAdjust)->getHeight()), 0);
         return true;
         return true;
     }
     }
 
 
@@ -757,14 +758,14 @@ bool GuiTextEditCtrl::onMouseWheelDown(const GuiEvent& event)
     if (!mVisible || !mAwake)
     if (!mVisible || !mAwake)
         return true;
         return true;
 
 
-    U32 blockHeight = mTextBlockList.size() * mProfile->mFont->getHeight();
+    U32 blockHeight = mTextBlockList.size() * mProfile->getFont(mFontSizeAdjust)->getHeight();
     RectI innerRect = getGlobalInnerRect();
     RectI innerRect = getGlobalInnerRect();
     S32 max = blockHeight - innerRect.extent.y;
     S32 max = blockHeight - innerRect.extent.y;
     if (mTextWrap && innerRect.extent.y < blockHeight && mTextOffsetY < max)
     if (mTextWrap && innerRect.extent.y < blockHeight && mTextOffsetY < max)
     {
     {
         mScrollVelocity = 0;
         mScrollVelocity = 0;
         mSuspendVerticalScrollJump = true;
         mSuspendVerticalScrollJump = true;
-        mTextOffsetY = getMin(mTextOffsetY + static_cast<S32>(mProfile->mFont->getHeight()), max);
+        mTextOffsetY = getMin(mTextOffsetY + static_cast<S32>(mProfile->getFont(mFontSizeAdjust)->getHeight()), max);
         return true;
         return true;
     }
     }
 
 
@@ -1040,7 +1041,8 @@ void GuiTextEditCtrl::onRender(Point2I offset, const RectI & updateRect)
 
 
 void GuiTextEditCtrl::renderLineList(const Point2I& offset, const Point2I& extent, const S32 startOffsetY, const vector<string> lineList, GuiControlProfile* profile, const TextRotationOptions rot)
 void GuiTextEditCtrl::renderLineList(const Point2I& offset, const Point2I& extent, const S32 startOffsetY, const vector<string> lineList, GuiControlProfile* profile, const TextRotationOptions rot)
 {
 {
-    const S32 textHeight = profile->mFont->getHeight();
+    GFont* font = profile->getFont(mFontSizeAdjust);
+    const S32 textHeight = font->getHeight();
     S32 totalWidth = extent.x;
     S32 totalWidth = extent.x;
 
 
     if (mTextBlockList.size() > lineList.size())
     if (mTextBlockList.size() > lineList.size())
@@ -1061,7 +1063,7 @@ void GuiTextEditCtrl::renderLineList(const Point2I& offset, const Point2I& exten
         Point2I start = Point2I(0, offsetY);
         Point2I start = Point2I(0, offsetY);
         Point2I blockExtent = Point2I(extent.x, textHeight);
         Point2I blockExtent = Point2I(extent.x, textHeight);
         RectI blockBounds = RectI(start + offset + profile->mTextOffset, blockExtent);
         RectI blockBounds = RectI(start + offset + profile->mTextOffset, blockExtent);
-        mTextBlockList[i].render(blockBounds, lineList[i], ibeamPos, mProfile, getCurrentState(), mSelector, getAlignmentType());
+        mTextBlockList[i].render(blockBounds, lineList[i], ibeamPos, mProfile, getCurrentState(), mSelector, getAlignmentType(), font);
 
 
         offsetY += textHeight;
         offsetY += textHeight;
         ibeamPos += lineList[i].length();
         ibeamPos += lineList[i].length();
@@ -1083,12 +1085,12 @@ void GuiTextEditCtrl::processScrollVelocity()
         RectI innerRect = getGlobalInnerRect();
         RectI innerRect = getGlobalInnerRect();
         if (mTextWrap)
         if (mTextWrap)
         {
         {
-            U32 max = (mTextBlockList.size() * mProfile->mFont->getHeight()) - innerRect.extent.y;
+            U32 max = (mTextBlockList.size() * mProfile->getFont(mFontSizeAdjust)->getHeight()) - innerRect.extent.y;
             mTextOffsetY = mClamp(mTextOffsetY + delta, 0, max);
             mTextOffsetY = mClamp(mTextOffsetY + delta, 0, max);
         }
         }
         else if(mTextBlockList.size() > 0)
         else if(mTextBlockList.size() > 0)
         {
         {
-            mTextBlockList.front().processScrollVelocity(delta, innerRect.extent.x, mProfile);
+            mTextBlockList.front().processScrollVelocity(delta, innerRect.extent.x, mProfile->getFont(mFontSizeAdjust));
         }
         }
         mTimeLastScrollProcess = Platform::getVirtualMilliseconds();
         mTimeLastScrollProcess = Platform::getVirtualMilliseconds();
 
 
@@ -1473,10 +1475,10 @@ bool GuiTextEditCtrl::handleKeyDownWithNoModifier(const GuiEvent& event)
 
 
 bool GuiTextEditCtrl::handleCharacterInput(const GuiEvent& event)
 bool GuiTextEditCtrl::handleCharacterInput(const GuiEvent& event)
 {
 {
-    if (mProfile->mFont.isNull())
+    if (!mProfile->getFont(mFontSizeAdjust))
         return false;
         return false;
 
 
-    if (mProfile->mFont->isValidChar(event.ascii))
+    if (mProfile->getFont(mFontSizeAdjust)->isValidChar(event.ascii))
     {
     {
         // Get the character ready to add to a UTF8 string.
         // Get the character ready to add to a UTF8 string.
         string characterToInsert = string(1, event.ascii);
         string characterToInsert = string(1, event.ascii);
@@ -1589,7 +1591,7 @@ bool GuiTextEditCtrl::handleArrowKey(GuiDirection direction)
     }
     }
     else if (direction == GuiDirection::Up)
     else if (direction == GuiDirection::Up)
     {
     {
-        S32 newCursorPos = getLineAdjustedIbeamPosition(-mProfile->mFont->getHeight());
+        S32 newCursorPos = getLineAdjustedIbeamPosition(-mProfile->getFont(mFontSizeAdjust)->getHeight());
         if (newCursorPos == mSelector.getCursorPos())
         if (newCursorPos == mSelector.getCursorPos())
         {
         {
             newCursorPos = 0;
             newCursorPos = 0;
@@ -1598,7 +1600,7 @@ bool GuiTextEditCtrl::handleArrowKey(GuiDirection direction)
     }
     }
     else if (direction == GuiDirection::Down)
     else if (direction == GuiDirection::Down)
     {
     {
-        S32 newCursorPos = getLineAdjustedIbeamPosition(mProfile->mFont->getHeight());
+        S32 newCursorPos = getLineAdjustedIbeamPosition(mProfile->getFont(mFontSizeAdjust)->getHeight());
         if (newCursorPos == mSelector.getCursorPos())
         if (newCursorPos == mSelector.getCursorPos())
         {
         {
             newCursorPos = mTextBuffer.length();
             newCursorPos = mTextBuffer.length();
@@ -1624,12 +1626,12 @@ bool GuiTextEditCtrl::handleShiftArrowKey(GuiDirection direction)
     }
     }
     else if (direction == GuiDirection::Up)
     else if (direction == GuiDirection::Up)
     {
     {
-        S32 newCursorPos = getLineAdjustedIbeamPosition(-mProfile->mFont->getHeight());
+        S32 newCursorPos = getLineAdjustedIbeamPosition(-mProfile->getFont(mFontSizeAdjust)->getHeight());
         modifySelectBlock(newCursorPos);
         modifySelectBlock(newCursorPos);
     }
     }
     else if (direction == GuiDirection::Down)
     else if (direction == GuiDirection::Down)
     {
     {
-        S32 newCursorPos = getLineAdjustedIbeamPosition(mProfile->mFont->getHeight());
+        S32 newCursorPos = getLineAdjustedIbeamPosition(mProfile->getFont(mFontSizeAdjust)->getHeight());
         modifySelectBlock(newCursorPos);
         modifySelectBlock(newCursorPos);
     }
     }
     setUpdate();
     setUpdate();

+ 6 - 6
engine/source/gui/guiTextEditCtrl.h

@@ -62,7 +62,7 @@ public:
 	void selectTo(const U32 target);
 	void selectTo(const U32 target);
 	inline bool hasSelection() { return mBlockEnd > mBlockStart; }
 	inline bool hasSelection() { return mBlockEnd > mBlockStart; }
 	void onPreRender(const U32 time);
 	void onPreRender(const U32 time);
-	bool renderIbeam(const Point2I& startPoint, const Point2I& extent, const string line, const U32 start, const U32 end, GuiControlProfile* profile);
+	bool renderIbeam(const Point2I& startPoint, const Point2I& extent, const string line, const U32 start, const U32 end, GuiControlProfile* profile, GFont* font);
 	inline string getSelection(const string& fullText) { return hasSelection() ? fullText.substr(mBlockStart, mBlockEnd - mBlockStart) : string(); }
 	inline string getSelection(const string& fullText) { return hasSelection() ? fullText.substr(mBlockStart, mBlockEnd - mBlockStart) : string(); }
 	void eraseSelection(string& fullText);
 	void eraseSelection(string& fullText);
 	void stepCursorForward();
 	void stepCursorForward();
@@ -85,14 +85,14 @@ public:
 	inline const U32 getStartValue() const { return mLineStartIbeamValue; }
 	inline const U32 getStartValue() const { return mLineStartIbeamValue; }
 	inline RectI getGlobalBounds() const { return mGlobalBounds; }
 	inline RectI getGlobalBounds() const { return mGlobalBounds; }
 	inline Point2I getGlobalTextStart() { return Point2I(mGlobalBounds.point.x + mTextOffsetX - mTextScrollX, mGlobalBounds.point.y); }
 	inline Point2I getGlobalTextStart() { return Point2I(mGlobalBounds.point.x + mTextOffsetX - mTextScrollX, mGlobalBounds.point.y); }
-	void render(const RectI& bounds, string line, U32 ibeamStartValue, GuiControlProfile* profile, GuiControlState currentState, GuiTextEditSelection& selector, AlignmentType align);
-	U32 renderTextSection(const Point2I& startPoint, const U32 subStrStart, const U32 subStrLen, GuiControlProfile* profile, const GuiControlState currentState, bool isSelectedText = false);
+	void render(const RectI& bounds, string line, U32 ibeamStartValue, GuiControlProfile* profile, GuiControlState currentState, GuiTextEditSelection& selector, AlignmentType align, GFont* font);
+	U32 renderTextSection(const Point2I& startPoint, const U32 subStrStart, const U32 subStrLen, GuiControlProfile* profile, const GuiControlState currentState, GFont* font, bool isSelectedText = false);
 	void performScrollJumpX(const S32 targetX, const S32 areaStart, const S32 areaEnd);
 	void performScrollJumpX(const S32 targetX, const S32 areaStart, const S32 areaEnd);
-	U32 calculateIbeamPositionInLine(const S32 targetX, GuiControlProfile* profile);
+	U32 calculateIbeamPositionInLine(const S32 targetX, GFont* font);
 	inline bool calculateCursorAtEOL(const U32 cursorPos) { return cursorPos == mText.length(); }
 	inline bool calculateCursorAtEOL(const U32 cursorPos) { return cursorPos == mText.length(); }
 	inline void resetScroll() { mTextScrollX = 0; }
 	inline void resetScroll() { mTextScrollX = 0; }
-	void processScrollVelocity(const S32 delta, const S32 extentX, GuiControlProfile* profile);
-	void processTextAlignment(const string line, GuiControlProfile* profile, AlignmentType align);
+	void processScrollVelocity(const S32 delta, const S32 extentX, GFont* font);
+	void processTextAlignment(const string line, GFont* font, AlignmentType align);
 };
 };
 
 
 class GuiTextEditCtrl : public GuiControl
 class GuiTextEditCtrl : public GuiControl

+ 9 - 9
engine/source/gui/guiTreeViewCtrl.cc

@@ -105,7 +105,7 @@ void GuiTreeViewCtrl::Item::setText(char *txt)
 
 
    // Update Render Data
    // Update Render Data
    if( !mProfile.isNull() )
    if( !mProfile.isNull() )
-      mDataRenderWidth = getDisplayTextWidth( mProfile->mFont );
+      mDataRenderWidth = getDisplayTextWidth( mProfile->getFont() );
 
 
 }
 }
 
 
@@ -121,7 +121,7 @@ void GuiTreeViewCtrl::Item::setValue(const char *val)
 
 
    // Update Render Data
    // Update Render Data
    if( !mProfile.isNull() )
    if( !mProfile.isNull() )
-      mDataRenderWidth = getDisplayTextWidth( mProfile->mFont );
+      mDataRenderWidth = getDisplayTextWidth( mProfile->getFont());
 
 
 }
 }
 
 
@@ -181,7 +181,7 @@ void GuiTreeViewCtrl::Item::setObject(SimObject *obj)
 
 
    // Update Render Data
    // Update Render Data
    if( !mProfile.isNull() )
    if( !mProfile.isNull() )
-      mDataRenderWidth = getDisplayTextWidth( mProfile->mFont );
+      mDataRenderWidth = getDisplayTextWidth( mProfile->getFont());
 
 
 }
 }
 
 
@@ -616,9 +616,9 @@ void GuiTreeViewCtrl::buildItem( Item* item, U32 tabLevel, bool bForceFullUpdate
    item->mTabLevel = tabLevel;
    item->mTabLevel = tabLevel;
    mVisibleItems.push_back( item );
    mVisibleItems.push_back( item );
 
 
-   if ( mProfile != NULL && !mProfile->mFont.isNull() )
+   if ( mProfile != NULL && mProfile->getFont(mFontSizeAdjust) )
    {
    {
-      S32 width = ( tabLevel + 1 ) * mTabSize + item->getDisplayTextWidth(mProfile->mFont);
+      S32 width = ( tabLevel + 1 ) * mTabSize + item->getDisplayTextWidth(mProfile->getFont(mFontSizeAdjust));
       if ( mProfile->mBitmapArrayRects.size() > 0 )
       if ( mProfile->mBitmapArrayRects.size() > 0 )
          width += mProfile->mBitmapArrayRects[0].extent.x;
          width += mProfile->mBitmapArrayRects[0].extent.x;
       
       
@@ -1261,7 +1261,7 @@ bool GuiTreeViewCtrl::hitTest(const Point2I & pnt, Item* & item, BitSet32 & flag
    char *buf = (char*)txtAlloc.alloc(bufLen);
    char *buf = (char*)txtAlloc.alloc(bufLen);
    item->getDisplayText(bufLen, buf);
    item->getDisplayText(bufLen, buf);
 
 
-   min += mProfile->mFont->getStrWidth(buf);
+   min += mProfile->getFont(mFontSizeAdjust)->getStrWidth(buf);
    if(pos.x < min)
    if(pos.x < min)
       flags.set(OnText);
       flags.set(OnText);
 
 
@@ -3193,7 +3193,7 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool )
    item->getDisplayText(bufLen, displayText);
    item->getDisplayText(bufLen, displayText);
 
 
    // Draw the rollover/selected bitmap, if one was specified.
    // Draw the rollover/selected bitmap, if one was specified.
-   drawRect.extent.x = mProfile->mFont->getStrWidth( displayText ) + ( 2 * mTextOffset );
+   drawRect.extent.x = mProfile->getFont(mFontSizeAdjust)->getStrWidth( displayText ) + ( 2 * mTextOffset );
    if ( item->mState.test( Item::Selected ) && mTexSelected )
    if ( item->mState.test( Item::Selected ) && mTexSelected )
       dglDrawBitmapStretch( mTexSelected, drawRect );
       dglDrawBitmapStretch( mTexSelected, drawRect );
    else if ( item->mState.test( Item::MouseOverText ) && mTexRollover )
    else if ( item->mState.test( Item::MouseOverText ) && mTexRollover )
@@ -3225,7 +3225,7 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool )
    dglSetBitmapModulation( fontColor );
    dglSetBitmapModulation( fontColor );
 
 
    // Center the text horizontally.
    // Center the text horizontally.
-   S32 height = (mItemHeight - mProfile->mFont->getHeight()) / 2;
+   S32 height = (mItemHeight - mProfile->getFont(mFontSizeAdjust)->getHeight()) / 2;
 
 
    if(height > 0)
    if(height > 0)
       drawRect.point.y += height;
       drawRect.point.y += height;
@@ -3233,7 +3233,7 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool )
    // JDD - offset by two pixels or so to keep the text from rendering RIGHT ONTOP of the outline
    // JDD - offset by two pixels or so to keep the text from rendering RIGHT ONTOP of the outline
    drawRect.point.x += 2;
    drawRect.point.x += 2;
 
 
-   dglDrawText( mProfile->mFont, drawRect.point, displayText, mProfile->mFontColors );
+   dglDrawText( mProfile->getFont(mFontSizeAdjust), drawRect.point, displayText, mProfile->mFontColors );
 
 
 }
 }
 
 

+ 44 - 6
engine/source/gui/guiTypes.cc

@@ -735,17 +735,16 @@ S32 GuiControlProfile::constructBitmapArray()
    return mBitmapArrayRects.size();
    return mBitmapArrayRects.size();
 }
 }
 
 
-void GuiControlProfile::incRefCount()
+void GuiControlProfile::incRefCount(F32 fontAdjust)
 {
 {
 	if(!mRefCount)
 	if(!mRefCount)
 	{
 	{
 		if(mFontDirectory == StringTable->EmptyString)
 		if(mFontDirectory == StringTable->EmptyString)
 			mFontDirectory = Con::getVariable("$GUI::fontCacheDirectory");
 			mFontDirectory = Con::getVariable("$GUI::fontCacheDirectory");
 
 
-		//verify the font
-		mFont = GFont::create(mFontType, mFontSize, mFontDirectory);
-		if (mFont.isNull())
-			Con::errorf("Failed to load/create profile font (%s/%d)", mFontType, mFontSize);
+		//load the font
+		S32 size = getFontSize(fontAdjust);
+		addFont(size);
 
 
 		//Set the bitmap
 		//Set the bitmap
 		if ( mBitmapName != NULL && mBitmapName != StringTable->EmptyString )
 		if ( mBitmapName != NULL && mBitmapName != StringTable->EmptyString )
@@ -782,7 +781,7 @@ void GuiControlProfile::decRefCount()
 
 
 	if(!mRefCount)
 	if(!mRefCount)
 	{
 	{
-		mFont = NULL;
+		mFontMap.clear();
 		mTextureHandle = NULL;
 		mTextureHandle = NULL;
 		if(mImageAsset != NULL)
 		if(mImageAsset != NULL)
 		{
 		{
@@ -804,6 +803,45 @@ void GuiControlProfile::setImageAsset(const char* pImageAssetID)
 		mImageAsset = pImageAssetID;
 		mImageAsset = pImageAssetID;
 }
 }
 
 
+S32 GuiControlProfile::getFontSize(F32 fontAdjust)
+{
+	S32 size = mRound(mFontSize * fontAdjust);
+	if (size < 1)
+	{
+		size = 8;//This is an arbitrary value. Feel free to change it to something you like better.
+	}
+	return size;
+}
+
+GFont* GuiControlProfile::getFont(F32 fontAdjust)
+{
+	S32 size = getFontSize(fontAdjust);
+	if (mFontMap.find(size) == mFontMap.end())
+	{
+		addFont(size);
+	}
+	GFont* font = mFontMap[size];
+	AssertFatal(font != nullptr, avar("GuiControlProfile: unable return requested font %s %d!", mFontType, size));
+
+	return font;
+}
+
+void GuiControlProfile::addFont(S32 fontSize)
+{
+	if (mFontMap.find(fontSize) == mFontMap.end())
+	{
+		GFont* font = GFont::create(mFontType, fontSize, mFontDirectory);
+		if (font == nullptr)
+		{
+			Con::errorf("Failed to load/create profile font (%s/%d)", mFontType, fontSize);
+		}
+		else
+		{
+			mFontMap[fontSize] = font;
+		}
+	}
+}
+
 const ColorI& GuiControlProfile::getFillColor(const GuiControlState state)
 const ColorI& GuiControlProfile::getFillColor(const GuiControlState state)
 {
 {
 	switch (state)
 	switch (state)

+ 9 - 3
engine/source/gui/guiTypes.h

@@ -60,6 +60,7 @@
 #endif
 #endif
 
 
 #include "graphics/gFont.h"
 #include "graphics/gFont.h"
+#include <unordered_map>
 
 
 class GBitmap;
 class GBitmap;
 
 
@@ -230,8 +231,7 @@ public:
    ColorI& mFontColorTextSL;
    ColorI& mFontColorTextSL;
    FontCharset mFontCharset;                       ///< Font character set
    FontCharset mFontCharset;                       ///< Font character set
 
 
-   Resource<GFont>   mFont;                        ///< Font resource
-
+   GFont* getFont(F32 fontAdjust = 1.0);
    
    
    AlignmentType mAlignment;                       ///< Horizontal text alignment
    AlignmentType mAlignment;                       ///< Horizontal text alignment
    VertAlignmentType mVAlignment;				   ///< Vertical text alignment
    VertAlignmentType mVAlignment;				   ///< Vertical text alignment
@@ -247,6 +247,12 @@ public:
    AssetPtr<ImageAsset> mImageAsset;
    AssetPtr<ImageAsset> mImageAsset;
    void setImageAsset( const char* pImageAssetID );
    void setImageAsset( const char* pImageAssetID );
    inline StringTableEntry getImageAsset( void ) const { return mImageAssetID; }
    inline StringTableEntry getImageAsset( void ) const { return mImageAssetID; }
+
+private:
+	std::unordered_map<S32, GFont*> mFontMap;
+	S32 getFontSize(F32 fontAdjust);
+	void addFont(S32 fontSize);
+
 protected:
 protected:
 	static bool setImageAsset(void* obj, const char* data) { static_cast<GuiControlProfile*>(obj)->setImageAsset(data); return false; }
 	static bool setImageAsset(void* obj, const char* data) { static_cast<GuiControlProfile*>(obj)->setImageAsset(data); return false; }
 	static const char* getImageAsset(void* obj, const char* data) { return static_cast<GuiControlProfile*>(obj)->getImageAsset(); }
 	static const char* getImageAsset(void* obj, const char* data) { return static_cast<GuiControlProfile*>(obj)->getImageAsset(); }
@@ -293,7 +299,7 @@ public:
    /// It also stores the sizes in the mBitmapArrayRects vector.
    /// It also stores the sizes in the mBitmapArrayRects vector.
    S32 constructBitmapArray();
    S32 constructBitmapArray();
 
 
-   void incRefCount();
+   void incRefCount(F32 fontAdjust = 1.0);
    void decRefCount();
    void decRefCount();
 
 
    const ColorI& getFillColor(const GuiControlState state); //Returns the fill color based on the state.
    const ColorI& getFillColor(const GuiControlState state); //Returns the fill color based on the state.