Class FontEngine
Inherited Members
Namespace: UnityEngine.TextCore.LowLevel
Assembly: UnityEngine.dll
Syntax
public sealed class FontEngine
Methods
| Improve this Doc View SourceDestroyFontEngine()
Destroy and unload resources used by the Font Engine.
Declaration
public static FontEngineError DestroyFontEngine()
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the Font Engine and used resources were successfully released. |
GetFaceInfo()
Get information about the currently loaded and sized font face.
Declaration
public static FaceInfo GetFaceInfo()
Returns
Type | Description |
---|---|
FaceInfo | Returns the FaceInfo of the currently loaded font face. |
InitializeFontEngine()
Initialize the Font Engine and library.
Declaration
public static FontEngineError InitializeFontEngine()
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the initialization of the Font Engine was successful. |
LoadFontFace(Byte[])
Load the font file from the provided byte array.
Declaration
public static FontEngineError LoadFontFace(byte[] sourceFontFile)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | sourceFontFile | A byte array containing the source font file. |
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the font face was loaded successfully. |
LoadFontFace(Byte[], Int32)
Load the font file from the provided byte array and set its size to the given point size.
Declaration
public static FontEngineError LoadFontFace(byte[] sourceFontFile, int pointSize)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | sourceFontFile | A byte array containing the source font file. |
Int32 | pointSize | The point size used to scale the font face. |
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the font face was loaded successfully. |
LoadFontFace(String)
Load the source font file at the given file path.
Declaration
public static FontEngineError LoadFontFace(string filePath)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | The file path of the source font file. |
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the font face was loaded successfully. |
LoadFontFace(String, Int32)
Load the font file at the given file path and set it size to the specified point size.
Declaration
public static FontEngineError LoadFontFace(string filePath, int pointSize)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | The file path of the source font file. |
Int32 | pointSize | The point size used to scale the font face. |
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the font face was loaded successfully. |
LoadFontFace(Font)
Load the font file from the Unity font's internal font data. Note the Unity font must be set to Dynamic with Include Font Data enabled.
Declaration
public static FontEngineError LoadFontFace(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font | The font from which to load the data. |
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the font face was loaded successfully. |
LoadFontFace(Font, Int32)
Load the font file from the Unity font's internal font data. Note the Unity font must be set to Dynamic with Include Font Data enabled.
Declaration
public static FontEngineError LoadFontFace(Font font, int pointSize)
Parameters
Type | Name | Description |
---|---|---|
Font | font | The font from which to load the data. |
Int32 | pointSize | The point size used to scale the font face. |
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the font face was loaded successfully. |
SetFaceSize(Int32)
Set the size of the currently loaded font face.
Declaration
public static FontEngineError SetFaceSize(int pointSize)
Parameters
Type | Name | Description |
---|---|---|
Int32 | pointSize | The point size used to scale the font face. |
Returns
Type | Description |
---|---|
FontEngineError | Returns a value of zero if the font face was successfully scaled to the given point size. |
TryGetGlyphIndex(UInt32, out UInt32)
Try to get the glyph index for the character at the given Unicode value.
Declaration
public static bool TryGetGlyphIndex(uint unicode, out uint glyphIndex)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | unicode | The unicode value of the character for which to lookup the glyph index. |
UInt32 | glyphIndex | The index of the glyph for the given unicode character or the .notdef glyph (index 0) if no glyph is available for the given Unicode value. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the given unicode has a glyph index. |
TryGetGlyphWithIndexValue(UInt32, GlyphLoadFlags, out Glyph)
Try loading the glyph for the given index value and if available populate the glyph.
Declaration
public static bool TryGetGlyphWithIndexValue(uint glyphIndex, GlyphLoadFlags flags, out Glyph glyph)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | glyphIndex | The index of the glyph that should be loaded. |
GlyphLoadFlags | flags | The Load Flags. |
Glyph | glyph | The glyph using the provided index or the .notdef glyph (index 0) if no glyph was found at that index. |
Returns
Type | Description |
---|---|
Boolean | Returns true if a glyph exists at the given index. Otherwise returns false. |
TryGetGlyphWithUnicodeValue(UInt32, GlyphLoadFlags, out Glyph)
Try loading a glyph for the given unicode value. If available, populates the glyph and returns true. Otherwise returns false and populates the glyph with the .notdef / missing glyph data.
Declaration
public static bool TryGetGlyphWithUnicodeValue(uint unicode, GlyphLoadFlags flags, out Glyph glyph)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | unicode | The Unicode value of the character whose glyph should be loaded. |
GlyphLoadFlags | flags | The Load Flags. |
Glyph | glyph | The glyph for the given character using the provided Unicode value or the .notdef glyph (index 0) if no glyph is available for the given Unicode value. |
Returns
Type | Description |
---|---|
Boolean | Returns true if a glyph exists for the given unicode value. Otherwise returns false. |