Ok so a while ago someone (Icey Games i thnk) expressed an interest in using spritefonts because he has totally got the rest of his game down and wanted to add some sparkle.
Now SSH wrote a spritefont module but it was awkward to use since it didnt integrate with the normal ags text functions. This plugin solves that problem.
So you can set a spritefont to override a normal font and just use .Say() or Display() calls and the plugin will draw.
This means you can bypass all the issues with font outlining and stuff just by providing your own, multi coloured, anti aliased, fonts.
Functions
Code: ags
where:
fontNum is the font number you wish to replace.
sprite is the sprite number that contains the sprite font
rows is the number of rows in the font
columns is the number of columns
charWidth is the width of a single character (must all be the same)
charHeight ditto height.
charMin is the lowest ASCII number that the font contains
charMax ditto highest.
use32bit is currently unused and can be either true or false.
the spritefont must be formatted sequentially like this one:

the function for this one would be:
Code: ags
Code: ags
This overrides font 'fontNum' with sprite 'sprite'
Code: ags
This allows you to adjust the spacing of a variable width font if its too spread out with drop shadows and stuff
Code: ags
This sets a glyph (character) size and location in the spritefont's texture.
I have included a utility which will generate the code for you.
Usage of variable width fonts
- In the archive is a program called SpriteFont.exe. This program will generate variable width sprite fonts for you with shadows and outlines and all kinds of shit.
- The program generates 2 files. The PNG which is the actual font and a file called metrics.xml.
- In the archive there is also AGSSpriteFontGen.exe. This program will take the metrics.xml and convert it to AGSScript that you can copy into your game.
download
The archive contains a demo and all the files needed.
The helper programs need .Net4.0 to run but the plugin itself has no dependencies.
https://dl.dropboxusercontent.com/u/20918686/ags/ags_sprtitefont.zip
What does it look like? Is it better than AGS's normal font renderering?
Yes it is. It looks like this:
Now SSH wrote a spritefont module but it was awkward to use since it didnt integrate with the normal ags text functions. This plugin solves that problem.
So you can set a spritefont to override a normal font and just use .Say() or Display() calls and the plugin will draw.
This means you can bypass all the issues with font outlining and stuff just by providing your own, multi coloured, anti aliased, fonts.
Functions
//sets a fixed width font
void SetSpriteFont(int fontNum, int sprite, int rows, int columns, int charWidth, int charHeight, int charMin, int charMax, bool use32bit)
where:
fontNum is the font number you wish to replace.
sprite is the sprite number that contains the sprite font
rows is the number of rows in the font
columns is the number of columns
charWidth is the width of a single character (must all be the same)
charHeight ditto height.
charMin is the lowest ASCII number that the font contains
charMax ditto highest.
use32bit is currently unused and can be either true or false.
the spritefont must be formatted sequentially like this one:

the function for this one would be:
SetSpriteFont(0, 1, 3, 20, 16, 16, 32, 91, true);
void SetVariableSpriteFont(int fontNum, int sprite);
This overrides font 'fontNum' with sprite 'sprite'
void SetSpacing(int fontNum, int spacing)
This allows you to adjust the spacing of a variable width font if its too spread out with drop shadows and stuff
void SetGlyph(int fontNum, int charNum, int x, int y, int width, int height)
This sets a glyph (character) size and location in the spritefont's texture.
I have included a utility which will generate the code for you.
Usage of variable width fonts
- In the archive is a program called SpriteFont.exe. This program will generate variable width sprite fonts for you with shadows and outlines and all kinds of shit.
- The program generates 2 files. The PNG which is the actual font and a file called metrics.xml.
- In the archive there is also AGSSpriteFontGen.exe. This program will take the metrics.xml and convert it to AGSScript that you can copy into your game.
download
The archive contains a demo and all the files needed.
The helper programs need .Net4.0 to run but the plugin itself has no dependencies.
https://dl.dropboxusercontent.com/u/20918686/ags/ags_sprtitefont.zip
What does it look like? Is it better than AGS's normal font renderering?
Yes it is. It looks like this:
