Interface IFonts
Font Operations: Load, Destroy and Count
Namespace: Yak2D
Assembly: Yak2D.Api.dll
Syntax
public interface IFonts
Properties
UserFontCount
Returns the number of user fonts currently loaded
Declaration
int UserFontCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
DestroyAllUserFonts()
Destroy all the user fonts
Declaration
void DestroyAllUserFonts()
DestroyFont(ulong)
Destroy a user font
Declaration
void DestroyFont(ulong font)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | font | The Font id to destroy |
DestroyFont(IFont)
Destroy a user font
Declaration
void DestroyFont(IFont font)
Parameters
| Type | Name | Description |
|---|---|---|
| IFont | font | The Font reference to destroy |
LoadFont(string, AssetSourceEnum, ImageFormat)
Loads user font from asset path
Declaration
IFont LoadFont(string path, AssetSourceEnum assetType, ImageFormat imageFormat = ImageFormat.PNG)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Font asset name including path (no file extension)" |
| AssetSourceEnum | assetType | Embedded in the binary or a file location" |
| ImageFormat | imageFormat | The image file encoding for the font textures" |
Returns
| Type | Description |
|---|---|
| IFont |
MeasureStringLength(string, float, ulong)
Measure pixel length (width) of a string
Declaration
float MeasureStringLength(string text, float fontSize, ulong font)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text string |
| float | fontSize | Size of font in pixels |
| ulong | font | Font id to use |
Returns
| Type | Description |
|---|---|
| float |
MeasureStringLength(string, float, IFont)
Measure pixel length (width) of a string
Declaration
float MeasureStringLength(string text, float fontSize, IFont font = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text string |
| float | fontSize | Size of font in pixels |
| IFont | font | Font reference to use, null uses a default font |
Returns
| Type | Description |
|---|---|
| float |