Quantcast
Channel: directxtk Wiki Rss Feed
Viewing all articles
Browse latest Browse all 874

Updated Wiki: MakeSpriteFont

$
0
0
The MakeSpriteFont tool can process any TrueType font that is installed on your system (using GDI+ to rasterize them into a bitmap) or it can import character glyphs from a specially formatted bitmap file. This latter option allows you to create multicolored fonts, drawing special effects such as gradients or drop shadows directly into your glyph textures. Characters should be arranged in a grid ordered from top left to bottom right. Monochrome fonts should use white for solid areas and black for transparent areas. To include multicolored characters, add an alpha channel to the bitmap and use that to control which parts of each character are solid. The spaces between characters and around the edges of the grid should be filled with bright pink (red=255, green=0, blue=255). It doesn't matter if your grid includes lots of wasted space, because the converter will rearrange characters, packing everything as tightly as possible.

See SpriteFont


Example usage

MakeSpriteFont.exe "Comic Sans" myfile.spritefont /FontSize:16

Commandline options

/CharacterRegion:<region>
Specifies which Unicode codepoints to include in the font. Can be repeated to include more than one region. If not specified, the default ASCII range (32-126) is used. Examples:
/CharacterRegion:a-z
/CharacterRegion:0x1200-0x1250
/CharacterRegion:0x1234
/DefaultCharacter:<value>
Fallback character substituted in place of codepoints that are not included in the font. If zero, missing characters throw exceptions.
/FontSize:<value>
/FontStyle:<value>
Size and style (bold or italic) for TrueType fonts. Ignored when converting a bitmap font.
/LineSpacing:<value>
/CharacterSpacing:<value>
Spacing overrides. Zero is default spacing, negative closer together, positive further apart.
/TextureFormat:<value>
What format should the output texture be? Options:
Auto - The default. Chooses between CompressedMono and Rgba32 depending on whether the font data is monochromatic or multicolored.
Rgba32 - High quality and supports multicolored fonts, but wastes space.
Bgra4444 - Good choice for color fonts for Windows Store apps. This format requires the DirectX 11.1 Runtime and a WDDM 1.2 driver.
CompressedMono - The smallest format, and works on all D3D platforms, but it only supports monochromatic font data. This uses a special BC2 encoder: see comments in SpriteFontWriter.cs for details.
/NoPremultiply
By default, font textures use premultiplied alpha format. Pass this flag if you want interpolative alpha instead.
/DebugOutputSpriteSheet:<filename>
Dumps the generated texture to a bitmap file (useful when debugging the MakeSpriteFont tool, not so much if you are just trying to use it).


Further reading

http://create.msdn.com/en-US/education/catalog/utility/bitmap_font_maker


Viewing all articles
Browse latest Browse all 874

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>