Sprite Font XML Schema Reference

The following table lists the valid tags and values for Sprite-Font (.spritefont) XML files used by the Content Pipeline to create SpriteFont textures:

Tag NameContent TypeContent Description
<FontName>stringThe name of the font to be imported. This is not the name of a font file, but rather the friendly name that identifies the font once it is installed on your computer. You can use the Fonts folder in Control Panel to see the names of fonts installed on your system, and to install new ones as well. The Content Pipeline supports the same fonts as the System.Drawing.Font class, including TrueType fonts but not bitmap (.fon) fonts.
<Size> floatThe point size of the font to be imported.
<Spacing> floatThe number of pixels to add between each character when the string is rendered.
<UseKerning> BooleanSpecifies whether to use kerning information when rendering the font. Default value is true.
<Style> "Regular", "Bold", "Italic," or "Bold, Italic"The style of the font to be imported.
<CharacterRegions> Zero or more <CharacterRegion> tagsZero or more numerical ranges indicating which subset of Unicode characters to import. If no <CharacterRegion> is specified, the whole font is imported.
<CharacterRegion> One <Start> and one <End> tagThe beginning and end of a region of Unicode characters.
<Start> charThe first Unicode character to include in a <CharacterRegion>.
<End> charThe last Unicode character to include in a <CharacterRegion>.

Here is a sample .spritefont file:

<?xml version="1.0" encoding="utf-8"?>

<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
  <Asset Type="Graphics:FontDescription">
    <FontName>Courier New</FontName>

Community Additions