Show / Hide Table of Contents

Interface IFont

Represents a font used by the rendering engine.

Inherited Members
IDisposable.Dispose()
Namespace: SadConsole
Assembly: SadConsole.dll
Syntax
public interface IFont : IDisposable

Properties

GlyphDefinitions

A collection of named glyph definitions.

Declaration
Dictionary<string, GlyphDefinition> GlyphDefinitions { get; }
Property Value
Type Description
Dictionary<string, GlyphDefinition>

GlyphHeight

The height of each glyph in pixels.

Declaration
int GlyphHeight { get; }
Property Value
Type Description
int

GlyphPadding

The amount of pixels between glyphs.

Declaration
int GlyphPadding { get; set; }
Property Value
Type Description
int

GlyphRectangles

A dictionary that stores the source rectangles of the font by glyph id.

Declaration
Dictionary<int, Rectangle> GlyphRectangles { get; }
Property Value
Type Description
Dictionary<int, Rectangle>

GlyphWidth

The width of each glyph in pixels.

Declaration
int GlyphWidth { get; }
Property Value
Type Description
int

Image

The texture used by the font.

Declaration
ITexture Image { get; set; }
Property Value
Type Description
ITexture

IsSadExtended

True when the font supports SadConsole extended decorators; otherwise false.

Declaration
bool IsSadExtended { get; set; }
Property Value
Type Description
bool

Name

The name of the font used when it is registered with the Fonts collection.

Declaration
string Name { get; }
Property Value
Type Description
string

SolidGlyphIndex

Which glyph index is considered completely solid white. Used for shading.

Declaration
int SolidGlyphIndex { get; set; }
Property Value
Type Description
int

SolidGlyphRectangle

The rectangle to draw the solid glyph used for shading.

Declaration
Rectangle SolidGlyphRectangle { get; }
Property Value
Type Description
Rectangle

TotalGlyphs

Gets how many glyphs this font has.

Declaration
int TotalGlyphs { get; }
Property Value
Type Description
int

UnsupportedGlyphIndex

The glyph index to use when an unsupported glyph is used during rendering.

Declaration
int UnsupportedGlyphIndex { get; set; }
Property Value
Type Description
int

UnsupportedGlyphRectangle

The rectangle to draw when a glyph that isn't supported is used by a surface.

Declaration
Rectangle UnsupportedGlyphRectangle { get; }
Property Value
Type Description
Rectangle

Methods

GenerateGlyphSourceRectangle(int)

Generates a rectangle for the specified glyph. For the actual font rectangle, use GetGlyphSourceRectangle(int).

Declaration
Rectangle GenerateGlyphSourceRectangle(int glyph)
Parameters
Type Name Description
int glyph

The glyph.

Returns
Type Description
Rectangle

A rectangle based on where the font thinks the rectangle should be.

GetDecorator(string, Color)

Gets a CellDecorator by the GlyphDefinition defined by the font file.

Declaration
CellDecorator GetDecorator(string name, Color color)
Parameters
Type Name Description
string name

The name of the decorator to get.

Color color

The color to apply to the decorator.

Returns
Type Description
CellDecorator

The decorator instance.

Remarks

If the decorator does not exist, Empty is returned.

GetFontSize(Sizes)

Gets the pixel size of a font based on a IFont.Sizes.

Declaration
Point GetFontSize(IFont.Sizes size)
Parameters
Type Name Description
IFont.Sizes size

The desired size.

Returns
Type Description
Point

The width and height of a font cell.

GetGlyphDefinition(string)

Gets a GlyphDefinition by name that is defined by the font file.

Declaration
GlyphDefinition GetGlyphDefinition(string name)
Parameters
Type Name Description
string name

The name of the glyph definition.

Returns
Type Description
GlyphDefinition

The glyph definition.

Remarks

If the glyph definition doesn't exist, return sEmpty.

GetGlyphSourceRectangle(int)

Gets the registered rendering rectangle for a glyph.

Declaration
Rectangle GetGlyphSourceRectangle(int glyph)
Parameters
Type Name Description
int glyph

The index of the glyph to get.

Returns
Type Description
Rectangle

The rectangle for the glyph.

HasGlyphDefinition(string)

Returns true when the glyph has been defined by name.

Declaration
bool HasGlyphDefinition(string name)
Parameters
Type Name Description
string name

The name of the glyph

Returns
Type Description
bool

true when the glyph name exists, otherwise false.

Extension Methods

FontExtensions.GetGlyphRatio(IFont, Point)
FontExtensions.GetRenderRect(IFont, int, int, Point)
FontExtensions.GetWorldPosition(IFont, Point, Point)
ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX