Ultralight C API 1.3.0
Loading...
Searching...
No Matches
CAPI_FontLoader.h File Reference

Go to the source code of this file.

Data Structures

struct  ULFontLoader
 

Typedefs

typedef ULString(* ULFontLoaderGetFallbackFont) ()
 Fallback font family name.
 
typedef ULString(* ULFontLoaderGetFallbackFontForCharacters) (ULString characters, int weight, bool italic)
 Fallback font family name that can render the specified characters.
 
typedef ULFontFile(* ULFontLoaderLoad) (ULString family, int weight, bool italic)
 Get the actual font file data (TTF/OTF) for a given font description.
 

Typedef Documentation

◆ ULFontLoaderGetFallbackFont

typedef ULString(* ULFontLoaderGetFallbackFont) ()

Fallback font family name.

Will be used if all other fonts fail to load.

Note
This font should be guaranteed to exist (eg, ULFontLoader::load should not fail when when passed this font family name).
The returned ULString instance will be consumed (ulDestroyString will be called on it).

◆ ULFontLoaderGetFallbackFontForCharacters

typedef ULString(* ULFontLoaderGetFallbackFontForCharacters) (ULString characters, int weight, bool italic)

Fallback font family name that can render the specified characters.

This is mainly used to support CJK (Chinese, Japanese, Korean) text display.

Parameters
charactersOne or more UTF-16 characters. This is almost always a single character.
weightFont weight.
italicWhether or not italic is requested.
Returns
Should return a font family name that can render the text. The returned ULString instance will be consumed (ulDestroyString will be called on it).

◆ ULFontLoaderLoad

typedef ULFontFile(* ULFontLoaderLoad) (ULString family, int weight, bool italic)

Get the actual font file data (TTF/OTF) for a given font description.

Parameters
familyFont family name.
weightFont weight.
italicWhether or not italic is requested.
Returns
A font file matching the given description (either an on-disk font filepath or an in-memory file buffer). You can return NULL here and the loader will fallback to another font.