Bitmap fonts
by Snowman · in Torque Game Engine · 11/17/2001 (11:37 am) · 11 replies
Hi!
I've been trying to figure out if I can do bitmap fonts with torque or not. From what I've seen so far, it can only do true type fonts (which isn't helpful because it loses all of the nice colorings of my bitmapped font).
I've searched through the source and found the GFont class. As best I can understand it, I need to create a new Resource with the ResourceManager to create a new font. How do I specify the png file containing the font though? And how would I use the font class to actually print something on the screen?
Thanks!
-Snowman
I've been trying to figure out if I can do bitmap fonts with torque or not. From what I've seen so far, it can only do true type fonts (which isn't helpful because it loses all of the nice colorings of my bitmapped font).
I've searched through the source and found the GFont class. As best I can understand it, I need to create a new Resource with the ResourceManager to create a new font. How do I specify the png file containing the font though? And how would I use the font class to actually print something on the screen?
Thanks!
-Snowman
About the author
#2
So what you need to do is as Rick says, override a few methods in the GFont class, edit the font images the GFont class uses and change the rendering mode a little to allow RBG values.
Phil.
11/24/2001 (5:41 am)
Snowman: The fonts ARE bitmap fonts, basically at runtime the engine looks through the profiles and creates font files for each of the profiles font and size requirements.So what you need to do is as Rick says, override a few methods in the GFont class, edit the font images the GFont class uses and change the rendering mode a little to allow RBG values.
Phil.
#3
FYI: When we ship a Torque game, it includes pre-built bitmap font files because you cannot 100% depend on anyone having the truetype fonts you need.
--Rick
11/24/2001 (6:28 am)
I would keep the code that creates the initial black and white font based on a truetype font. That way you can just go in and colorize it (by hand?) and not have to create the entire thing from scratch, yuck. FYI: When we ship a Torque game, it includes pre-built bitmap font files because you cannot 100% depend on anyone having the truetype fonts you need.
--Rick
#4
The fonts that are generated from truetype only need to be done once (and as rick says, store them in case everyone else doesnt have that font).
Not sure what legal issues you'd have with bitmap renderings of truetype fonts, I remember seeing a discussion, but on the last few games we've done we've always licensed the fonts we use, so it might have some legal issues if you use a specific truetype font in a game?
Phil.
11/24/2001 (7:19 am)
I think using the font code thats already there is the best way to go though. That way all the controls will support your new fonts.The fonts that are generated from truetype only need to be done once (and as rick says, store them in case everyone else doesnt have that font).
Not sure what legal issues you'd have with bitmap renderings of truetype fonts, I remember seeing a discussion, but on the last few games we've done we've always licensed the fonts we use, so it might have some legal issues if you use a specific truetype font in a game?
Phil.
#5
Is there a program to edit the gft files? I was planning on making a goofy little mod, kind of like "show" to let me make my own gft files. That way I can load in my own sheets and specify where the various characters are and what not.
Anyway, thanks again!
-Snowman
11/25/2001 (3:45 pm)
Awesome, Thanks for the posts!Is there a program to edit the gft files? I was planning on making a goofy little mod, kind of like "show" to let me make my own gft files. That way I can load in my own sheets and specify where the various characters are and what not.
Anyway, thanks again!
-Snowman
#6
just my two cents,
--Rick
11/25/2001 (4:08 pm)
There is no way to edit a gft right now, they are generated from any TrueType font you have installed on your system. They are alpha only, so there is not much to edit anyway. The nice thing is you pick a size and the font data is extracted from windows, including all the anti-aliasing information. If you guys end up making an RGB bitmap font you might consider making it RGBA and preserving the anti-aliasing information because the fonts will look so much better.just my two cents,
--Rick
#7
I was planning on opening an existing gtf, extracting the png files and replacing them once they are modified to be RGBA (containing the cool colorings that we have).
Shouldn't be too difficult (I hope!)
Thanks again!
-Snowman
11/26/2001 (5:06 pm)
Thanks Rick. Your 2 cents are always welcome =)I was planning on opening an existing gtf, extracting the png files and replacing them once they are modified to be RGBA (containing the cool colorings that we have).
Shouldn't be too difficult (I hope!)
Thanks again!
-Snowman
#10
02/19/2005 (4:58 pm)
No. They're just a cache for font data; regenerate them if you need to. I believe TSE supports all manner of neat-o colored font type stuff though.
#11
02/19/2005 (4:59 pm)
In general it's better to start a NEW thread than revive a thread older than a year or so. This thread is from 4 years ago.
Torque Owner Rick Overman
I would recommend keeping the sheet packing code to minimize texture memory utilization just write out each sheet to a seperate .png so you can go back and edit it.
font.cfnt <- color font header info, # sheets etc.
font.1.png <- sheet 1, 2, 3, etc
font.2.png
font.3.png
--Rick