Class FontExtensions
Extensions for IFont.
Inherited Members
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
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. |