User Tools

Site Tools


proton:rtfont

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
proton:rtfont [2010/10/28 04:15] – created sethproton:rtfont [2012/09/26 22:40] (current) seth
Line 1: Line 1:
 ====Using RTFont==== ====Using RTFont====
-RTFont is class to load and blit bitmapped fonts.  It loads a custom .rtfont format which includes kerning data, the font image, colors for "color codes" (Old school BBS people who played LORD may remember this as "Seth ANSI", it just allows you to change color easy in a text string)+RTFont is class to load and blit bitmapped fonts.  It loads a custom .rtfont format which includes kerning data, the font image, colors for "color codes" (Old school BBS people who played LORD may remember this as "Seth ANSI", it just allows you to change color easy in a text string)
  
 Example of use: Example of use:
Line 60: Line 60:
 For the trajan font it needs (located in RTSimpleApp/media/interface) : For the trajan font it needs (located in RTSimpleApp/media/interface) :
   * font_trajan.fnt (kerning data and locations of each character in the bmp, output by BMFont)   * font_trajan.fnt (kerning data and locations of each character in the bmp, output by BMFont)
-  * font_trajan_00.png (the bitmap itself, a png with alpha) +  * font_trajan_00.png (the bitmap itself, a png with alpha)(output by BMFont
-  * font_trajan.txt (a text file with directions for RTPack.exe on what file names to load and what color codes should do)+  * font_trajan.txt (a text file with directions for RTPack.exe on what file names to load and what color codes should do.. you have to make this)
  
 BMFont is [[http://www.angelcode.com/products/bmfont/|AngelCode's Bitmap Font Generator]], a free utility to generate bmps and data for fonts. BMFont is [[http://www.angelcode.com/products/bmfont/|AngelCode's Bitmap Font Generator]], a free utility to generate bmps and data for fonts.
  
-RTPack.exe can be found in /shared/win/utils and can only be run on a Windows system at the moment.+RTPack.exe can be found in **/shared/win/utils**.  If you're on linux/osx, check [[proton:rtpack|here]] for info on compiling it.  (It also works using wine: RTPack.exe -opts etc).
  
 The command line to make this font is: The command line to make this font is:
Line 72: Line 72:
 </code> </code>
  
-If you're making your own font, notice the file font_trajan.mbfc is with the other font stuff.  This is the settings file for BMFont, load it to see what good values are or to tweak an existing font.+If you're making your own font, notice the file font_trajan.mbfc is with the other font stuff.  This is the settings file for Bitmap Font Generator, load it to see what good values are or to tweak an existing font. 
 + 
 +===Making a new font step by step=== 
 +  * Download [[http://www.angelcode.com/products/bmfont|Bitmap Font Generator]] and install it, then run it. 
 + 
 +  * Do Options->Load Configuration, and choose **<protondir>/RTSimpleApp/media/interface/font_trajan.bmfc** 
 + 
 +  * Choose Options->Font settings and change the font to anything you want.  You may need to tweak the bitmap size if your font is too large. 
 + 
 +  * (Be careful not to click any letters - it toggles them being selected, non selected letter won't export) 
 + 
 +  * Do Options->Save Bitmap font and overwrite the old font_trajan.fnt.  (It will also write out font_trajan_00.png without asking you when you do this) 
 + 
 +  * It's done.  Run **/RTSimpleApp/media/update_media.bat** to build the font and place it in the bin dir, and run the app.  The font now look different! 
 + 
 +  * Once that is working, you should probably rename your font files.  You'll also need to rename font_trajan.txt and edit the names inside of it with a text editor. 
 ====Performance==== ====Performance====
 The font code is fast because it batches characters together when it renders using the global RenderBatcher, or allows you to pass in your own RenderBatcher object  so you can render multiple DrawFont calls with a single GL operation later. The font code is fast because it batches characters together when it renders using the global RenderBatcher, or allows you to pass in your own RenderBatcher object  so you can render multiple DrawFont calls with a single GL operation later.
proton/rtfont.1288239319.txt.gz · Last modified: 2010/10/28 04:15 by seth