Show / Hide Table of Contents

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
System.Int32

Methods

DestroyAllUserFonts()

Destroy all the user fonts

Declaration
void DestroyAllUserFonts()

DestroyFont(UInt64)

Destroy a user font

Declaration
void DestroyFont(ulong font)
Parameters
Type Name Description
System.UInt64 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
System.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, Single, UInt64)

Measure pixel length (width) of a string

Declaration
float MeasureStringLength(string text, float fontSize, ulong font)
Parameters
Type Name Description
System.String text

Text string

System.Single fontSize

Size of font in pixels

System.UInt64 font

Font id to use

Returns
Type Description
System.Single

MeasureStringLength(String, Single, IFont)

Measure pixel length (width) of a string

Declaration
float MeasureStringLength(string text, float fontSize, IFont font = null)
Parameters
Type Name Description
System.String text

Text string

System.Single fontSize

Size of font in pixels

IFont font

Font reference to use, null uses a default font

Returns
Type Description
System.Single
In This Article
Back to top yak2D - Alex Paterson