Skip to content

FontExtensions Class

Extensions for IFont.

C#
public static class FontExtensions

Inheritance object

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

C#
public static Rectangle GetRenderRect(this IFont font, int x, int y, Point fontSize)

font IFont
Unused.

x int
The x-axis of the cell position.

y int
The y-axis of the cell position.

fontSize SadRogue.Primitives.Point
The size of the output cell.

SadRogue.Primitives.Rectangle
A rectangle to representing a specific cell.

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

C#
public static Point GetWorldPosition(this IFont font, Point position, Point fontSize)

font IFont
Unused.

position SadRogue.Primitives.Point
The cell position to convert.

fontSize SadRogue.Primitives.Point
The size of the font used to calculate the pixel position.

SadRogue.Primitives.Point
A new pixel-positioned point.

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

C#
public static (float X, float Y) GetGlyphRatio(this IFont font, Point fontSize)

font IFont
Unused.

fontSize SadRogue.Primitives.Point
The glyph size of the font used.

(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.