Ultralight C API 1.3.0
Loading...
Searching...
No Matches
CAPI_FontLoader.h
Go to the documentation of this file.
1/******************************************************************************
2 * This file is a part of Ultralight, an ultra-portable web-browser engine. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2023 Ultralight, Inc. *
7 *****************************************************************************/
8#ifndef ULTRALIGHT_CAPI_FONTLOADER_H
9#define ULTRALIGHT_CAPI_FONTLOADER_H
10
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/******************************************************************************
19 * Font Loader
20 *****************************************************************************/
21
22///
23/// Fallback font family name. Will be used if all other fonts fail to load.
24///
25/// @note This font should be guaranteed to exist (eg, ULFontLoader::load should not fail when
26/// when passed this font family name).
27///
28/// @note The returned ULString instance will be consumed (ulDestroyString will be called on it).
29///
31
32///
33/// Fallback font family name that can render the specified characters. This is mainly used to
34/// support CJK (Chinese, Japanese, Korean) text display.
35///
36/// @param characters One or more UTF-16 characters. This is almost always a single character.
37///
38/// @param weight Font weight.
39///
40/// @param italic Whether or not italic is requested.
41///
42/// @return Should return a font family name that can render the text. The returned ULString
43/// instance will be consumed (ulDestroyString will be called on it).
44///
46 bool italic);
47
48///
49/// Get the actual font file data (TTF/OTF) for a given font description.
50///
51/// @param family Font family name.
52///
53/// @param weight Font weight.
54///
55/// @param italic Whether or not italic is requested.
56///
57/// @return A font file matching the given description (either an on-disk font filepath or an
58/// in-memory file buffer). You can return NULL here and the loader will fallback to
59/// another font.
60///
61typedef ULFontFile (*ULFontLoaderLoad)(ULString family, int weight, bool italic);
62
63typedef struct {
68
69#ifdef __cplusplus
70} // extern "C"
71#endif
72
73#endif // ULTRALIGHT_CAPI_FONTLOADER_H
struct C_FontFile * ULFontFile
Definition CAPI_Defines.h:64
struct C_String * ULString
Definition CAPI_Defines.h:54
ULFontFile(* ULFontLoaderLoad)(ULString family, int weight, bool italic)
Get the actual font file data (TTF/OTF) for a given font description.
Definition CAPI_FontLoader.h:61
ULString(* ULFontLoaderGetFallbackFont)()
Fallback font family name.
Definition CAPI_FontLoader.h:30
ULString(* ULFontLoaderGetFallbackFontForCharacters)(ULString characters, int weight, bool italic)
Fallback font family name that can render the specified characters.
Definition CAPI_FontLoader.h:45
Definition CAPI_FontLoader.h:63
ULFontLoaderLoad load
Definition CAPI_FontLoader.h:66
ULFontLoaderGetFallbackFontForCharacters get_fallback_font_for_characters
Definition CAPI_FontLoader.h:65
ULFontLoaderGetFallbackFont get_fallback_font
Definition CAPI_FontLoader.h:64