Game Development Community

T2d beta and new ansi ufx font files

by Anthony Rosenbaum · in Torque Game Builder · 02/07/2006 (6:24 am) · 3 replies

I just noticed something; I ported my code yesterday to the t2d beta. My current project uses P22's Leonardo da Vinci font. I noticed the new beta produces ansi .uft files not .gft file as before for fonts. Today I move the whole game folder over to my school computer today with font .uft files, but they do not work. The font isn't recognized at school because the P22 font is on my home computer. The .gft files were useful because the fonts were stored as graphic calls so that they worked cross platform, but the .uft do not seem to work.

Any one else encounter this? I presume if it won't work on another PC is defiantly will not work with MACs, this is important issue I need clarification on, School projects are dependant it.

#1
02/07/2006 (9:58 am)
Anthony, this problem is related to the fact that the registered extension ".uft" for the new gfont code is registered with the same function as ".gft" (constructFont). This is a mistake and can be resolved by changing the following code.

in your (source/game/main.cc) file around line (120) (initLibraries)

ResourceManager->registerExtension(".bm8", constructBitmapBM8);
   ResourceManager->registerExtension(".dbm", constructBitmapDBM);
   ResourceManager->registerExtension(".png", constructBitmapPNG);
   ResourceManager->registerExtension(".gft", constructFont);
  [b] ResourceManager->registerExtension(".uft", constructFont);[/b]

   ResourceManager->registerExtension(".dts", constructTSShape);

to

ResourceManager->registerExtension(".bm8", constructBitmapBM8);
   ResourceManager->registerExtension(".dbm", constructBitmapDBM);
   ResourceManager->registerExtension(".png", constructBitmapPNG);
   ResourceManager->registerExtension(".gft", constructFont);
[b]   ResourceManager->registerExtension(".uft", constructNewFont);[/b]

   ResourceManager->registerExtension(".dts", constructTSShape);

Also, the packaging utility does not currently support .uft fonts, to add this you'll need to open up your

tools/packagingutility/font_handler.cs file and change at the top of the file

//-----------------------------------------------------------------------------
// Torque2D Packaging Utility
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
[b]$Font::extentions = ".gft";[/b]

- to -

//-----------------------------------------------------------------------------
// Torque2D Packaging Utility
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
[b]$Font::extentions = ".gft .uft";[/b]

Hope this helps anthony :)

Cheers,
-Justin
#2
02/08/2006 (2:53 am)
Woot! I was about to post about this exact issue. I noticed something similar just now when I build I distributed to my team had all of it's fonts replaced with Arial rather than our custom fonts.

Just to ask, are there any resources (accessible to T2D owners) that explain exactly how the engine handles fonts? I'd like to make sure that I'm not operating under any false assumptions.

Slightly off topic, but I'm actually using a heavily modified version of the t2dTextObject resource to do most font rendering within the game (modified to wrap text and allow justification), as doing so seems to be more in line with the T2D way of doing things rather than the existing GUI system. It's actually gotten to the point where I find it easier and cleaner to develop custom gui elements in torquescript using T2D (with callbacks to handle mouseover, mousedown, etc). I don't have a great understanding of the Torque GUI stuff, so it might just be me. Are there any thoughts around using T2D to develop gui components?
#3
02/08/2006 (6:02 am)
I always build custom GUI systems with script for my games. They're much more flexible and "game-like" (ie, fun). I don't see any downside to it.