LDKTextGlyphQuad
typedef struct LDKTextGlyphQuad{
LDKGlyph const *glyph;
u32 codepoint;
u32 page_index;
float x0;
float y0;
float x1;
float y1;
float u0;
float v0;
float u1;
float v1;
}LDKTextGlyphQuad;
Text-related descriptors and helpers for engine rendering.
typedef struct LDKTextGlyphQuad{
LDKGlyph const *glyph;
u32 codepoint;
u32 page_index;
float x0;
float y0;
float x1;
float y1;
float u0;
float v0;
float u1;
float v1;
}LDKTextGlyphQuad;
typedef struct LDKTextLayoutIterator{
LDKFontInstance *font;
char const *cursor;
char const *end;
float origin_x;
float pen_x;
float pen_y;
float line_height;
u32 previous_codepoint;
bool multiline;
}LDKTextLayoutIterator;
Initializes a glyph-layout iterator for a null-terminated UTF-8 string.
LDK_API bool ldk_text_layout_begin(
LDKTextLayoutIterator *iterator,
LDKFontInstance *font,
char const *text,
float x,
float y,
bool multiline
);
LDKTextLayoutIterator *iteratorLDKFontInstance *fontchar const *textfloat xfloat ybool multilinetrue on success, false for invalid arguments.
Initializes a glyph-layout iterator for a half-open UTF-8 byte range.
LDK_API bool ldk_text_layout_begin_range(
LDKTextLayoutIterator *iterator,
LDKFontInstance *font,
char const *text_start,
char const *text_end,
float x,
float y,
bool multiline
);
LDKTextLayoutIterator *iteratorLDKFontInstance *fontchar const *text_startchar const *text_endfloat xfloat ybool multilinetrue on success, false for invalid arguments.
Produces the next drawable glyph quad from a text layout iterator. Invalid glyphs and glyphs whose atlas page cannot be resolved are skipped. Returned positions use the same layout coordinate system supplied to begin. UVs are normalized atlas coordinates and page_index identifies the atlas page.
LDK_API bool ldk_text_layout_next(
LDKTextLayoutIterator *iterator,
LDKTextGlyphQuad *out_quad
);
LDKTextLayoutIterator *iteratorLDKTextGlyphQuad *out_quadtrue when a glyph quad was produced, false when iteration is complete.
Finds the next wrapped line within a UTF-8 byte range.
LDK_API bool ldk_text_wrapped_next_line(
LDKFontInstance *font,
char const *start,
char const *text_end,
float max_width,
char const **out_line_start,
char const **out_line_end,
char const **out_next,
float *out_width
);
LDKFontInstance *fontchar const *startchar const *text_endfloat max_widthchar const **out_line_startchar const **out_line_endchar const **out_nextfloat *out_widthtrue when a line was produced, false for invalid or empty input.