Skip to main content
Version: 1.0.0-preview.37

Velaptor.Graphics.Renderers.IFontRenderer

Velaptor

Velaptor.Graphics.Renderers

IFontRenderer Interface

Renders text to the screen using a particular font.

public interface IFontRenderer

Methods

Render(IFont, string, int, int, float, float, int)

Renders the given text using the given font
at the position determined by the given x and y coordinates.

void Render(Velaptor.Content.Fonts.IFont font, string text, int x, int y, float renderSize, float angle, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

x System.Int32

The X coordinate location to render the text.

y System.Int32

The Y coordinate location to render the text.

renderSize System.Single

The size of the text.

angle System.Single

The angle of the text in degrees.

layer System.Int32

The layer to render the text.

Exceptions

System.Exception
Thrown if the Begin() method has not been called.

Remarks

The x and y position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

The renderSize is a value between 0 and 1. Using the value 1 represents the text being rendered
at the standard size of 100%. Example: Using 1.5 would represent 150% or 50% larger than the normal size.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, string, int, int, float, float, Color, int)

Renders the given text using the given font
at the position determined by the given x and y coordinates,
with the given angle, renderSize, and color.

void Render(Velaptor.Content.Fonts.IFont font, string text, int x, int y, float renderSize, float angle, System.Drawing.Color color, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

x System.Int32

The X coordinate location to render the text.

y System.Int32

The Y coordinate location to render the text.

renderSize System.Single

The size of the text.

angle System.Single

The angle of the text in degrees.

color System.Drawing.Color

The color to apply to the rendering.

layer System.Int32

The layer to render the text.

Exceptions

System.Exception
Thrown if the Begin() method has not been called.

Remarks

The x and y position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

The renderSize is a value between 0 and 1. Using the value 1 represents the text being rendered
at the standard size of 100%. Example: Using 1.5 would represent 150% or 50% larger than the normal size.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, string, int, int, float, Color, int)

Renders the given text using the given font
at the position determined by the given x and y coordinates,
with the given angle, and color.

void Render(Velaptor.Content.Fonts.IFont font, string text, int x, int y, float angle, System.Drawing.Color color, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

x System.Int32

The X coordinate location to render the text.

y System.Int32

The Y coordinate location to render the text.

angle System.Single

The angle of the text in degrees.

color System.Drawing.Color

The color to apply to the rendering.

layer System.Int32

The layer to render the text.

Remarks

The x and y position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, string, int, int, int)

Renders the given text using the given font
at the position determined by the given x and y coordinates.

void Render(Velaptor.Content.Fonts.IFont font, string text, int x, int y, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

x System.Int32

The X coordinate location to render the text.

y System.Int32

The Y coordinate location to render the text.

layer System.Int32

The layer to render the text.

Exceptions

System.Exception
Thrown if the Begin() method has not been called.

Remarks

The x and y position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, string, int, int, Color, int)

Renders the given text using the given font
at the position determined by the given x and y coordinates
and color.

void Render(Velaptor.Content.Fonts.IFont font, string text, int x, int y, System.Drawing.Color color, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

x System.Int32

The X coordinate location to render the text.

y System.Int32

The Y coordinate location to render the text.

color System.Drawing.Color

The color of the text.

layer System.Int32

The layer to render the text.

Exceptions

System.Exception
Thrown if the Begin() method has not been called.

Remarks

The x and y position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

The size is a value between 0 and 1. Using the value 1 represents the text being rendered
at the standard size of 100%. Example: Using 1.5 would represent 150% or 50% larger than the normal size.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, string, Vector2, float, float, int)

Renders the given text using the given font
at the given position, with the given renderSize, and angle.

void Render(Velaptor.Content.Fonts.IFont font, string text, System.Numerics.Vector2 position, float renderSize, float angle, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

position System.Numerics.Vector2

The position to render the text.

renderSize System.Single

The size of the text.

angle System.Single

The angle of the text in degrees.

layer System.Int32

The layer to render the text.

Exceptions

System.Exception
Thrown if the Begin() method has not been called.

Remarks

The position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

The renderSize is a value between 0 and 1. Using the value 1 represents the text being rendered
at the standard size of 100%. Example: Using 1.5 would represent 150% or 50% larger than the normal size.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, string, Vector2, float, Color, int)

Renders the given text using the given font
at the given position, angle, and color.

void Render(Velaptor.Content.Fonts.IFont font, string text, System.Numerics.Vector2 position, float angle, System.Drawing.Color color, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

position System.Numerics.Vector2

The position to render the text.

angle System.Single

The angle of the text in degrees.

color System.Drawing.Color

The color of the text.

layer System.Int32

The layer to render the text.

Exceptions

System.Exception
Thrown if the Begin() method has not been called.

Remarks

The position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, string, Vector2, int)

Renders the given text using the given font
and position.

void Render(Velaptor.Content.Fonts.IFont font, string text, System.Numerics.Vector2 position, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

position System.Numerics.Vector2

The position to render the text.

layer System.Int32

The layer to render the text.

Exceptions

System.Exception
Thrown if the Begin() method has not been called.

Remarks

The position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, string, Vector2, Color, int)

Renders the given text using the given font
at the given position with the given color.

void Render(Velaptor.Content.Fonts.IFont font, string text, System.Numerics.Vector2 position, System.Drawing.Color color, int layer=0);

Parameters

font IFont

The font to use for rendering the text.

text System.String

The text to render.

position System.Numerics.Vector2

The position to render the text.

color System.Drawing.Color

The color of the text.

layer System.Int32

The layer to render the text.

Exceptions

System.Exception
Thrown if the Begin() method has not been called.

Remarks

The position is based in the center of the text.
The center of the text is based on the furthest most left, right, top, and bottom edges of the text.

Lower layer values will render before higher layer values.
If two separate textures have the same layer value, they will
render in the order that the method was invoked.

Example below:Render Method Invoked Order:

  1. Texture 1 (Layer -10)
  2. Texture 2 (Layer -20)
  3. Texture 3 (Layer 0)
  4. Texture 4 (Layer 0)
  5. Texture 5 (Layer 4)
  6. Texture 6 (Layer 3)Texture Render Order:
  • Texture 2
  • Texture 1
  • Texture 3
  • Texture 4
  • Texture 6
  • Texture 5

Render(IFont, Span<(GlyphMetrics metrics,Color clr)>, int, int, float, float, int)

void Render(Velaptor.Content.Fonts.IFont font, System.Span<(Velaptor.Graphics.GlyphMetrics metrics,System.Drawing.Color clr)> charMetrics, int x, int y, float renderSize, float angle, int layer=0);

Parameters

font IFont

charMetrics System.Span<<GlyphMetrics,System.Drawing.Color>>

x System.Int32

y System.Int32

renderSize System.Single

angle System.Single

layer System.Int32