Fonts, again
by Argiris Bendilas · in Torque Game Builder · 08/01/2007 (5:35 am) · 39 replies
Hi everyone.
I'd like to export fonts (PNGs), spice them up in Photoshop and then import them back to TGB.
Today I realized, however, that when I use weights and styles (bold, italic, etc.) for some fonts (I say some because I don't always get this behavior), I get an Arial font rendering, which I guess is the default font for TGB.
I would like as many of you as possible to perform this test.
Here are the two functions you need:
I'd like to export fonts (PNGs), spice them up in Photoshop and then import them back to TGB.
Today I realized, however, that when I use weights and styles (bold, italic, etc.) for some fonts (I say some because I don't always get this behavior), I get an Arial font rendering, which I guess is the default font for TGB.
I would like as many of you as possible to perform this test.
Here are the two functions you need:
function populateFontsEX(%font,%sizes,%chars)
{
for (%i = 0; %i < getWordCount(%sizes); %i++) {
%size = getWord(%sizes,%i);
populateFontCacheString(%font,%size,%chars);
}
writeFontCache();
}
function fontbitmapIOEX(%font,%sizes,%import,%padding,%kerning,%alreadyImported)
{
%pngdir = "pngs/";
%fontdir = "./common/ui/cache/";
for (%i = 0; %i < getWordCount(%sizes); %i++)
{
%size = getWord(%sizes,%i);
if(%allreadyImported){
%padding = 0;
%kerning = 0;
}
%fileName = %fontdir @ %pngdir @ %font SPC %size @ ".png";
if (%import)
importCachedFont(%font, %size, %fileName, %padding, %kerning);
else
exportCachedFont(%font, %size, %fileName, %padding, %kerning);
}
writeFontCache();
}
#2
08/01/2007 (8:17 am)
I don't have an Arial Bold font. I have Arial and Arial Black. Are you sure you can just add 'bold' after the name and it will give you the bold version?
#3
Thank you for replying.
It's almost impossible that you don't have a bold weight for Arial. Do you mean you can't see it in TGB? If so, I don't know why Garage Games have decided to not display weights and style for fonts, but it IS in your system.
08/01/2007 (8:46 am)
Hi Dan.Thank you for replying.
It's almost impossible that you don't have a bold weight for Arial. Do you mean you can't see it in TGB? If so, I don't know why Garage Games have decided to not display weights and style for fonts, but it IS in your system.
#4
08/01/2007 (9:45 am)
A helpful note.. you can put code within [ code] [ /code] tags (remove the space after the "[") and it will preserve the code indenting.
#6
When I run this command:
populateFontsEX("Arial", 30, "0123456789ABCDEFGHI");
it crashes... going to try and debug it.
08/01/2007 (9:55 am)
What version of TGB are you using...When I run this command:
populateFontsEX("Arial", 30, "0123456789ABCDEFGHI");
it crashes... going to try and debug it.
#7
08/01/2007 (10:01 am)
Matt, I'm on 1.1.3 as migrating to 1.5 was more trouble than good and we had to leave it (at least for the moment).
#8
Edit - This slowdown issue could have been a mistake in some of my other code, but it only seems to be happening when I try to load a font I added colors and an alpha layer to.
08/01/2007 (10:02 am)
I think I'm close to getting my edited font images to load into my TGB game, but for some reason no matter what I do my game slows down to 1 FPS when I try to use a font that I edited. I used to be able to edit/import font graphics with TGB 1.3 just fine, so I'm wondering if maybe it's a directory issue. Sadly there are no errors or warnings on the console to give me a clue. I really wish TGB had an easy way to import font images...Edit - This slowdown issue could have been a mistake in some of my other code, but it only seems to be happening when I try to load a font I added colors and an alpha layer to.
#9
We typically can only fix issues that are a priority (or if it happens to fall in our lap). Now that I've been seeing some good and solid issues with the Font system though this might warrant raising it's priority. I'm going to run some tests myself and then log it in our bug tracking software and see if we can get it fixed.
08/01/2007 (10:06 am)
Believe it or not we haven't heard all that many complaints about the font system in Torque. Sure some have, though considering the font system is relatively the same in TGE and I believe it's been pretty much the same system (minus unicode of course) in TGE for multiple years. We typically can only fix issues that are a priority (or if it happens to fall in our lap). Now that I've been seeing some good and solid issues with the Font system though this might warrant raising it's priority. I'm going to run some tests myself and then log it in our bug tracking software and see if we can get it fixed.
#10
I can get you even more proof that there needs to be work on the font system of TGB.
For starters, check another thread I'd started some time ago for details (http://www.garagegames.com/mg/forums/result.thread.php?qt=64291).
08/01/2007 (10:22 am)
Thank you Matt.I can get you even more proof that there needs to be work on the font system of TGB.
For starters, check another thread I'd started some time ago for details (http://www.garagegames.com/mg/forums/result.thread.php?qt=64291).
#11
non-bold

bold
08/01/2007 (10:24 am)
Here was my results in 1.1.3... btw probably a good idea to not migrate to 1.5 if you are getting deeper into development. This usually is true with any software.non-bold

bold
#12
08/01/2007 (10:26 am)
Btw the problem with font exporting and the such in 1.5 is directly tied to the directory access issues... so hopefully that will be remedied soon. 1.5 had quite a bit of changes to how directories are handled.
#14
08/01/2007 (10:29 am)
It seems I'm not running into the same problems.
#15
"Futura XBlk BT Extra Black"

Then I tried it as bold, even though I don't have a ttf bold font file for it, which as you suspected it defaulted to Arial
"Futura XBlk BT Extra Black Bold"
08/01/2007 (10:32 am)
Tried a random font in my fonts folder..."Futura XBlk BT Extra Black"

Then I tried it as bold, even though I don't have a ttf bold font file for it, which as you suspected it defaulted to Arial
"Futura XBlk BT Extra Black Bold"
#16
08/01/2007 (10:32 am)
A question, what OS are you using?
#17
It's interesting that it's working fine for you.
Are you using an "off-the shelf" untouched (C++ source wise) version of TGB?
08/01/2007 (10:45 am)
Matt, I'm on Windows XP SP2.It's interesting that it's working fine for you.
Are you using an "off-the shelf" untouched (C++ source wise) version of TGB?
#18
Could you double check that you do in fact have those fonts in your C:\Windows\Fonts\ folder. Don't see why you wouldn't but never hurts.
08/01/2007 (10:49 am)
Yup... the ones I dev and work on are in completely different directories, to ensure I was using a proper version I browsed out to the install directory (I usually give the releases a test run before we release them even though I'm not QA).Could you double check that you do in fact have those fonts in your C:\Windows\Fonts\ folder. Don't see why you wouldn't but never hurts.
#19
08/01/2007 (10:54 am)
Grabbing a fresh 1.1.3 and installing it into a fresh directory just to make sure.

Torque Owner Argiris Bendilas
So, as I was saying...
Here's how I'd like you to use the functions above:
populateFontsEX("Arial", 30, "0123456789ABCDEFGHI"); fontbitmapIOEX("Arial",30,false,5,0,false); populateFontsEX("Arial Bold", 30, "0123456789ABCDEFGHI"); fontbitmapIOEX("Arial Bold",30,false,5,0,false);You can see the result on my computer at www.testudios.com\files\temp\FontsAgain.png.
By the way, what happens if I want to use other weights such as Semibold and Extra?
To further illustrate my point, here's a test based on "Courier New" and "Courier New Bold": www.testudios.com\files\temp\FontsAgain2.png
Let me know what you all get. This should be interesting!
Thanks!