Font export bug (core engine)
by Michael Woerister · in Torque Game Builder · 04/28/2006 (9:14 am) · 5 replies
Hi,
the either GFont::exportStrip() or GFont::importStrip() or both are bugged.
Repro:
- delete all files from the font cache directory
- type the following in the console:
The first export gives expected results:

But the second is messed up:

This does not happen if you leave out the importCachedFont call, so I guess the error must be in GFont::importStrip().
EDIT: I just noticed that the last character ('h' and 'z') did not get exported. Seems to be another error.
the either GFont::exportStrip() or GFont::importStrip() or both are bugged.
Repro:
- delete all files from the font cache directory
- type the following in the console:
// add some characters to the cache
populateFontCacheString("Arial",20,"abcdefgh");
// export it
exportCachedFont("Arial",20,"test/arial1.png",2,2);
// import it again with or without modifying it
importCachedFont("Arial",20,"test/arial1.png",2,2);
// add some more characters
populateFontCacheString("Arial",20,"xyz");
// export again
exportCachedFont("Arial",20,"test/arial2.png",2,2);The first export gives expected results:

But the second is messed up:

This does not happen if you leave out the importCachedFont call, so I guess the error must be in GFont::importStrip().
EDIT: I just noticed that the last character ('h' and 'z') did not get exported. Seems to be another error.
#2
04/29/2006 (2:10 am)
The parameters above are for kerning and padding. The source comment for GFont::importStrip says "Import an image strip generated with exportStrip, make sure parameters match!". So if parameters match, everything should work. I can't find anything like weight in the GFont class. I think weight is only applied when a character is retrieved from the OS and it is always zero (see WinFont::create() in winFont.cc).
#3
Take a look here at the note on importCachedFont().
Not sure if this could be your problem, but Alex and I had a problem with importing fonts because we weren't handing the importing/exporting with padding correctly.
In looking at your example "abcdefgh" should end up with a padding of 4 and "xyz" should have a padding of 2.
(edit:typo in link)
04/29/2006 (7:37 am)
Sorry, used the wrong parameter name, weight is the same as padding. Take a look here at the note on importCachedFont().
Not sure if this could be your problem, but Alex and I had a problem with importing fonts because we weren't handing the importing/exporting with padding correctly.
In looking at your example "abcdefgh" should end up with a padding of 4 and "xyz" should have a padding of 2.
(edit:typo in link)
#4
Thanks again.
-Michael
04/29/2006 (9:36 am)
Thanks for hint Kevin. I'll take a closer look at this when I get time. (Unfortunatly I cannot access that TDN page as I don't have a TGE license).Thanks again.
-Michael
#5
I've read the note (thanks again, Justin :). It says something like this actually I don't call importCachedFont() twice but only once... I still think it is a bug. And if it isn't then the whole thing is way too crude for me to use. Maybe I'll try to write more stable and usable functions on my own.
05/01/2006 (12:38 pm)
Ok,I've read the note (thanks again, Justin :). It says something like this actually I don't call importCachedFont() twice but only once... I still think it is a bug. And if it isn't then the whole thing is way too crude for me to use. Maybe I'll try to write more stable and usable functions on my own.
Associate Kevin Ryan
Top Meadow Inc.
I can't rember off the top of my head if any of the parameters in your calls above are weights, but if they are then this could be your problem.