Cosmos/source2/Users/Orvid/Orvid.Graphics/FontSupport/bdf/BDFFont.cs
blah38621_cp 92dcac4a51 Made a few improvements to the speed of the ILScanner, including caching the resolved plugs.
Added the possibility for an optimization step in the IL2CPU MSBuild task. Currently commented out, but should work fine with a few modifications to the optimizer.
Moved classes that are dependent on Cosmos from the Orvid.Graphics, into the Orvid.Graphics.Cosmos assembly. 
Re-factored the font mechanism, added partially working .fnt Font support. 
Added a Rectangle class, and a Vec2d class, which is the same as Vec2, except with doubles for the X and Y values.
Made a small aesthetic improvement to the output of the File2ByteArray Converter.
2011-09-03 21:05:46 +00:00

71 lines
1.8 KiB
C#

using System;
namespace Orvid.Graphics.FontSupport.bdf
{
internal class BDFFont : Font
{
private BDFFontContainer bdfContainer;
private BDFFontMetrics metrics;
/// <summary>
/// The internal constructor for initializing this
/// instance as a loader.
/// </summary>
internal BDFFont() : base(true) { }
internal BDFFont(BDFFontContainer container)
: base(container.getFamily(), container.getStyle(), container.getSize())
{
bdfContainer = container;
metrics = new BDFFontMetrics(this);
}
internal BDFFontContainer getContainer()
{
return bdfContainer;
}
public override System.Collections.Generic.List<Font> DefaultFonts
{
get
{
return new System.Collections.Generic.List<Font>();
}
}
public override string ProviderName
{
get
{
return "Default BDF Font Provider";
}
}
public override FontMetrics GetFontMetrics()
{
return metrics;
}
public override ITextRenderer GetTextRenderer()
{
ITextRenderer renderer = new BDFTextRenderer(this.getContainer());
return renderer;
}
public override bool IsSupportedType(Font f)
{
return (f is BDFFont);
}
public override void Render(Image i, BoundingBox clip, AffineTransform trans, string text, Vec2 loc, Pixel color)
{
GetTextRenderer().Render(i,clip,trans,text,loc,color);
}
public override Font LoadFont(System.IO.Stream s)
{
BDFFontContainer container = BDFFontContainer.CreateFont(s);
return new BDFFont(container);
}
}
}