2012-10-22 17:18:04 +00:00
#region Using Statements
using System ;
using System.Collections.Generic ;
using System.Diagnostics ;
2012-10-28 18:33:54 +00:00
using System.Drawing ;
using System.Globalization ;
2012-10-19 21:59:35 +00:00
using System.IO ;
2012-10-28 18:33:54 +00:00
using System.Runtime.InteropServices ;
using System.Xml ;
2012-10-22 17:18:04 +00:00
using System.Xml.Linq ;
2012-10-19 21:59:35 +00:00
using ANX.Framework.Content.Pipeline.Graphics ;
using ANX.Framework.NonXNA.Development ;
2015-04-08 14:50:03 +02:00
using ANX.Framework.Content.Pipeline.Serialization.Intermediate ;
2012-10-22 17:18:04 +00:00
#endregion
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
2012-10-19 21:59:35 +00:00
namespace ANX.Framework.Content.Pipeline.Importer
{
/// <summary>Provides methods for reading .spritefont files for use in the Content Pipeline.</summary>
2012-10-28 18:33:54 +00:00
[PercentageComplete(90)]
2015-04-08 14:50:03 +02:00
[Developer("SilentWarrior/Eagle Eye Studios, KorsarNek")]
2012-10-28 18:33:54 +00:00
[TestState(TestStateAttribute.TestState.InProgress)] //Works but there should be a check whether the characters are supported
2015-04-26 19:47:26 +02:00
[ContentImporter("Spritefont", ".spritefont", DefaultProcessor = "FontDescriptionProcessor", DisplayName = "FontDescription Importer - ANX Framework", Category = "Font Files")]
2012-10-19 21:59:35 +00:00
public class FontDescriptionImporter : ContentImporter < FontDescription >
{
2015-04-08 14:50:03 +02:00
/// <summary>
/// Called by the Framework when importing a .spritefont file to be used as a game asset. This is the method called by the Framework when an asset is to be imported into an object that can be recognized by the Content Pipeline.
/// </summary>
2012-10-19 21:59:35 +00:00
/// <param name="filename">Name of a game asset file.</param>
/// <param name="context">Contains information for importing a game asset, such as a logger interface.</param>
public override FontDescription Import ( string filename , ContentImporterContext context )
{
2015-04-08 14:50:03 +02:00
using ( XmlReader reader = XmlReader . Create ( filename ) )
2012-11-14 08:37:38 +00:00
{
2015-04-08 14:50:03 +02:00
FontDescription fontDescription = IntermediateSerializer . Deserialize < FontDescription > ( reader , filename ) ;
fontDescription . Identity = new ContentIdentity ( new FileInfo ( filename ) . FullName , "FontDescriptionImporter" ) ;
2012-10-22 17:18:04 +00:00
2012-11-14 08:37:38 +00:00
return fontDescription ;
}
2012-10-19 21:59:35 +00:00
}
}
}