Game Development Community

Font problems

by Rubes · in Torque Game Engine · 02/02/2006 (10:57 am) · 37 replies

I've been trying to get new fonts into my game, but I'm running into some issues (using 1.4).

I tried replacing the typical Arial font in most of my Gui's with a custom font installed on my Mac system. Works fine. Everywhere I expect to see the new font, I see it. The appropriate font/size UFT file is created in the font cache folder as well.

However, if I move my game to another system (Mac or PC) that does not have this font installed, it doesn't display at all. Or, if I disable the font in my original system, it won't work there either. So it doesn't seem to be using the cached font file.

I searched around but didn't see anything obvious on this. There is a TDN article on Torque Unicode but I didn't entirely grasp it and I'm not sure it has the solution. Anybody else seeing this?
Page«First 1 2 Next»
#21
04/17/2006 (11:44 am)
Once Manoel's change is implemented, TSE will not compile.

It does not like the GFont instead of GOldFont, at all.
#22
04/17/2006 (11:49 am)
Not sure about that one C2, CVS Head for TGE-L is currently using that change. I beleive all platforms are as well. I am currently working on getting 1.4.2 off my plate and to GG, which contains the above fix and no one that I have sent test installers to have reported any issues with the change mentioned.

-Ron
#23
04/17/2006 (12:22 pm)
According to the latest head from CVS, it's not. Still GOldFont.
#24
04/17/2006 (12:24 pm)
Very interesting, let me go poking around SVN and CVS. I know those changes were made, maybe I did not
push them to CVS seeing that they would effect all platforms not just Linux.

-Ron
#25
04/17/2006 (12:25 pm)
Says the last time gFont.cc was changed was 9/9/2005. Maybe my WinCVS isn't getting the latest revision correctly. Edit: My TSE downloads I know are the latest, and the latest gFont.cpp was modified 1/18/2006, and still has the old version of the font code.
#26
04/17/2006 (12:28 pm)
Ah!

The changes that I made did not touch gFont.cc instead I just made the modifications to main.cs as Manoel suggested above.

Also, see my post on 3/15

Quote:
FYI,

I pushed this change to CVS a few days ago (the constructNewFont one)


-Ron
#27
04/17/2006 (1:27 pm)
Is there anything else I need to do to get it to work besides make Ben Garney's change and the change in main.cc?

The custom fonts that work on my PC still don't work on others' PCs.
#28
04/18/2006 (8:50 am)
C2, make sure you undo the "fix" I posted earlier about using gFont instead of gOldFont, that was a hack forcing all fonts to be built as gFont, and the fix in main.cc should be used instead.

Also make sure you populate the fonts before delivering the cached files to another PC, otherwise characters missing in the cache will be filled using Arial or some other font.

We have been using custom fonts in our game for a month now, and it works fine in the machines without the font installed.
#29
04/18/2006 (9:06 am)
Manoel,

This has been working fine for me as well, but I think the fix to main.cc might obviate the need to populate the font. I installed a new font for my game, and played it through without using all of the characters on screen. Then I turned the font off on my system and played again. It seemed to be able to display all characters in upper and lower case, as well as all numbers, even though I didn't use them the first time.

Can you confirm that?
#30
04/18/2006 (9:56 am)
Alright... so populateFontCacheRange doesnt seem to work, amazing. -_-

I typed this in the console:
populateFontCacheRange("Courier New", 14, 0, 128);

and got:
==>populateFontCacheRange("Courier New", 14, 0, 128);
<input> (0): Unable to find function populateFontCacheRange

Ah, I'm on a version of Milestone 2. The functions I need are part of the TGE 1.4 integration into TSE Milestone 3. That might help.
#31
04/18/2006 (10:04 am)
@C2:

populateFontCacheRange is in gNewFont.cc.
#32
04/18/2006 (10:17 am)
Not in my version. I'll have to merge with MS3.
#33
07/17/2006 (8:58 pm)
OK I tried this stuff and fell flat on my face. Is this going to be totallly fixed in 1.4.2?
#34
07/24/2006 (6:36 am)
I added the two sections to the main.cc and it made no difference at all. With this populate cache function, do you need to know all of the fonts that you are using?
#35
07/24/2006 (7:56 am)
Hi Ron,

Open engine\game\main.cc and go to line 128.

Change the whole section to read like this:

// Register known file types here
   ResourceManager->registerExtension(".jpg", constructBitmapJPEG);
   ResourceManager->registerExtension(".png", constructBitmapPNG);
   ResourceManager->registerExtension(".gif", constructBitmapGIF);
   ResourceManager->registerExtension(".dbm", constructBitmapDBM);
   ResourceManager->registerExtension(".bmp", constructBitmapBMP);
   ResourceManager->registerExtension(".bm8", constructBitmapBM8);
   [b]ResourceManager->registerExtension(".uft", constructNewFont); //fix[/b]
   [b]ResourceManager->registerExtension(".gft", constructFont);        //fix[/b]
   ResourceManager->registerExtension(".dif", constructInteriorDIF);
   ResourceManager->registerExtension(".ter", constructTerrainFile);
   ResourceManager->registerExtension(".dts", constructTSShape);
   ResourceManager->registerExtension(".dml", constructMaterialList);
   ResourceManager->registerExtension(".map", constructInteriorMAP);

Now, when you need to import a new font just create the profile for it in client\ui\customProfile.cs

E.g.
new GuiControlProfile ("VersionTextProfile")
{
   opaque = false;
   fontType = "Abduction";
   fontSize = 14;
   fontColor = "255 255 255";
};

then run your game and type this into the console:
populateAllFontCacheRange(1, 128)

That should do it. Let me know if you have any troubles.

I'd like to see a patch for 1.4 to fix the most obvious annoying bugs. I'm not complaining GG, just requesting.

- Fix audio leak in Audiobuffer.cc
- Fix explosions in Explosions.cc
- Fix a problem in main.cc that was preventing custom fonts being imported
- Fix Alt-tab crash in WinOGLVideo.cc
- Fix particle editor
- Fix onNeedRelight Function
- Fix a problem with death cam in camera.cc
- Fix text input in guiTextEditCtrl.cc
- Fix Show Tool and creat a batch file for it
- Fix dedicated server problem in creator\main.cs
- Fix timeManager settings for dedicated server
- Execute common\defaults.cs from right spot to prevent prefs being brute forced incorrectly
- Move onNeedRelight function from editorGui.cs to server\init.cs. It's needed on the server
- Comment out or delete all unavailable sound profiles in player.cs that cause console spam
- Eliminated all remaining console errors & warnings

Please consider.

- Tim
#36
07/24/2006 (5:25 pm)
Thanks Tim. That worked.
#37
01/08/2007 (12:01 am)
It works Tim Heldna... nice one... I've working with custom fonts stuff for over 3 hours... that two lines of code really save my time...
Page«First 1 2 Next»