API for laying out complex text into format ready for display
| Namespace: | TextLayout |
| Include: | #include <dmsdk/font/text_layout.h> |
| TYPES | |
|---|---|
| HTextLayout | A handle representing a text layout |
| ENUMS | |
|---|---|
| TextDirection | An enum representing text layout directions |
| TextLayoutType | An enum representing text layout features Each fon... |
| TextResult | An enum representing text layout results |
| STRUCTS | |
|---|---|
| struct TextGlyph | Glyph representing the final position within a lay... |
| struct TextLayoutSettings | Describes how to do a text layout |
| struct TextLine | Represents a line of glyphs |
| FUNCTIONS | |
|---|---|
| TextResult TextLayoutCreate(HFontCollection collection, uint32_t* codepoints, uint32_t num_codepoints, TextLayoutSettings* settings, HTextLayout* layout) | Create a text layout using a font collection if su... |
| void TextLayoutFree(HTextLayout layout) | Frees a previously created layout |
| float* TextLayoutGetBounds(HTextLayout layout) | Get the lines in the layout |
| uint32_t TextLayoutGetGlyphCount(HTextLayout layout) | Get the glyph count in the layout |
| TextGlyph* TextLayoutGetGlyphs(HTextLayout layout) | Get the glyphs in the layout |
| uint32_t TextLayoutGetLineCount(HTextLayout layout) | Get the line count in the layout |
| TextLine* TextLayoutGetLines(HTextLayout layout) | Get the lines in the layout |
TextResult TextLayoutCreate(HFontCollection collection, uint32_t* codepoints, uint32_t num_codepoints, TextLayoutSettings* settings, HTextLayout* layout)
Create a text layout using a font collection if successful, the caller must call TextLayoutFree() on the layout
PARAMETERS
HFontCollection |
collection |
the font collection |
uint32_t* |
codepoints |
an array of codepoints |
uint32_t |
num_codepoints |
number of codepoints in the array |
TextLayoutSettings* |
settings |
the settings used for rendering |
HTextLayout* |
layout |
(out) the output text layout |
RETURNS
TextResult |
the result. TEXT_RESULT_OK if successful |
void TextLayoutFree(HTextLayout layout)
Frees a previously created layout
PARAMETERS
HTextLayout |
layout |
the text layout |
float* TextLayoutGetBounds(HTextLayout layout)
Get the lines in the layout
PARAMETERS
HTextLayout |
layout |
the text layout |
RETURNS
float* |
the total width of the layout (out) |
float* |
the total height of the layout (out) |
uint32_t TextLayoutGetGlyphCount(HTextLayout layout)
Get the glyph count in the layout
PARAMETERS
HTextLayout |
layout |
the text layout |
RETURNS
uint32_t |
the number of glyphs in the layout |
TextGlyph* TextLayoutGetGlyphs(HTextLayout layout)
Get the glyphs in the layout
PARAMETERS
HTextLayout |
layout |
the text layout |
RETURNS
TextGlyph* |
the array of glyphs in the layout |
uint32_t TextLayoutGetLineCount(HTextLayout layout)
Get the line count in the layout
PARAMETERS
HTextLayout |
layout |
the text layout |
RETURNS
uint32_t |
the number of lines in the layout |
TextLine* TextLayoutGetLines(HTextLayout layout)
Get the lines in the layout
PARAMETERS
HTextLayout |
layout |
the text layout |
RETURNS
TextLine* |
the array of lines in the layout |
TYPE
struct TextGlyphGlyph representing the final position within a layout
MEMBERS
HFont |
m_Font |
The font used for this glyph |
float |
m_X |
the final x position, relative the top-left corner of the layout |
float |
m_Y |
the final y position, relative the top-left corner of the layout |
float |
m_Width |
the width of the glyph |
float |
m_Height |
the height of the glyph |
uint32_t |
m_Codepoint |
original copdepoint (if available) |
uint16_t |
m_GlyphIndex |
the glyph index in the font |
uint16_t |
m_Cluster |
the index in the original text, that this glyph corresponds to |
TYPE
struct TextLayoutSettingsDescribes how to do a text layout
MEMBERS
float |
m_Size |
The desired size of the font (in pixels) |
float |
m_Width |
Max layout width. Used only when m_LineBreak is non-zero |
float |
m_Leading |
The extra space between each line. Set 1.0f as default. |
float |
m_Tracking |
The extra tracking between glyphs. Set 0 as default. |
uint32_t |
m_Padding |
Legacy: Padding for monospace, glyphbank fonts |
uint8_t:1 |
m_LineBreak |
Allow line breaks |
uint8_t:1 |
m_Monospace |
Legacy: Is the font a monospace font. Current: should be set on the font in the font collection! |
TYPE
struct TextLineRepresents a line of glyphs
MEMBERS
float |
m_Width |
Width of the line |
uint16_t |
m_Index |
Index into the list of glyphs |
uint16_t |
m_Length |
Number of glyphs to render |
A handle representing a text layout
An enum representing text layout directions
TEXT_DIRECTION_LTR |
Left-to-right text direction |
TEXT_DIRECTION_RTL |
Right-to-left text direction |
An enum representing text layout features Each font supports a layout type The selected layout type it the minimum value of layout types
TEXT_LAYOUT_TYPE_LEGACY |
Legacy text shaping api |
TEXT_LAYOUT_TYPE_FULL |
Full text shaping api |
An enum representing text layout results
TEXT_RESULT_OK |
|
TEXT_RESULT_ERROR |