The font engine is flawed
by Argiris Bendilas · in Torque Game Builder · 07/05/2007 (3:24 am) · 7 replies
Today I realized that the font engine of TGB is seriously flawed, to the point that it made me wonder why we chose Torque for our game development needs.
I consider fonts to be a fundamental aspect of GUIs and I expected at least the basics to be functioning properly.
Here's an image (http://www.testudios.com/files/temp/Font%20Issues.jpg) showing the difference between how the same fonts are rendered in TGB and Photoshop CS2. It's striking to see that font sizes of 20px or 80px are displayed different in each program.
Of course, I'd like to know why this happens and how can one work with fonts when such issues arise.
As you can see for yourselves, the font engine of Torque doesn't support kerning (which is obvious when you notice the distance between "T" and "A".
We've also tried using the Export and Import feature for fonts, but when we decided to add some padding on the exported fonts (to allow special effects from Photoshop to be cast on the font PNG), we run into some serious issues with letters being abnormally spaced, etc.
To sum it all up, we have been totally disappointed by the lack of proper font support in TGB and I really can't think of a solution right now, which will allow us to use fonts as intended.
I consider fonts to be a fundamental aspect of GUIs and I expected at least the basics to be functioning properly.
Here's an image (http://www.testudios.com/files/temp/Font%20Issues.jpg) showing the difference between how the same fonts are rendered in TGB and Photoshop CS2. It's striking to see that font sizes of 20px or 80px are displayed different in each program.
Of course, I'd like to know why this happens and how can one work with fonts when such issues arise.
As you can see for yourselves, the font engine of Torque doesn't support kerning (which is obvious when you notice the distance between "T" and "A".
We've also tried using the Export and Import feature for fonts, but when we decided to add some padding on the exported fonts (to allow special effects from Photoshop to be cast on the font PNG), we run into some serious issues with letters being abnormally spaced, etc.
To sum it all up, we have been totally disappointed by the lack of proper font support in TGB and I really can't think of a solution right now, which will allow us to use fonts as intended.
About the author
#2
When I use the value "80px" for my font size, I expect it to appear the same in all applications that use that font.
So, setting the size to 80px in Photoshop and having Torque rendering the text at around 67px, I think, constitutes a problem.
07/05/2007 (8:07 am)
Hi Stephen.When I use the value "80px" for my font size, I expect it to appear the same in all applications that use that font.
So, setting the size to 80px in Photoshop and having Torque rendering the text at around 67px, I think, constitutes a problem.
#3
I guess the best test would be to set up your desktop resolution and the TGB design resolution to be the same and then compare them from there, unless of course that's what you did in the screenshot you posted.
07/05/2007 (4:30 pm)
I could be wrong but I'm guessing this is occuring because TGB doesn't measure size and distance in absolute pixel values but rather in world units. This allows the size and relative placement of objects to scale depending upon the resolution in which the game is being played and that means the size of a font will not always be an absolute pixel size.I guess the best test would be to set up your desktop resolution and the TGB design resolution to be the same and then compare them from there, unless of course that's what you did in the screenshot you posted.
#4
If you have a very specific visual appearance for a graphical element, you might want to consider baking it out as an image. (You'll want to keep the original PSD around in case you ever need to localize.) This way you can have things look just right with full artistic control.
Of course, that may not be appropriate in all cases. For a stage indicator you might consider baking out "Stage" as an image, then dynamically displaying the numbers.
You might check the font to see how it displays in (e.g.) notepad. Torque uses information reported from the operating system for rendering fonts; it's possible that the OS is not reporting correct information and as a result Torque is rendering incorrectly as well.
It could also be that there are bugs in Torque's font renderer. The only way to nail down the problem if this is the case is going to be to do some comparisons (like between Notepad and Torque) and check what goes wrong where. Torque isn't trying to match Photoshop for text handling capabilities, but it shouldn't do any worse than standard Windows apps - if it is we can file a bug and get it in the queue for the next update.
07/05/2007 (4:35 pm)
Torque doesn't accept font sizes in pixels. You'll have to specify it in points (with no suffix).If you have a very specific visual appearance for a graphical element, you might want to consider baking it out as an image. (You'll want to keep the original PSD around in case you ever need to localize.) This way you can have things look just right with full artistic control.
Of course, that may not be appropriate in all cases. For a stage indicator you might consider baking out "Stage" as an image, then dynamically displaying the numbers.
You might check the font to see how it displays in (e.g.) notepad. Torque uses information reported from the operating system for rendering fonts; it's possible that the OS is not reporting correct information and as a result Torque is rendering incorrectly as well.
It could also be that there are bugs in Torque's font renderer. The only way to nail down the problem if this is the case is going to be to do some comparisons (like between Notepad and Torque) and check what goes wrong where. Torque isn't trying to match Photoshop for text handling capabilities, but it shouldn't do any worse than standard Windows apps - if it is we can file a bug and get it in the queue for the next update.
#5
we put some time into trying to figure out where the discrepency was coming from but didn't find it.
07/05/2007 (5:36 pm)
I've seen discrepencies in TGE's rendering of fonts versus standard windows (eg Notepad or Wordpad) rendering. particularly when the fonts used certain types of kerning. which is odd because TGE calls the standard windows font rendering engine. (aka GetGlyphOutline).we put some time into trying to figure out where the discrepency was coming from but didn't find it.
#6
GFont generates a texture sheet using GetGlyphOutline(). The texture sheet is used kinda like an image map, so supporting kerning there would not be viable. The place to do it would be dglDrawTextN(), e.g. when the text is rendered. It would probably be quite a simple hack. Some modifications to GFont may be required to actually get the default kerning values.
T.
07/06/2007 (1:09 am)
It's been a really long time since I've looked at that code, so I may be wrong, but ...GFont generates a texture sheet using GetGlyphOutline(). The texture sheet is used kinda like an image map, so supporting kerning there would not be viable. The place to do it would be dglDrawTextN(), e.g. when the text is rendered. It would probably be quite a simple hack. Some modifications to GFont may be required to actually get the default kerning values.
T.
#7
We still have a spacing issue to take care of and the use of kerning between characters.
Please, let me know!
07/19/2007 (9:53 am)
Tom, will you be able to help us with some improvements we have made to TGB's font rendering?We still have a spacing issue to take care of and the use of kerning between characters.
Please, let me know!
Torque 3D Owner XanthorXIII