Show / Hide Table of Contents

Class FontExtensions

Extensions for IFont.

Inheritance
object
FontExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole
Assembly: SadConsole.dll
Syntax
public static class FontExtensions

Methods

GetGlyphRatio(IFont, Point)

Returns the ratio in size difference between the font's glyph width and height.

Declaration
public static (float X, float Y) GetGlyphRatio(this IFont font, Point fontSize)
Parameters
Type Name Description
IFont font

Unused.

Point fontSize

The glyph size of the font used.

Returns
Type Description
(float X, float Y)

A tuple with the names (X, Y) where X is the difference of width to height and Y is the difference of height to width.

GetRenderRect(IFont, int, int, Point)

Returns a rectangle that is positioned and sized based on the font and the cell position specified.

Declaration
public static Rectangle GetRenderRect(this IFont font, int x, int y, Point fontSize)
Parameters
Type Name Description
IFont font

Unused.

int x

The x-axis of the cell position.

int y

The y-axis of the cell position.

Point fontSize

The size of the output cell.

Returns
Type Description
Rectangle

A rectangle to representing a specific cell.

GetWorldPosition(IFont, Point, Point)

Gets the pixel position of a cell position based on the font size.

Declaration
public static Point GetWorldPosition(this IFont font, Point position, Point fontSize)
Parameters
Type Name Description
IFont font

Unused.

Point position

The cell position to convert.

Point fontSize

The size of the font used to calculate the pixel position.

Returns
Type Description
Point

A new pixel-positioned point.

In this article

Back to top

Back to top Generated by DocFX