Game Development Community

Adding new font .ttf files

by Joey Alfeche · in Technical Issues · 08/23/2005 (8:12 am) · 12 replies

I was wondering where I would place .ttf files if I wanted to add a new font to the game. I know that we are suppose to put it in the C:Windows/fonts folder but is there a place in torque that checks for new font files?

About the author

Recent Threads


#1
08/23/2005 (8:19 am)
You can just install the fonts normally under Windows. It should then be available for use in the game editors. If you use the new font in game, it will automatically be cached, so you shouldn't need to worry.
#2
08/23/2005 (8:33 am)
You have to create a profile that uses the font for it to be cached.
#3
08/23/2005 (8:49 am)
What about the legal ramifications of this? If you use a font that you license via payment, is it legal to include it in a game made with Torque? I assume the system running the game doesn't have access to the font outside of the game, but I still wonder about the distribution issue.
#4
06/26/2009 (6:14 am)
hey guys,

I did what yo say but ı failed.

textStyle.FontType = "@data/fonts/Exocet";


in this script; where is the wrong? please help me!!
#5
06/26/2009 (9:06 am)
I think you shouldn't provide the path to the font, but the name of the font.
#6
06/26/2009 (9:35 am)
Aren't you supposed to cache the font as a UFT file, rather than using the font itself? Hence why no version of Torque ships with actual fonts.
Try a uft search.

attempts to return coffin lid to 4 year old thread
#7
06/26/2009 (10:48 pm)
You should specify the NAME of the system font to be used in whatever gui profile in which you want to use it. Torque then generates a .uft file in the "common/data/fonts" directory in TGEa, "core/data/fonts" directory for Torque 3D, and in the "common/ui/cache" directory in TGE.

One more coffin nail for that lid :D
#8
06/27/2009 (2:29 am)
Hey guys,

thanks for all messages but I am still confused. I am very beginner about torque!! please may you write what I should do step by step clearly? I downloaded St.Andrew font from dafont.com but I couldnt update my game's font type? I need help,please help me..

thnks in advance,
#9
06/27/2009 (3:01 am)
@Nazif: in your gui profiles in which you wish to use the new font you will need to point your fontType field to the name of the font. For example, here I am using the arial font for a HUD profile for use in my game.

// This is the default HUD text profile that all others will derive
// their basic settings from
singleton GuiControlProfile (HudTextNormalProfile)
{
    opaque = false;
    fontType = "Arial";
    fontSize = 14;
    fontColor = "255 255 255";
};

// Here we have an Italic HUD text profile, it inherits all other
// fields from the default
singleton GuiControlProfile (HudTextItalicProfile : HudTextNormalProfile)
{
    fontType = "ArialItalic";
};

// Here we have an Bold HUD text profile, it inherits all other
// fields from the default
singleton GuiControlProfile (HudTextBoldProfile : HudTextNormalProfile)
{
    fontType = "ArialBold";
};
So long as the font you name is installed on your system Torque will generate a .uft version (the in-game font file) of the font inside the directory I pointed out above -- it's these cached font files that you would distribute when you package your game

It will probably say "new" in place of "singleton" for you.
#10
06/27/2009 (7:58 am)
Dear friend Michael,I did not understand exactly where I did wrong:( I put my font to "common/font" .ok. Afterwards, for example, I wanna change on aboutDlg.gui.This is normal Arial:
new GuiControl(aboutDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";

new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "132 88";
extent = "376 303";
minExtent = "8 8";
visible = "1";
helpTag = "0";
text = "About...";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "Canvas.popDialog(aboutDlg);";

new GuiMLTextCtrl(aboutText) {
profile = "GuiMLTextProfile";
horizSizing = "width";
vertSizing = "relative";
position = "19 36";
extent = "336 241";
minExtent = "8 8";
visible = "1";
helpTag = "0";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
text = "This is a test";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "303 268";
extent = "60 23";
minExtent = "8 8";
visible = "1";
command = "Canvas.popDialog(aboutDlg);";
helpTag = "0";
text = "OK";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "12 268";
extent = "76 23";
minExtent = "8 8";
visible = "1";
command = "getHelp("4. License");";
helpTag = "0";
text = "License...";
};
};
};
function aboutDlg::onWake(%this)
{
%text="<just:center><font:Arial Bold:20>FPS Starter Kitn"@
"<font:Arial:12>"@ getCompileTimeString() @", "@ getBuildString() @"Buildnn"@
"<font:Arial:16>Copyright (c) 2001 <a:www.garagegames.com>GarageGames.Com</a>n"@
"<bitmap:rw/client/ui/gglogo150.png>";
aboutText.setText(%text);
}
function aboutText::onURL(%this, %url)
{
echo(%this);
echo(%url);
gotoWebPage( %url );
}

can you tell me the changes on this example because I did do changes as you wrote but nothing happened. Please show me changes on this aboutDlg.gui. It would be so benefıcıal, I wanna really learn torque!! Thanks agaın dear,please forgıve me because I am stealıng your tıme:(:(
#11
06/27/2009 (9:19 am)
Your font should go wherever all other system fonts get installed at (for me, that's "Windows/Fonts"). Only the .uft file that Torque generates will show up in the common folder -- once it works.

My example was just to show the name usage -- the actual GUI profile would have to be used in order to see them. Each GUI control has a pointer to some "profile" that it pulls certain information from, one of which is the font name. I was showing custom profiles that you would need an actual control pointed to them. But since you're not using modified GUI profiles...

I didn't realize you were modifying the aboutDlg. It's even easier to specify the font to use without having to create new GUI profiles.

Everywhere you have the <Font> tag in a GuiMLTextCtrl you can specify a unique font and size per tag and/or line. I'm assuming that STAndrew is the name for your font:
function aboutDlg::onWake(%this)
{
   %text = "<just:center><font:STAndrew:20>FPS Starter Kit/n"@
   "<font:STAndrew:12>"@ getCompileTimeString() @", "@ getBuildString() @"Build/n/n"@
   "<font:STAndrew:16>Copyright (c) 2001 <a:www.garagegames.com>GarageGames.Com</a>/n"@
   "<bitmap:rw/client/ui/gglogo150.png>";
   aboutText.setText(%text); 
}

Hopefully that will help, but remember the "real" system font that you downloaded does not go in your Torque directory but wherever system fonts are normally installed on your computer.
#12
06/27/2009 (10:06 am)
Dear michael,

thanks dear:) As far as I understand that I had done it correctly so far but StAndrew font type is not convenient for Torque because when I tried to another font,it works:):) I was thinking ı am a stupid because whatever I did, ıt dıd not work:) but I did it correctly even before. Thanks so much for your help! you are really so kind guy ,thanks again dear...

best greetings from Turkey to you and your family,