Functions to draw text into a graphics context.
See Graphics Context for more information about the graphics context.
Other drawing functions and related documentation:
void graphics_draw_text | ( | GContext * | ctx, |
const char * | text, | ||
GFont const | font, | ||
const GRect | box, | ||
const GTextOverflowMode | overflow_mode, | ||
const GTextAlignment | alignment, | ||
const GTextLayoutCacheRef | layout | ||
) |
Draw text into the current graphics context, using the context's current text color. The text will be drawn inside a box with the specified dimensions and configuration, with clipping occuring automatically.
ctx | The destination graphics context in which to draw |
text | The zero terminated UTF-8 string to draw |
font | The font in which the text should be set |
box | The bounding box in which to draw the text. The first line of text will be drawn against the top of the box. |
overflow_mode | The overflow behavior, in case the text is larger than what fits inside the box. |
alignment | The horizontal alignment of the text |
layout | Optional layout cache data. Supply NULL to ignore the layout caching mechanism. |
GSize graphics_text_layout_get_max_used_size | ( | GContext * | ctx, |
const char * | text, | ||
GFont const | font, | ||
const GRect | box, | ||
const GTextOverflowMode | overflow_mode, | ||
const GTextAlignment | alignment, | ||
GTextLayoutCacheRef | layout | ||
) |
Obtain the maximum size that a text with given font, overflow mode and alignment occupies within a given rectangular constraint.
ctx | the current graphics context |
text | The zero terminated UTF-8 string for which to calculate the size |
font | The font in which the text should be set while calculating the size |
box | The bounding box in which the text should be constrained |
overflow_mode | The overflow behavior, in case the text is larger than what fits inside the box. |
alignment | The horizontal alignment of the text |
layout | Optional layout cache data. Supply NULL to ignore the layout caching mechanism. |
typedef TextLayout* GTextLayoutCacheRef |
Pointer to opaque text layout cache data structure.
enum GTextAlignment |
Text aligment controls the way the text is aligned inside the box the text is drawn into.
enum GTextOverflowMode |
Text overflow mode controls the way text overflows when the string that is drawn does not fit inside the area constraint.