Process Method
Collapse the table of content
Expand the table of content

FontTextureProcessor.Process Method

This method is available only when developing for Windows.
Creates SpriteFontContent from a bitmap.

Namespace: Microsoft.Xna.Framework.Content.Pipeline.Processors
Assembly: Microsoft.Xna.Framework.Content.Pipeline (in microsoft.xna.framework.content.pipeline.dll)

public override SpriteFontContent Process (
         Texture2DContent input,
         ContentProcessorContext context


Type: Texture2DContent
The bitmap data to convert to a font.
Type: ContentProcessorContext
Context for the specified processor.

Return Value

The font data.

Exception typeCondition
ArgumentNullException input is null.
InvalidOperationExceptionA character cannot be mapped to a glyph index: it is already mapped to a glyph index.

Each character should be arranged on the bitmap in a grid ordered from upper left to lower right. Monochrome characters 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 the character are solid. Fill the spaces between each character and around the edges of the grid with a specific magenta color having the value Red:255 Green:0 Blue:255 Alpha:255. The processor packs the characters together as tightly as possible, eliminating any wasted space in the original grid.

Windows 7, Windows Vista, Windows XP

Community Additions

© 2016 Microsoft