TextRenderer
Declaration
public class Strawberry.Graphics.Text.TextRenderer
Methods
Draw static
Draws a string on the specified sprite layer using the default font size.
void Draw(SpriteLayer layer, Font font, string text, Vector2 position, Color color, TextAlign align, TextDirection direction, bool forcePersianDigits)
Parameters:
| Name | Type | Description |
|---|---|---|
layer |
Strawberry.Graphics.Layers.SpriteLayer |
The sprite layer to draw on |
font |
Strawberry.Graphics.Text.Font |
The font to use |
text |
System.String |
The text to draw |
position |
Strawberry.Math.Vector2 |
The position to draw the text at |
color |
Strawberry.Graphics.Color |
The color of the text |
align |
Strawberry.Graphics.Text.TextAlign |
The alignment of the text |
direction |
Strawberry.Graphics.Text.TextDirection |
The direction of the text |
forcePersianDigits |
System.Boolean |
Whether to force Persian digits |
Draw static
Draws a string on the specified sprite layer using the specified font size.
void Draw(SpriteLayer layer, Font font, string text, Vector2 position, Color color, TextAlign align, TextDirection direction, bool forcePersianDigits, float size)
Parameters:
| Name | Type | Description |
|---|---|---|
layer |
Strawberry.Graphics.Layers.SpriteLayer |
The sprite layer to draw on |
font |
Strawberry.Graphics.Text.Font |
The font to use |
text |
System.String |
The text to draw |
position |
Strawberry.Math.Vector2 |
The position to draw the text at |
color |
Strawberry.Graphics.Color |
The color of the text |
align |
Strawberry.Graphics.Text.TextAlign |
The alignment of the text |
direction |
Strawberry.Graphics.Text.TextDirection |
The direction of the text |
forcePersianDigits |
System.Boolean |
Whether to force Persian digits |
size |
System.Single |
The size used to draw the text |
GetStringWidth static
Calculates the width of the string using the provided font and size.
float GetStringWidth(string text, Font font, bool forcePersianDigits, float size)
Parameters:
| Name | Type | Description |
|---|---|---|
text |
System.String |
The text to calculate the width of. |
font |
Strawberry.Graphics.Text.Font |
The font to use for the calculation. |
forcePersianDigits |
System.Boolean |
Whether to force Persian digits or not. |
size |
System.Single |
The size of the font used to calculate the width. |
Returns: The width of the string in pixels.