Embedding a font and overlaying graphics
by Andy Hawkins · in Torque Game Builder · 11/27/2008 (4:26 pm) · 9 replies
Here are two pics which outline my issues.
In the first pic I have a grimy overlay I have mounted to the player to be a full screen effect, but as the player moves the overlay is slightly out of synch and lags behind until the player stops. What's the correct way to draw images on top of everything else that are locked to the camera? Bearing in mind I want to make it an animated sprite as well.
Also see in the first pic the font is Arial and the second pic is Avigo.
At home I have included the font in my windows font folder so TGB can find it, but when I export it and play it on another computer the font has not been embedded with the project. How do I do that?
Also it's a true type font but does not scale without pixelating. Do I have to convert it to a different format or something? Are there tools for that? I guess I would need to convert it to make it platform independent yes?


In the first pic I have a grimy overlay I have mounted to the player to be a full screen effect, but as the player moves the overlay is slightly out of synch and lags behind until the player stops. What's the correct way to draw images on top of everything else that are locked to the camera? Bearing in mind I want to make it an animated sprite as well.
Also see in the first pic the font is Arial and the second pic is Avigo.
At home I have included the font in my windows font folder so TGB can find it, but when I export it and play it on another computer the font has not been embedded with the project. How do I do that?
Also it's a true type font but does not scale without pixelating. Do I have to convert it to a different format or something? Are there tools for that? I guess I would need to convert it to make it platform independent yes?


#2
Also it never finds my new Arvigo font. It only finds this following fonts. I think I may have to define it somewhere, other than relying on it creating the font from the windows/font folder. But not saving the uft files could also be a problem.
11/28/2008 (5:48 am)
I get this after running the code above. Looks like a Vista permissions problem. Could not open 'C:/Users/Vista/AppData/Roaming/RimWorldsRedux/Masonik Asylum 0.3 - change: collision and animation for player./fonts/Arial 14 (ansi).uft' for write!
Also it never finds my new Arvigo font. It only finds this following fonts. I think I may have to define it somewhere, other than relying on it creating the font from the windows/font folder. But not saving the uft files could also be a problem.
Arial 24 Arial 36 Lucida Console 12 Arial Bold 14 Arial 14
#3
Not sure if that will help with your path problem though.
The uft export will likely only pickup on your new font if you open a scene that uses it prior to running the export command. However, it could be that the editors are not populating the uft cache for the same reason the above code errors.
11/28/2008 (6:11 am)
I had a similar messed up path when trying to save a simset to a disk. I fixed it by ensuring the CommonConfig.xml in both the development directory and in the Roaming profile directory were identical for the Company and GameName fields. Not sure if that will help with your path problem though.
The uft export will likely only pickup on your new font if you open a scene that uses it prior to running the export command. However, it could be that the editors are not populating the uft cache for the same reason the above code errors.
#4
It doesn't seem to matter what I do I still get the font writing problems as above - I think it's Vista permissions thing.
I tried this resource (below) but while it creates the font it never gets used when I export the game to another computer.
Font boy
11/28/2008 (4:16 pm)
I got it to find my font by creating a GUI Profile for itArvigo 72 (ansi).uft Arvigo 24 (ansi).uft Arvigo 36 (ansi).uft Lucida Console 12 (ansi).uft Arial Bold 14 (ansi).uft Arvigo 14 (ansi).uft
It doesn't seem to matter what I do I still get the font writing problems as above - I think it's Vista permissions thing.
I tried this resource (below) but while it creates the font it never gets used when I export the game to another computer.
Font boy
#5
I've been using 1.7.4 recently on vista and aside from the path problem I mentioned earlier, I've not hit any permission problems with saving/loading.
11/28/2008 (4:24 pm)
Which version of TGB are you using?I've been using 1.7.4 recently on vista and aside from the path problem I mentioned earlier, I've not hit any permission problems with saving/loading.
#6
11/28/2008 (6:16 pm)
I'm using 1.5.1 - I'll try 1.7.4 instead
#7
11/28/2008 (7:11 pm)
Well I got a font object to use the Arvigo font, but if I add it in the gui builder using a new profile text object it reverts to Arial on another computer. That'll do for now - but not totally what I want. Also the new text profile doesn't come up in the gui builder, I have to edit the script by hand.
#8
11/30/2008 (8:35 pm)
Vista will write the uft font to C:/Users/Vista/AppData/Roaming/RimWorldsRedux/Masonik Asylum 0.3, but you need to copy that file into the common/data/fonts folder for your game when you distribute it, then it will work on other computers.
#9
11/30/2008 (8:47 pm)
Great thanks - I will try it out.
Torque Owner Gary Preston
TGB should export any fonts you use into the common/data/fonts/ folder. Check to see if you have a uft file for the custom font you're using. If not you can force it to happen with the following:
The numbers 1 to 128 can be altered to include the character set you'll need to use.
The reason for the pixelation is probably because T2DTextObject doesn't use a true type font at it's exact pointsize. By that I mean, if you rendered the font at 33pt in the normal gui text object, you'd get a 33pt font appearing and been used in the font cache (uft).
However with TGB, you instead get a range of font sizes, for example 30 60 90. Then TGB selects the smallest font that is bigger than the current pixel size of the text you want to display and uses that font size scaling it if needed. It will be this scaling that is probably causing you to see some artifacts.
You can use the "fontSizes" field on text objects to specify how many font sizes should be made available, but bear in mind if the users changes resolution, the effective size of font needed will increase/decrease accordingly.
Whether theres anything else that can be done to improve the quality of font rendering, beyond specifying a number of extra fontSizes, I'm not sure. If anyone knows of anything, I'd like to know :)