Class FontClient
Definition
- Namespace:
- Tizen.NUI
- Assembly:
- Tizen.NUI.dll
- API Level:
- 5
FontClient provides access to font information and resources.
C#Copypublic class FontClient : BaseHandle, IDynamicResourceHandler, IElement, INameScope, IElementController, System.IDisposable
- Inheritance
- Implements
Properties
Declaration
C#Copypublic static FontClient Instance { get; }
Property Value
Type | Description |
---|---|
FontClient |
API Level: 5
Methods
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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
FindDefaultFont(UInt32, UInt32)
Find the default font for displaying a UTF-32 character.
Declaration
C#Copypublic 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
FindDefaultFont(UInt32, UInt32, Boolean)
Finds the default font for displaying a UTF-32 character.
Declaration
C#Copypublic 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
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#Copypublic 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
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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
Declaration
C#Copypublic List<FontInfo> GetSystemFonts()
Returns
Type | Description |
---|---|
List<FontInfo> | The list of FontInfo |
Remarks
Examples
The following example demonstrates how to use the GetSystemFonts method.
Copyvar 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; }
IsCharacterSupportedByFont(UInt32, UInt32)
Whether the given character is supported by the font.
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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
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#Copypublic 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
Declaration
C#Copypublic void ResetSystemDefaults()