TextConverter ClassDelta Engine Documentation
Takes a string of text and returns an array of graphical glyph data for rendering. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Rendering2D.Fonts TextConverter

Namespace: DeltaEngine.Rendering2D.Fonts
Assembly: DeltaEngine.Rendering2D.Fonts (in DeltaEngine.Rendering2D.Fonts.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class TextConverter

The TextConverter type exposes the following members.

Constructors

  NameDescription
Public methodTextConverter
Initializes a new instance of the TextConverter class
Top
Methods

  NameDescription
Public methodGetRenderableGlyphs
Top
Properties

  NameDescription
Public propertyMaxTextPixelSize
Top
Remarks

Tests: DeltaEngine.Rendering2D.Fonts.Tests.TextConverterTests
Examples

2 unit tests call DeltaEngine.Rendering2D.Fonts.TextConverter
[Test, CloseAfterFirstFrame]
public void GetGlyphs()
{
    var fontData = new FontDescription(ContentLoader.Load<Font>("Verdana12").Data);
    var textConverter = new TextConverter(fontData.GlyphDictionary, fontData.PixelLineHeight);
    var glyphs = textConverter.GetRenderableGlyphs("    ", HorizontalAlignment.Center);
    Assert.AreEqual(4, glyphs.Length);
}
[Test, CloseAfterFirstFrame]
public void GetGlyphsRightAligned()
{
    var fontData = new FontDescription(ContentLoader.Load<Font>("Verdana12").Data);
    var textConverter = new TextConverter(fontData.GlyphDictionary, fontData.PixelLineHeight);
    var glyphs = textConverter.GetRenderableGlyphs("A a a aaa", HorizontalAlignment.Right);
    Assert.AreEqual(9, glyphs.Length);
}
See Also