SpriteFont and non-'freetype based' fonts

How to fit bitmap fonts in there?

Information and discussion for custom maps and mods.
Post Reply
twarpie
Posts: 60
Joined: Sun Jun 26, 2011 3:10 pm

SpriteFont and non-'freetype based' fonts

Post by twarpie »

As far as I understand the code, OpenRA normally takes TTF fonts and converts a certain range of glyphs into Sprites using FreeType, which are then used in the DrawText*(..) and Measure(..) methods.

Fonts already in bitmap form don't need the FreeType render step, so I was wondering what the 'correct' approach here would be to support non-freetype-needing SpriteFonts? One approach could be an interface between users of SpriteFont and actual SpriteFont implementations, another could be taking the initialization code out of SpriteFont and make it purely a glyph container with added DrawText etc methods.

Any ideas?

chrisf
Posts: 246
Joined: Mon Sep 06, 2010 4:59 am

Post by chrisf »

You can use most popular bitmap font formats with FreeType as well.

twarpie
Posts: 60
Joined: Sun Jun 26, 2011 3:10 pm

Post by twarpie »

chrisf wrote: You can use most popular bitmap font formats with FreeType as well.
Yes, but in this case it's a decoded TD/RA95 'fnt' file. I've implemented a FntReader to be able to use the original fnt fonts from RA95 in OpenRA and am now wondering as to how to convert the bitmaps to glyphs SpriteFont can use.

Post Reply