Patch to improve the font rendering engine

Bertrand Coconnier <[email protected]>
Newsgroups gmane.games.torcs.devel
Message-ID <1200233045.5567.47.camel@QuesoStation>
Hi people,

I play Torcs for a while and I enjoy it very much. Thank you guys for
this great game.

However, the fonts used to render the text are pretty ugly and AFAICS
the current font mechanism does not allow for internationalization (see
http://sourceforge.net/mailarchive/forum.php?thread_name=BAY119-F25AF64C37E5992D2507ADBC6D90%40phx.gbl&forum_name=torcs-devel ). So as a maintainer of a library for text rendering with OpenGL (QuesoGLC see at http://quesoglc.sourceforge.net), I submit you the attached patch to use QuesoGLC instead of the current font rendering engine.

I used this patch since a few days and it just works Ok. When using my
patch, fonts are antialiased so they are nicer. Moreover, QuesoGLC uses
TrueType / Type 1 / OpenType and generally speaking any font format
which is supported by FreeType, so it is quite easy to customize the
fonts to your need (see the patched screen.xml for an example). QuesoGLC
also supports Unicode (UTF-8 and right to left ordering) so this might
ease the internationalization of Torcs. The library also takes care of
all the cache burden so you do not have to worry about memory and
texture management related to font rendering (only one 1024 x 1024 x 8
bits texture is allocated - that is 1 Mb of texture memory - which is
quite few with regard to the standard gfx card memory - even for the
good old TNT and its 32 Mb).

The drawback is that the use of QuesoGLC along with Torcs costs 15%~20%
of framerate but I am working hard to improve that ;-) Another drawback
is that it adds yet another dependency to Torcs. I do not know your
policy relative to dependencies and this patch is just a suggestion. 

Enough of self congratulations, you can find some screenshots at the
QuesoGLC web site :

http://quesoglc.sourceforge.net/torcs_before.png
http://quesoglc.sourceforge.net/torcs_after.png
http://quesoglc.sourceforge.net/torcs_before2.png
http://quesoglc.sourceforge.net/torcs_after2.png

Finally, some comments about the patch :

1. I modified the meaning of some of the parameters of screen.xml which
might not be suitable for backward compatibility. If it is an issue I
can change the patch so it uses "Menu TrueType Font" instead of "Menu
Font" for instance.

2. The patch uses a free TrueType font for the digital display which is
LCDMono2. You can download it at
http://quesoglc.sourceforge.net/lcd_lcd_mono.zip. The font files
(LCDM2*.TTF) must be installed in the Torcs directory data/fonts so that
QuesoGLC can find them. If some (or all) of the fonts are not available
on your system then QuesoGLC automagically falls back to one of the
fonts of your system (which font depends on your settings of
Fontconfig).

Whatever is your opinion I would appreciate feedback.

Regards,

Bertrand.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
Torcs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/torcs-devel
patch-GLC.diff.gz (application/x-gzip, 3.6 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.