Game Development Community

Regarding the Font engine

by Jane Austen · in Torque Game Engine · 03/06/2002 (8:35 am) · 5 replies

Hi all!

I met two questions:

1. How can I displaying Unicode characters with Torque?
2. How can I displaying TrueType fonts with Torque?

Thank you in advance!!!

#1
03/06/2002 (9:10 am)
When you create profiles for GUI objects you can specify the type of font you wish to display through the 'fontType' parameter.

The beauty of this is you can name fonts that are in the Fonts folder on the system, at least in Windows. The engine will automatically convert the font into a usable font and store it in the cache folder somewhere.

Somethings you have to be aware of though, is that the end user may not have the font installed on their system. In such a case all you have to do is

1) Either provide the system font to be put in the Fonts folder on the system, or

2) Provide the Engine created font stored in the cache.

Some code:
new GuiControlProfile (EditorTextProfile)
{
   fontType = "Arial Bold";
   fontColor = "0 0 0";
   autoSizeWidth = true;
   autoSizeHeight = true;
};

As you can see here, this GUI control is using the font type Arial Bold.
#2
03/06/2002 (7:01 pm)
Basically, the font system creates a bitmap from truetype fonts on-demand (with slightly different conversion algorithms on the Mac and Windows and Linux).

I'm not sure the code supports multibyte characters at all. Certainly the font code is really targeted at 8-bit character sets.

It is possible you could create new text rendering controls that render 'live' using unicode text and GDI/Quickdraw/FreeType on the various platforms, but you'd really have to pull that together yourself (unless someone in the community jumps on it).

At least, that's what I understand the system to be. ;)

d
#3
03/07/2002 (6:38 am)
Hi,

adding unicode support to the engine is nearly impossible, I think.
The problem is that there was no special type used for characters so it will cause a realm of chaos if you redfine S8 as wide char!
Absolute incompatiblity and bandwidth and memory waste would be the consequence.

I think a better way than rewriting the half source is to add unicode char conversation like in html.

just my 0,02 ;)
#4
03/07/2002 (11:21 am)
How about using glXUseXFont(on X Window system) and wglUseFontBitmaps/wglUseFontOutlines (on Win32) to implement the text drawing functions? Will this method (maybe overwriting dglDrawTextN, dglDrawText etc.)be possible to take effects?

Really hope for replies. Thank you in advance.
#5
03/07/2002 (6:27 pm)
as 'fi' mentioned, it's more than simply using some other methods. the engine would need to be overhauled for multibyte strings, or at least in those areas that needed them.

I don't know enough about the outline functions to know if they'd do the job, or how well they perform. Or what methods are available on what platforms.

d