Extensions for XNA - Bordered Sprite Font!
C#
Latest commit 6e8932d Oct 2, 2015 @danzel Trash crappy #if UNITY code
Permalink
Failed to load latest commit information.
CommandLineBuilder
IronXna.Test
Properties
.gitignore
Alignment.cs
BorderedFont.cs
BorderedFontContent.cs
BorderedFontImporter.cs
BorderedFontProcessor.cs
BorderedFontReader.cs
BorderedFontWriter.cs
ColorExtensions.cs
IronXna.Android.csproj
IronXna.Design.Windows.MonoGame.csproj
IronXna.Design.Windows.MonoGame.sln
IronXna.Design.csproj
IronXna.MacOs.csproj
IronXna.Test.sln
IronXna.Unity.csproj
IronXna.Windows.MonoGame.csproj
IronXna.WindowsGL.MonoGame.csproj
IronXna.WindowsPhone.csproj
IronXna.csproj
IronXna.iOS.csproj
Readme.txt
SpriteBatchBorderedFontExtensions.cs
SpriteBatchExtensions.cs
SpriteBatchPrimitiveExtensions.cs
SpriteBatchSpriteFontExtensions.cs
SpriteBatchSubTexture2DExtensions.cs
SubTexture2D.cs
XmlBorderedFontDefinition.cs

Readme.txt

A SpriteFont style Bordered Font renderer for Xna.

Usage:

Add a reference to IronXna in your code project and a reference to IronXna.Design in your content projects.
In your content project, add a new SpriteFont.
Edit the Spritefont and add the following:

    <!--
    Thickness of the border to generate. In Pixels
    -->
    <BorderThickness>12</BorderThickness>
    <!--
    Whether to include a double sized font for use with retina devices. If included and a (iOS) retina device is detected we will draw at the same size but with a higher quality texture
    -->
    <IncludeRetina>false</IncludeRetina>

Optionally add:
	<!--
	SpacingMultiplier is a float value, the measured width of a space is multiplied by this.
	Use it if there isn't enough space between words.
	-->
	<SpaceMultiplier>1.3</SpaceMultiplier>


Choose the spritefont in the solution explorer and change the "Content Importer" and "Content Processor" to "Bordered Font Importer" / "Bordered Text Processor" (TODO: Rename these to be the same)

Now load it with:
_timesNewRomanBordered = Content.Load<BorderedFont>("TimesNewRomanBordered");

And draw with the extension methods from SpriteBatchBorderedFontExtensions:
_spriteBatch.DrawString(_timesNewRomanBordered, "Hi", new Vector2(100, 450), Color.Black, Color.White);


License: Do whatever you want with this code :)