Table of Contents

Class GenericBitmapFont

Namespace
MLEM.Extended.Font
Assembly
MLEM.Extended.dll

Represents a font with additional abilities. GenericSpriteFont

public class GenericBitmapFont : GenericFont, IGenericDataHolder
Inheritance
GenericBitmapFont
Implements
Inherited Members

Constructors

GenericBitmapFont(BitmapFont, BitmapFont, BitmapFont)

Creates a new generic font using MonoGame.Extended.BitmapFonts.BitmapFont. Optionally, a bold and italic version of the font can be supplied.

public GenericBitmapFont(BitmapFont font, BitmapFont bold = null, BitmapFont italic = null)

Parameters

font BitmapFont

The font to wrap

bold BitmapFont

A bold version of the font

italic BitmapFont

An italic version of the font

Fields

Font

The MonoGame.Extended.BitmapFonts.BitmapFont that is being wrapped by this generic font

public readonly BitmapFont Font

Field Value

BitmapFont

Properties

Bold

The bold version of this font.

public override GenericFont Bold { get; }

Property Value

GenericFont

Italic

The italic version of this font.

public override GenericFont Italic { get; }

Property Value

GenericFont

LineHeight

The height of each line of text of this font. This is the value that the text's draw position is offset by every time a newline character is reached.

public override float LineHeight { get; }

Property Value

float

Methods

DrawCharacter(SpriteBatch, int, string, Vector2, Color, float, Vector2, SpriteEffects, float)

Draws the given code point with the given data for use in DrawString(SpriteBatch, StringBuilder, Vector2, Color, float, Vector2, Vector2, SpriteEffects, float). Note that this method should only be called internally for rendering of more complex strings, like in TextFormatter Code implementations.

public override void DrawCharacter(SpriteBatch batch, int codePoint, string character, Vector2 position, Color color, float rotation, Vector2 scale, SpriteEffects effects, float layerDepth)

Parameters

batch SpriteBatch

The sprite batch to draw with.

codePoint int

The code point which will be drawn.

character string

A string representation of the character which will be drawn.

position Vector2

The drawing location on screen.

color Color

A color mask.

rotation float

A rotation of this character.

scale Vector2

A scaling of this character.

effects SpriteEffects

Modificators for drawing. Can be combined.

layerDepth float

A depth of the layer of this character.

MeasureCharacter(int)

Measures the width of the given code point with the default scale for use in MeasureString(string, bool). Note that this method does not support Nbsp, Zwsp and Emsp for most generic fonts, which is why MeasureString(string, bool) should be used even for single characters.

protected override float MeasureCharacter(int codePoint)

Parameters

codePoint int

The code point whose width to calculate

Returns

float

The width of the given character with the default scale