Class AsciiFont
Defines the traits implemented by ASCII font providers.
Implements
Inherited Members
Namespace: Sharpie.Font
Assembly: sharpie.dll
Syntax
[PublicAPI]
public abstract class AsciiFont : IAsciiFont
Constructors
AsciiFont(string, int, int, AsciiFontLayout)
Creates a new instance of this class.
Declaration
protected AsciiFont(string name, int height, int baseline, AsciiFontLayout layout)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the font. |
| int | height | The height of the font. |
| int | baseline | The font's baseline. |
| AsciiFontLayout | layout | The font's layout. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if |
| ArgumentOutOfRangeException | Thrown if |
Properties
Baseline
The font baseline.
Declaration
public int Baseline { get; }
Property Value
| Type | Description |
|---|---|
| int |
Height
The font height.
Declaration
public int Height { get; }
Property Value
| Type | Description |
|---|---|
| int |
Layout
The font's name.
Declaration
public AsciiFontLayout Layout { get; }
Property Value
| Type | Description |
|---|---|
| AsciiFontLayout |
Name
The font's name.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetGlyph(Rune, Style)
Tries to get a glyph for a given char.
Declaration
public virtual IDrawable GetGlyph(Rune @char, Style style)
Parameters
| Type | Name | Description |
|---|---|---|
| Rune | char | The character. |
| Style | style | The style to apply to the glyph. |
Returns
| Type | Description |
|---|---|
| IDrawable | The output glyph, if found. Otherwise, the font will substitute the glyph with something else. |
GetGlyphs(ReadOnlySpan<Rune>, Style)
Tries to get a drawing for a given list of chars.
Declaration
public abstract IDrawable GetGlyphs(ReadOnlySpan<Rune> chars, Style style)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Rune> | chars | The characters. |
| Style | style | The style to apply to the glyphs. |
Returns
| Type | Description |
|---|---|
| IDrawable | The output glyphs. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if |
GetGlyphs(string, Style)
Tries to get a drawing for a given text.
Declaration
public virtual IDrawable GetGlyphs(string text, Style style)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text. |
| Style | style | The style to apply to the glyphs. |
Returns
| Type | Description |
|---|---|
| IDrawable | The output glyphs. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if |
HasGlyph(Rune)
Checks if the font contains a given glyph.
Declaration
public abstract bool HasGlyph(Rune @char)
Parameters
| Type | Name | Description |
|---|---|---|
| Rune | char | The character. |
Returns
| Type | Description |
|---|---|
| bool |
|