Function in ldk_ttf.h

ldk_ttf_clear_page_dirty

Clears the dirty flag of an atlas page.

LDK_API void ldk_ttf_clear_page_dirty(
 LDKFontInstance *instance,
 u32 page_index
);

Parameters

LDKFontInstance *instance
Font instance.
u32 page_index
Atlas page index.
Function in ldk_ttf.h

ldk_ttf_face_create

Creates a font face from TrueType font data.

LDK_API LDKFontFace * ldk_ttf_face_create(
 void const *data,
 u32 data_size
);

Parameters

void const *data
Source font file data.
u32 data_size
Size of the source font data in bytes.

Returns

New font face, or NULL on failure.

Function in ldk_ttf.h

ldk_ttf_face_destroy

Destroys a font face and all font instances created from it.

LDK_API void ldk_ttf_face_destroy(LDKFontFace *face);

Parameters

LDKFontFace *face
Font face to destroy. May be NULL.
Function in ldk_ttf.h

ldk_ttf_get_instance

Gets or creates a font instance for a specific pixel height.

LDK_API LDKFontInstance * ldk_ttf_get_instance(
 LDKFontFace *face,
 float pixel_height,
 LDKFontAtlasDesc const *atlas_desc
);

Parameters

LDKFontFace *face
Source font face.
float pixel_height
Requested font pixel height.
LDKFontAtlasDesc const *atlas_desc
Optional atlas configuration. NULL uses default atlas settings.

Returns

Font instance, or NULL on failure.

Function in ldk_ttf.h

ldk_ttf_get_kerning

Gets the horizontal kerning adjustment between two codepoints.

LDK_API float ldk_ttf_get_kerning(
 LDKFontInstance const *instance,
 u32 left_codepoint,
 u32 right_codepoint
);

Parameters

LDKFontInstance const *instance
Font instance.
u32 left_codepoint
Previous Unicode codepoint.
u32 right_codepoint
Current Unicode codepoint.

Returns

Kerning adjustment in pixels, or 0 if unavailable.

Function in ldk_ttf.h

ldk_ttf_get_line_height

Gets the scaled line height for a font instance.

LDK_API float ldk_ttf_get_line_height(LDKFontInstance *instance);

Parameters

LDKFontInstance *instance
Font instance.

Returns

Line height in pixels, or 0 if instance is NULL.

Function in ldk_ttf.h

ldk_ttf_get_page_count

Gets the number of atlas pages owned by a font instance.

LDK_API u32 ldk_ttf_get_page_count(LDKFontInstance const *instance);

Parameters

LDKFontInstance const *instance
Font instance.

Returns

Number of atlas pages, or 0 if instance is NULL.

Function in ldk_ttf.h

ldk_ttf_get_page_info

Gets information for a font atlas page.

LDK_API bool ldk_ttf_get_page_info(
 LDKFontInstance const *instance,
 u32 page_index,
 LDKFontPageInfo *out_page
);

Parameters

LDKFontInstance const *instance
Font instance.
u32 page_index
Atlas page index.
LDKFontPageInfo *out_page
Destination page information.

Returns

true if page information was written, false on failure.

Function in ldk_ttf.h

ldk_ttf_get_pixel_height

Gets the pixel height used by a font instance.

LDK_API float ldk_ttf_get_pixel_height(LDKFontInstance const *instance);

Parameters

LDKFontInstance const *instance
Font instance.

Returns

Pixel height, or 0 if instance is NULL.

Function in ldk_ttf.h

ldk_ttf_preload_basic_ascii

Preloads printable basic ASCII glyphs.

LDK_API bool ldk_ttf_preload_basic_ascii(LDKFontInstance *instance);

Parameters

LDKFontInstance *instance
Font instance.

Returns

true if all glyphs were processed, false on failure.

Function in ldk_ttf.h

ldk_ttf_preload_range

Preloads and caches all glyphs in an inclusive codepoint range.

LDK_API bool ldk_ttf_preload_range(
 LDKFontInstance *instance,
 u32 first_codepoint,
 u32 last_codepoint
);

Parameters

LDKFontInstance *instance
Font instance.
u32 first_codepoint
First Unicode codepoint to preload.
u32 last_codepoint
Last Unicode codepoint to preload.

Returns

true if all glyphs were processed, false on failure.

Function in ldk_ttf.h

ldk_ttf_utf8_consume_codepoint

Consumes one UTF-8 codepoint and advances the input cursor.

LDK_API bool ldk_ttf_utf8_consume_codepoint(
 char const **cursor,
 u32 *out_codepoint
);

Parameters

char const **cursor
Pointer to the current UTF-8 string position. Updated to the next byte after the decoded sequence.
u32 *out_codepoint
Destination for the decoded Unicode codepoint.

Returns

true if a codepoint was consumed, false if input is invalid or the cursor is at the string terminator.

Function in ldk_ttf.h

ldk_ttf_utf8_consume_codepoint_range

Consumes one UTF-8 codepoint within a bounded byte range and advances the input cursor.

LDK_API bool ldk_ttf_utf8_consume_codepoint_range(
 char const **cursor,
 char const *end,
 u32 *out_codepoint
);

Parameters

char const **cursor
Pointer to the current UTF-8 string position. Updated to the next byte after the decoded sequence.
char const *end
Exclusive end pointer for the UTF-8 byte range.
u32 *out_codepoint
Destination for the decoded Unicode codepoint.

Returns

true if a codepoint was consumed, false if input is invalid, the cursor is at the string terminator, or the cursor reached end.