Game Development Community

Font export can't write file

by Kostiantyn Teterin · in Torque Game Builder · 07/14/2007 (4:29 pm) · 4 replies

I am using the following code to export font in pngs:

%font = "BethHand";
%sizes = "64";
for(%i = 0; %i < getWordCount(%sizes); %i++) {
%size = getWord(%sizes, %i);
%weight = 4;
%filename = expandFilename("~/fonts/" @ %font @ %size @ ".png");
exportCachedFont(%font, %size, %fileName, %weight, 0);
}

On both my mac and PC I've got the same error message:

GFont::exportStrip - failed to open 'game/fonts/pngs/BethHand64.png' for writing.

I've tried to change folders, file names and so on. However, everything I did isn't helpful =(

Can you please suggest me how to solve this problem?

#1
07/15/2007 (1:25 pm)
Sorry for *bump*, but I still need help on this issue. :(
#2
07/16/2007 (10:20 am)
If you are using TGB 1.5 Try this.


%filename = getUserDataDirectory() @ "gamename/fonts/" @ %font @ %size @ ".png";
exportCachedFont(%font, %size, %fileName, %weight, 0);

*** gamename refers to whatever your game is called.
#3
07/17/2007 (3:09 am)
Well, I've found another solution:

%filename = getTemporaryDirectory()@"/fonts/pngs/"@fontName@size@".png";

getTemporaryDirectory return a full path to the folder where game is installed.

By the way, its sad that TGB have so poor documentation. I need to spend days to find solution for such a primitive issues. :(
#4
05/26/2009 (2:39 pm)
I'm getting this issue on v1.7.4 using winXP Pro.
The getUserDataDirectory() and getTemporaryDirectory() functions do not exist apparently. I tried to call them both from the script and in the console to no avail.
This page(tdn.garagegames.com/wiki/TorqueUnicode) doesn't have enough information either.

Is there a workaround for this?