Class ExtensionsFontHost
Extension methods to handle editing SadFont objects.
Inherited Members
Namespace: SadConsole.FontEditing
Assembly: SadConsole.Host.MonoGame.dll
Syntax
public static class ExtensionsFontHost
Methods
Edit_AddRows(SadFont, int)
Adds the specified number of rows to the font. Creates a new backing texture object that is a render target. Is hardware accelerated.
Declaration
public static void Edit_AddRows(this SadFont font, int count)
Parameters
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the number is zero or less. |
Edit_CopyGlyph_GPU(IFont, IFont, Rectangle, Rectangle)
Copies a glyph from one font index to another. Is hardware accelerated.
Declaration
public static void Edit_CopyGlyph_GPU(this IFont font, IFont source, Rectangle glyphRectangleFrom, Rectangle glyphRectangleTo)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
IFont | source | The font that contains the source texture. |
Rectangle | glyphRectangleFrom | The source glyph rectangle. |
Rectangle | glyphRectangleTo | The target glyph rectangle. |
Edit_CopyGlyph_GPU(IFont, IFont, Rectangle, Rectangle, Color)
Copies a glyph from one font index to another. Is hardware accelerated.
Declaration
public static void Edit_CopyGlyph_GPU(this IFont font, IFont source, Rectangle glyphRectangleFrom, Rectangle glyphRectangleTo, Color blendColor)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
IFont | source | The font that contains the source texture. |
Rectangle | glyphRectangleFrom | The source glyph rectangle. |
Rectangle | glyphRectangleTo | The target glyph rectangle. |
Color | blendColor | Color to apply while copying the glyph. |
Edit_CopyGlyph_GPU(IFont, IFont, int, int)
Copies a glyph from one font index to another. Is hardware accelerated.
Declaration
public static void Edit_CopyGlyph_GPU(this IFont font, IFont source, int glyphIndexFrom, int glyphIndexTo)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
IFont | source | The font that contains the source texture. |
int | glyphIndexFrom | The source glyph index. |
int | glyphIndexTo | The target glyph index. |
Edit_CopyGlyph_GPU(IFont, IFont, int, int, Color)
Copies a glyph from one font index to another. Is hardware accelerated.
Declaration
public static void Edit_CopyGlyph_GPU(this IFont font, IFont source, int glyphIndexFrom, int glyphIndexTo, Color blendColor)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
IFont | source | The font that contains the source texture. |
int | glyphIndexFrom | The source glyph index. |
int | glyphIndexTo | The target glyph index. |
Color | blendColor | Color to apply while copying the glyph. |
Edit_DisableEditing(IFont)
Converts the font's backing texture from a render target to a normal texture.
Declaration
public static void Edit_DisableEditing(this IFont font)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
Edit_EnableEditing(IFont)
Converts the font's backing texture into a render target, if it isn't one.
Declaration
public static void Edit_EnableEditing(this IFont font)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
Edit_EraseGlyph_CPU(IFont, int, bool, ref Color[])
Erases a glyph in the font by index.
Declaration
public static void Edit_EraseGlyph_CPU(this IFont font, int glyphIndex, bool doSetPixels, ref Color[] cachedFontTexturePixels)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
int | glyphIndex | The glyph index to erase. |
bool | doSetPixels | When true, pushes the updated pixel buffer, |
Color[] | cachedFontTexturePixels | A cached array of all the font's texture pixels. |
Edit_GetGlyph_CPU(IFont, int, ref Color[])
Returns a glyph's pixels packaged into a Color array.
Declaration
public static Color[] Edit_GetGlyph_CPU(this IFont font, int glyphIndex, ref Color[] cachedFontTexturePixels)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
int | glyphIndex | The index of the glyph to get. |
Color[] | cachedFontTexturePixels | A cached array of all the font's texture pixels. |
Returns
Type | Description |
---|---|
Color[] | The pixels of the glyph. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
Edit_SetGlyph_CPU(IFont, int, Color[], bool, ref Color[])
Sets the pixels of a font glyph by index.
Declaration
public static void Edit_SetGlyph_CPU(this IFont font, int glyphIndex, Color[] pixels, bool doSetPixels, ref Color[] cachedFontTexturePixels)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The font being edited. |
int | glyphIndex | The index of the glyph to update. |
Color[] | pixels | The pixels to set on the glyph. |
bool | doSetPixels | When true, pushes the updated pixel buffer, |
Color[] | cachedFontTexturePixels | A cached array of all the font's texture pixels. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The |