Class TheDrawFont
Represents a TheDraw ascii font. http://www.roysac.com/thedrawfonts-tdf.html
Inherited Members
Namespace: SadConsole.Readers
Assembly: SadConsole.dll
Syntax
public class TheDrawFont
Constructors
TheDrawFont()
Declaration
public TheDrawFont()
Properties
CharactersSupported
An array indexed by character code, indicating if a glyph character is supported by the font. Characters 33 to 126 are supported, starting at index 0.
Declaration
public bool[] CharactersSupported { get; set; }
Property Value
Type | Description |
---|---|
bool[] |
LetterSpacing
The empty characters between letters when drawing.
Declaration
public int LetterSpacing { get; set; }
Property Value
Type | Description |
---|---|
int |
Title
The title of the font.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
string |
Type
The type of font.
Declaration
public TheDrawFont.FontType Type { get; set; }
Property Value
Type | Description |
---|---|
TheDrawFont.FontType |
Methods
GetCharacter(int)
Gets a character from this font by character code.
Declaration
public TheDrawFont.Character GetCharacter(int glyph)
Parameters
Type | Name | Description |
---|---|---|
int | glyph | The character to get. |
Returns
Type | Description |
---|---|
TheDrawFont.Character | The specified character. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The character glyph index is valid but isn't included in this font. |
IndexOutOfRangeException | The character glyph index isn't in range. It must be between 33 and 126. |
GetSurface(int)
Generates a surface from the specified glyph using a white foreground and black background for the individual glyphs of the character.
Declaration
public CellSurface? GetSurface(int glyph)
Parameters
Type | Name | Description |
---|---|---|
int | glyph | The glyph index. |
Returns
Type | Description |
---|---|
CellSurface | A surface of just the glyph. Width and height of the surface is based on the TheDraw's font. |
GetSurface(int, Color, Color)
Generates a surface from the specified glyph using the specified foreground and background for the individual glyphs of the character.
Declaration
public CellSurface? GetSurface(int glyph, Color alternateForeground, Color alternateBackground)
Parameters
Type | Name | Description |
---|---|---|
int | glyph | The glyph index. |
Color | alternateForeground | Foreground color used to draw the glyph. |
Color | alternateBackground | Background color used to draw the glyph. |
Returns
Type | Description |
---|---|
CellSurface | A surface of just the glyph. Width and height of the surface is based on the TheDraw's font. |
IsCharacterSupported(int)
Declaration
public bool IsCharacterSupported(int glyph)
Parameters
Type | Name | Description |
---|---|---|
int | glyph |
Returns
Type | Description |
---|---|
bool | A boolean value indicating whether or not the specified glyph is supported. |
ReadFonts(string)
Returns a collection of fonts from a TheDraw font file.
Declaration
public static IEnumerable<TheDrawFont> ReadFonts(string file)
Parameters
Type | Name | Description |
---|---|---|
string | file | The file to read. |
Returns
Type | Description |
---|---|
IEnumerable<TheDrawFont> | A collection of TheDraw fonts. |