IFont Interface
Definition
Section titled “Definition”Represents a font used by the rendering engine.
public interface IFont : IDisposableProperties
Section titled “Properties”The name of the font used when it is registered with the Fonts collection.
string Name { get; }GlyphHeight
Section titled “GlyphHeight”The height of each glyph in pixels.
int GlyphHeight { get; }GlyphWidth
Section titled “GlyphWidth”The width of each glyph in pixels.
int GlyphWidth { get; }GlyphPadding
Section titled “GlyphPadding”The amount of pixels between glyphs.
int GlyphPadding { get; set; }TotalGlyphs
Section titled “TotalGlyphs”Gets how many glyphs this font has.
int TotalGlyphs { get; }SolidGlyphIndex
Section titled “SolidGlyphIndex”Which glyph index is considered completely solid white. Used for shading.
int SolidGlyphIndex { get; set; }SolidGlyphRectangle
Section titled “SolidGlyphRectangle”The rectangle to draw the solid glyph used for shading.
Rectangle SolidGlyphRectangle { get; }UnsupportedGlyphIndex
Section titled “UnsupportedGlyphIndex”The glyph index to use when an unsupported glyph is used during rendering.
int UnsupportedGlyphIndex { get; set; }UnsupportedGlyphRectangle
Section titled “UnsupportedGlyphRectangle”The rectangle to draw when a glyph that isn’t supported is used by a surface.
Rectangle UnsupportedGlyphRectangle { get; }IsSadExtended
Section titled “IsSadExtended”True when the font supports SadConsole extended decorators; otherwise false.
bool IsSadExtended { get; set; }The texture used by the font.
ITexture Image { get; set; }GlyphRectangles
Section titled “GlyphRectangles”A dictionary that stores the source rectangles of the font by glyph id.
Dictionary<int, Rectangle> GlyphRectangles { get; }GlyphDefinitions
Section titled “GlyphDefinitions”A collection of named glyph definitions.
Dictionary<string, GlyphDefinition> GlyphDefinitions { get; }Methods
Section titled “Methods”GetGlyphSourceRectangle(int)
Section titled “GetGlyphSourceRectangle(int)”Gets the registered rendering rectangle for a glyph.
Rectangle GetGlyphSourceRectangle(int glyph)Parameters
Section titled “Parameters”glyph int
The index of the glyph to get.
Returns
Section titled “Returns”SadRogue.Primitives.Rectangle
The rectangle for the glyph.
GenerateGlyphSourceRectangle(int)
Section titled “GenerateGlyphSourceRectangle(int)”Generates a rectangle for the specified glyph. For the actual font rectangle, use GetGlyphSourceRectangle(int).
Rectangle GenerateGlyphSourceRectangle(int glyph)Parameters
Section titled “Parameters”glyph int
The glyph.
Returns
Section titled “Returns”SadRogue.Primitives.Rectangle
A rectangle based on where the font thinks the rectangle should be.
GetFontSize(Sizes)
Section titled “GetFontSize(Sizes)”Gets the pixel size of a font based on a IFont.Sizes.
Point GetFontSize(IFont.Sizes size)Parameters
Section titled “Parameters”size IFont.Sizes
The desired size.
Returns
Section titled “Returns”SadRogue.Primitives.Point
The width and height of a font cell.
GetDecorator(string, Color)
Section titled “GetDecorator(string, Color)”Gets a CellDecorator by the GlyphDefinition defined by the font file.
CellDecorator GetDecorator(string name, Color color)Parameters
Section titled “Parameters”name string
The name of the decorator to get.
color SadRogue.Primitives.Color
The color to apply to the decorator.
Returns
Section titled “Returns”CellDecorator
The decorator instance.
Remarks
Section titled “Remarks”If the decorator does not exist, Empty is returned.
HasGlyphDefinition(string)
Section titled “HasGlyphDefinition(string)”Returns true when the glyph has been defined by name.
bool HasGlyphDefinition(string name)Parameters
Section titled “Parameters”name string
The name of the glyph
Returns
Section titled “Returns”bool
true when the glyph name exists, otherwise false.
GetGlyphDefinition(string)
Section titled “GetGlyphDefinition(string)”Gets a GlyphDefinition by name that is defined by the font file.
GlyphDefinition GetGlyphDefinition(string name)Parameters
Section titled “Parameters”name string
The name of the glyph definition.
Returns
Section titled “Returns”GlyphDefinition
The glyph definition.
Remarks
Section titled “Remarks”If the glyph definition doesn’t exist, return sEmpty.