Class FontClient

Definition

Namespace:
Tizen.NUI
Assembly:
Tizen.NUI.dll
API Level:
5

FontClient provides access to font information and resources.

C#
Copy
public class FontClient : BaseHandle, IDynamicResourceHandler, IElement, INameScope, IElementController, System.IDisposable
Inheritance
Implements

Properties

View Source

Instance

Gets the singleton pattern of the FontClient object.

Declaration
C#
Copy
public static FontClient Instance { get; }
Property Value
Type Description
FontClient
API Level: 5

Methods

View Source

AddCustomFontDirectory(String)

Adds custom fonts directory.

Declaration
C#
Copy
public bool AddCustomFontDirectory(string path)
Parameters
Type Name Description
String path

Path to the fonts directory.

Returns
Type Description
Boolean

True if the fonts can be added.

API Level: 5
View Source

FindDefaultFont(UInt32)

Find the default font for displaying a UTF-32 character.

Declaration
C#
Copy
public uint FindDefaultFont(uint charcode)
Parameters
Type Name Description
UInt32 charcode

The character for which a font is needed.

Returns
Type Description
UInt32

A valid font identifier. Zero if the font does not exist.

API Level: 5
View Source

FindDefaultFont(UInt32, UInt32)

Find the default font for displaying a UTF-32 character.

Declaration
C#
Copy
public uint FindDefaultFont(uint charcode, uint requestedPointSize)
Parameters
Type Name Description
UInt32 charcode

The character for which a font is needed.

UInt32 requestedPointSize

The point size in 26.6 fractional points. The default point size is 12*64.

Returns
Type Description
UInt32

A valid font identifier. Zero if the font does not exist.

API Level: 5
View Source

FindDefaultFont(UInt32, UInt32, Boolean)

Finds the default font for displaying a UTF-32 character.

Declaration
C#
Copy
public uint FindDefaultFont(uint charcode, uint requestedPointSize, bool preferColor)
Parameters
Type Name Description
UInt32 charcode

The character for which a font is needed.

UInt32 requestedPointSize

The point size in 26.6 fractional points. The default point size is 12*64.

Boolean preferColor

True if a color font is preferred.

Returns
Type Description
UInt32

A valid font identifier. Zero if the font does not exist.

API Level: 5
View Source

FontPreLoad(List<String>, List<String>, Boolean, Boolean)

This is used to pre-load FreeType font face in order to improve the runtime performance of the application.

note

The fonts in the fontPathList perform FT_New_Face during pre-loading, which can provide some performace benefits.
The fonts in the memoryFontPathList read the font file and cache the buffer in memory during pre-load.
This enables the use of FT_New_Memory_Face during runtime and provides a performance boost.
It requires memory equivalent to the size of each font file.

Declaration
C#
Copy
public static void FontPreLoad(List<string> fontPathList, List<string> memoryFontPathList, bool useThread, bool syncCreation = true)
Parameters
Type Name Description
List<String> fontPathList

A list of font paths to be pre-loaded.

List<String> memoryFontPathList

A list of memory font paths to be pre-loaded.

Boolean useThread

True if the font client should create thread and perform font pre-loading, false otherwise.

Boolean syncCreation

True if thread creation guarantees syncronization with the main thread, false async creation. Optional, the default value is true.

API Level: 5
View Source

GetFontId(String)

Retrieve the unique identifier for a font.

Declaration
C#
Copy
public uint GetFontId(string path)
Parameters
Type Name Description
String path

The path to a font file.

Returns
Type Description
UInt32

A valid font identifier. Zero if the font does not exist.

API Level: 5
View Source

GetFontId(String, UInt32)

Retrieve the unique identifier for a font.

Declaration
C#
Copy
public uint GetFontId(string path, uint requestedPointSize)
Parameters
Type Name Description
String path

The path to a font file.

UInt32 requestedPointSize

The point size in 26.6 fractional points. The default point size is 12*64.

Returns
Type Description
UInt32

A valid font identifier. Zero if the font does not exist.

API Level: 5
View Source

GetFontId(String, UInt32, UInt32)

Retrieve the unique identifier for a font.

Declaration
C#
Copy
public uint GetFontId(string path, uint requestedPointSize, uint faceIndex)
Parameters
Type Name Description
String path

The path to a font file.

UInt32 requestedPointSize

The point size in 26.6 fractional points. The default point size is 12*64.

UInt32 faceIndex

The index of the font face.

Returns
Type Description
UInt32

A valid font identifier. Zero if the font does not exist.

API Level: 5
View Source

GetPointSize(UInt32)

Retrieves the font point size of a given font id.

Declaration
C#
Copy
public uint GetPointSize(uint id)
Parameters
Type Name Description
UInt32 id

The font identifier.

Returns
Type Description
UInt32

The point size in 26.6 fractional points.

API Level: 5
View Source

GetSystemFonts()

Retrieve the list of font info supported by the system.

Declaration
C#
Copy
public List<FontInfo> GetSystemFonts()
Returns
Type Description
List<FontInfo>

The list of FontInfo

Remarks
Examples

The following example demonstrates how to use the GetSystemFonts method.

Copy
var fontList = FontClient.Instance.GetSystemFonts(); foreach(Tizen.NUI.Text.FontInfo fontInfo in fontList) { string fontFamily = fontInfo.Family; string fontPath = fontInfo.Path; FontWidthType fontWidth = fontInfo.Style.Width; FontWeightType fontWeight = fontInfo.Style.Weight; FontSlantType fontSlant = fontInfo.Style.Slant; }
View Source

IsCharacterSupportedByFont(UInt32, UInt32)

Whether the given character is supported by the font.

Declaration
C#
Copy
public bool IsCharacterSupportedByFont(uint fontId, uint character)
Parameters
Type Name Description
UInt32 fontId

The id of the font.

UInt32 character

The character in a font.

Returns
Type Description
Boolean

True if the character is supported by the font.

API Level: 5
View Source

IsScalable(String)

Check to see if a font is scalable.

Declaration
C#
Copy
public bool IsScalable(string path)
Parameters
Type Name Description
String path

The path where the font file is located.

Returns
Type Description
Boolean

True if scalable.

API Level: 5
View Source

PreCache(List<String>, List<String>, String, Boolean, Boolean)

This is used to pre-cache FontConfig in order to improve the runtime performance of the application.

Declaration
C#
Copy
public static void PreCache(List<string> fallbackFamilyList, List<string> extraFamilyList, string localeFamily, bool useThread, bool syncCreation = true)
Parameters
Type Name Description
List<String> fallbackFamilyList

A list of fallback font families to be pre-cached.

List<String> extraFamilyList

A list of additional font families to be pre-cached.

String localeFamily

A locale font family to be pre-cached.

Boolean useThread

True if the font client should create thread and perform pre-caching, false otherwise.

Boolean syncCreation

True if thread creation guarantees syncronization with the main thread, false async creation. Optional, the default value is true.

API Level: 5
View Source

ResetSystemDefaults()

Called when the user changes the system defaults.

Declaration
C#
Copy
public void ResetSystemDefaults()
API Level: 5

Implements

Extension Methods