Game Development Community

Creating new fonts for Torque

by Aaron E · in Technical Issues · 07/07/2005 (6:52 am) · 17 replies

Hello all,

Over the years, i've created a few of my own fonts. Recently, though, I've been wanting to get them into Torque. Specifically, I want to use them with the multi-line text edit controls. I've read a few cryptic posts about using fonts, but so far, I haven't seen any artist-friendly solutions.

From what I understand, a Torque text font is a single image file with all of the characters included in a grid -- with character cells that can be referenced by the text-handling code. I hope I explained that right.

So, with that in mind, I've tried to figure out what base format is used for the .GFT font file, but I haven't discovered it yet. I've tried opening some existing Torque font files in a Hex editor (hoping for clues) but didn't learn anything there either. I've tried changing the extensions of the .GFT files to popular formats (.BMP, .PNG, .JPG) and opening them in Photoshop to see if anything works. So, basically, I'm just stumbling around in the dark with this.

So my question is, what is the easiest way for an artist type of guy to get his original fonts into .gft and Torque ?

If I'm going about this in the wrong way -- or if my underlying assumptions are way off, let me know. Detailed, artist-friendly (dummy proof) descriptions would be great, but links would be very appreciated too.

Thanks in advance

#1
07/07/2005 (7:51 am)
I think .gft are internal files for Torques use. You don't convert files into the GFT format. Basically, when you run Torque, it creates a cache folder that contains cached copies of the various fonts that your game uses. If the user doesn't have the required fonts installed, your game will still work correctly, because it can fall back onto the cached versions.

So all you would need to do is have your custom fonts available to your OS, and then create the various UI elements to use those fonts. Torque will create the cached versions (and hence the .gft files) automagically.
#2
07/07/2005 (8:40 am)
Does that mean, if you want to use a custom font of your own you need to have the game install it on the user's system? I'm not sure that's in everyone's best interest...
#3
07/07/2005 (9:12 am)
Primitive support
GFont - fonts in the Torque are alpha textures created by the platform layer from OS dependent outline fonts.


It's taked from there:
http://www.garagegames.com/docs/tge/general/ch06s08.php

So can someone help to figureout what it means?
#4
07/07/2005 (9:42 am)
Torque automatically creates the .gft files in the common\ui\cache directory if you use a font for which a .gft does not currently exist. For the .gft to be created the font has to be installed on the system - like in true type format. Torque will create a different .gft file for each different font size that is used.

The easiest way to get your original font into .gft format is to just install it on your own system - make sure it is used in your Torque application - run Torque - look in the common\ui\cache folder.
#5
07/07/2005 (9:45 am)
Can we take that to mean that, once the *.gft file has been created, the font will carry over with the game, or would we still need to install the font on the user's system?

Just clarifying...
#6
07/07/2005 (9:47 am)
From my understanding you only need to provide the gft cache files with your game in order to make them work on other peoples computers.
#7
07/07/2005 (10:13 am)
Newbe question:
Torque automatically creates the .gft files in the common\ui\cache directory if you use a font for which a .gft does not currently exist.

I looked at Gui Editor and didnt find something related to changing you font. What mean use.
#8
07/07/2005 (10:14 am)
Philip,

Thank you. Your description definitely explains some of the behavior I had seen but didn't understand. The process you describe sounds very ingeneous. If I'm understanding you correctly, developers can create content using whatever fonts they have on their machines. In the process, Torque creates and caches new .GFT files based on the original font. The devs can then include those files with their final product so that end users without the font can still read the text as designed. Is that right? It sounds similar to how .PDF files can include embedded fonts. If I'm understanding all of this correctly, that's cool.

But for some reason it's not quite working for me. I'm sure it's something I'm doing wrong or a step I'm leaving out. After reading your post, here's what I tried . . .

In a new text document, I created an internal tag telling Torque to use the Arial font at 55 point size, like so . . .



That works great for me. When I check the ui/cache folder, the new .GFT is there, just as you described. Again, let me say, that's very cool.

However, when I change the tag to another font (something standard like Impact or WingDings) and try to view it in the GUI, I don't see my text in the declared font. Yes, a new .GFT gets created for it anyway. And the larger the declared point size, the bigger the .GFT file is (measured in KB). Here's the tag that I used for the Impact font.



Do you see anything that I'm doing wrong? I'm sure it's something simple. Could some fonts require special naming references?

Thanks again

P.S. More posts and additional cool ideas were appended to the thread while I was typing this message. I kind of aimed the majority of this post at Philip, but if anyone else can think of a solution and set me straight, I wouldn't complain. :)
#9
07/07/2005 (10:26 am)
Aaron

>>In a new text document, I created an internal tag telling Torque to use the Arial font at 55 point size, like >>so . . .
>>


Thanks for answer! :)))

Updated: ... but this not work in Gui Editor. :(
#10
07/07/2005 (10:32 am)
I'll be honest here and say that my only knowledge of this stuff is via T2D as I'm not a TGE owner.

In T2D I created a new profile that defines the font and point size I want. I then create the UI elements in the GUI editor and set them to use the profile I created.
#11
07/07/2005 (10:35 am)
You right Philip

Here it is :))))))))
http://www.garagegames.com/mg/forums/result.thread.php?qt=1865

Now i can use russian in TGE !
#12
07/07/2005 (11:52 am)
Hello again,

Very nice. With all the great ideas, pointers and links, I finally got the fonts function working in most of my GUI objects. I still have a bit of configuring to do before it works exactly as I want, but I'm much closer to the goal now.

Many thanks to everyone who offered suggestings and tips on this issue. I couldn't have figured it out on my own.


P.S. Philip and Viktor, I definitely owe you guys. Maybe I can return the favor some day. :)
#13
07/07/2005 (3:34 pm)
I think it will only generate a new font if it is specified in a new Guicontrolprofile, like the ones that are found in the defaultprofiles file.
#14
02/09/2006 (12:59 pm)
I've got to say, although a bit confusing at first, this is a singularly brilliant way to deal with fonts. Go GG.
#15
03/16/2006 (7:05 pm)
My alpha tester (who does not have certain fonts I'm using installed on his PC) can not see the fonts in his GUI at all, though the required GFT files are present. The fonts display as they should when I run the game on my system with the TrueType fonts installed. I didn't want to make a new thread for this as it seems related. This is using TGE 1.4
#16
03/16/2006 (7:59 pm)
@Midhir...Check this thread out.
#17
09/01/2007 (6:13 pm)
In a new text document, I created an internal tag telling Torque to use the Arial font at 55 point size, like so . . .



What did you call this new text document and where did you put it to make this work?