Skip to content

ExtensionsFontHost Class

Extension methods to handle editing SadFont objects.

C#
public static class ExtensionsFontHost

Inheritance object

Converts the font’s backing texture into a render target, if it isn’t one.

C#
public static void Edit_EnableEditing(this IFont font)

font IFont
The font being edited.

Converts the font’s backing texture from a render target to a normal texture.

C#
public static void Edit_DisableEditing(this IFont font)

font IFont
The font being edited.

Adds the specified number of rows to the font. Creates a new backing texture object that is a render target. Is hardware accelerated.

C#
public static void Edit_AddRows(this SadFont font, int count)

font SadFont
The font being edited.

count int
The number of rows.

ArgumentOutOfRangeException
Thrown when the number is zero or less.

Edit_CopyGlyph_GPU(IFont, IFont, int, int)

Section titled “Edit_CopyGlyph_GPU(IFont, IFont, int, int)”

Copies a glyph from one font index to another. Is hardware accelerated.

C#
public static void Edit_CopyGlyph_GPU(this IFont font, IFont source, int glyphIndexFrom, int glyphIndexTo)

font IFont
The font being edited.

source IFont
The font that contains the source texture.

glyphIndexFrom int
The source glyph index.

glyphIndexTo int
The target glyph index.

Edit_CopyGlyph_GPU(IFont, IFont, int, int, Color)

Section titled “Edit_CopyGlyph_GPU(IFont, IFont, int, int, Color)”

Copies a glyph from one font index to another. Is hardware accelerated.

C#
public static void Edit_CopyGlyph_GPU(this IFont font, IFont source, int glyphIndexFrom, int glyphIndexTo, Color blendColor)

font IFont
The font being edited.

source IFont
The font that contains the source texture.

glyphIndexFrom int
The source glyph index.

glyphIndexTo int
The target glyph index.

blendColor Microsoft.Xna.Framework.Color
Color to apply while copying the glyph.

Edit_CopyGlyph_GPU(IFont, IFont, Rectangle, Rectangle)

Section titled “Edit_CopyGlyph_GPU(IFont, IFont, Rectangle, Rectangle)”

Copies a glyph from one font index to another. Is hardware accelerated.

C#
public static void Edit_CopyGlyph_GPU(this IFont font, IFont source, Rectangle glyphRectangleFrom, Rectangle glyphRectangleTo)

font IFont
The font being edited.

source IFont
The font that contains the source texture.

glyphRectangleFrom Microsoft.Xna.Framework.Rectangle
The source glyph rectangle.

glyphRectangleTo Microsoft.Xna.Framework.Rectangle
The target glyph rectangle.

Edit_CopyGlyph_GPU(IFont, IFont, Rectangle, Rectangle, Color)

Section titled “Edit_CopyGlyph_GPU(IFont, IFont, Rectangle, Rectangle, Color)”

Copies a glyph from one font index to another. Is hardware accelerated.

C#
public static void Edit_CopyGlyph_GPU(this IFont font, IFont source, Rectangle glyphRectangleFrom, Rectangle glyphRectangleTo, Color blendColor)

font IFont
The font being edited.

source IFont
The font that contains the source texture.

glyphRectangleFrom Microsoft.Xna.Framework.Rectangle
The source glyph rectangle.

glyphRectangleTo Microsoft.Xna.Framework.Rectangle
The target glyph rectangle.

blendColor Microsoft.Xna.Framework.Color
Color to apply while copying the glyph.

Edit_EraseGlyph_CPU(IFont, int, bool, ref Color[])

Section titled “Edit_EraseGlyph_CPU(IFont, int, bool, ref Color[])”

Erases a glyph in the font by index.

C#
public static void Edit_EraseGlyph_CPU(this IFont font, int glyphIndex, bool doSetPixels, ref Color[] cachedFontTexturePixels)

font IFont
The font being edited.

glyphIndex int
The glyph index to erase.

doSetPixels bool
When true, pushes the updated pixel buffer, cachedFontTexturePixels, to the font texture.

cachedFontTexturePixels SadRogue.Primitives.Color[]
A cached array of all the font’s texture pixels.

Edit_SetGlyph_CPU(IFont, int, Color[], bool, ref Color[])

Section titled “Edit_SetGlyph_CPU(IFont, int, Color[], bool, ref Color[])”

Sets the pixels of a font glyph by index.

C#
public static void Edit_SetGlyph_CPU(this IFont font, int glyphIndex, Color[] pixels, bool doSetPixels, ref Color[] cachedFontTexturePixels)

font IFont
The font being edited.

glyphIndex int
The index of the glyph to update.

pixels SadRogue.Primitives.Color[]
The pixels to set on the glyph.

doSetPixels bool
When true, pushes the updated pixel buffer, cachedFontTexturePixels, to the font texture.

cachedFontTexturePixels SadRogue.Primitives.Color[]
A cached array of all the font’s texture pixels.

ArgumentOutOfRangeException
The pixels count doesn’t match the size of a font glyph.

Edit_GetGlyph_CPU(IFont, int, ref Color[])

Section titled “Edit_GetGlyph_CPU(IFont, int, ref Color[])”

Returns a glyph’s pixels packaged into a SadRogue.Primitives.Color array.

C#
public static Color[] Edit_GetGlyph_CPU(this IFont font, int glyphIndex, ref Color[] cachedFontTexturePixels)

font IFont
The font being edited.

glyphIndex int
The index of the glyph to get.

cachedFontTexturePixels SadRogue.Primitives.Color[]
A cached array of all the font’s texture pixels.

SadRogue.Primitives.Color[]
The pixels of the glyph.

ArgumentOutOfRangeException