A textlayout is lower-level text rendering object used by higher-level entities such as TextField.
More...
|
t_jtextlayout * | jtextlayout_create () |
| Create a new textlayout object. More...
|
|
t_jtextlayout * | jtextlayout_withbgcolor (t_jgraphics *g, t_jrgba *bgcolor) |
| Create a new textlayout object. More...
|
|
void | jtextlayout_destroy (t_jtextlayout *textlayout) |
| Release/free a textlayout object. More...
|
|
void | jtextlayout_set (t_jtextlayout *textlayout, const char *utf8, t_jfont *jfont, double x, double y, double width, double height, t_jgraphics_text_justification justification, t_jgraphics_textlayout_flags flags) |
| Set the text and attributes of a textlayout object. More...
|
|
void | jtextlayout_settext (t_jtextlayout *textlayout, const char *utf8, t_jfont *jfont) |
| Set the text of a textlayout object. More...
|
|
void | jtextlayout_settextcolor (t_jtextlayout *textlayout, t_jrgba *textcolor) |
| Set the color to render text in a textlayout object. More...
|
|
void | jtextlayout_measuretext (t_jtextlayout *textlayout, long startindex, long numchars, long includewhitespace, double *width, double *height, long *numlines) |
| Return a measurement of how much space will be required to draw the text of a textlayout. More...
|
|
void | jtextlayout_draw (t_jtextlayout *tl, t_jgraphics *g) |
| Draw a textlayout in a given graphics context. More...
|
|
long | jtextlayout_getnumchars (t_jtextlayout *tl) |
| Retrieve a count of the number of characters in a textlayout object. More...
|
|
t_max_err | jtextlayout_getcharbox (t_jtextlayout *tl, long index, t_rect *rect) |
| Retrieve the t_rect containing a character at a given index. More...
|
|
t_max_err | jtextlayout_getchar (t_jtextlayout *tl, long index, long *pch) |
| Retrieve the unicode character at a given index. More...
|
|
t_jpath * | jtextlayout_createpath (t_jtextlayout *tl) |
| Create a t_jpath object representing the text layout. More...
|
|
A textlayout is lower-level text rendering object used by higher-level entities such as TextField.
Flags for setting text layout options.
Enumerator |
---|
JGRAPHICS_TEXTLAYOUT_NOWRAP |
disable word wrapping
|
JGRAPHICS_TEXTLAYOUT_USEELLIPSIS |
show ... if a line doesn't fit (implies NOWRAP too)
|
Create a new textlayout object.
- Returns
- The new textlayout object.
Create a t_jpath object representing the text layout.
- Parameters
-
tl | The textlayout object to retrieve a path for. |
- Returns
- A t_jpath. When finished with the path free it with jgraphics_path_destroy.
Release/free a textlayout object.
- Parameters
-
textlayout | The textlayout object to release. |
Draw a textlayout in a given graphics context.
- Parameters
-
tl | The textlayout object to query. |
g | The graphics context in which to draw the text. |
Retrieve the unicode character at a given index.
- Parameters
-
tl | The textlayout object to query. |
index | The index from which to fetch the unicode character. |
pch | The address of a variable to hold the unicode character value upon return. |
- Returns
- A Max error code.
Retrieve the t_rect containing a character at a given index.
- Parameters
-
tl | The textlayout object to query. |
index | The index from which to fetch the unicode character. |
rect | The address of a valid t_rect which will be filled in upon return. |
- Returns
- A Max error code.
Retrieve a count of the number of characters in a textlayout object.
- Parameters
-
tl | The textlayout object to query. |
- Returns
- The number of characters.
void jtextlayout_measuretext |
( |
t_jtextlayout * |
textlayout, |
|
|
long |
startindex, |
|
|
long |
numchars, |
|
|
long |
includewhitespace, |
|
|
double * |
width, |
|
|
double * |
height, |
|
|
long * |
numlines |
|
) |
| |
Return a measurement of how much space will be required to draw the text of a textlayout.
- Parameters
-
textlayout | The textlayout object to query. |
startindex | You can measure a subset of the characters. This defines the character from which to start. |
numchars | Pass -1 for all characters from startindex to end |
includewhitespace | Define whether to measure with or without whitespace truncated from edges. |
width | Returns the width of text not including any margins. |
height | Returns the height of text not including any margins. |
numlines | Returns the number of lines of text. |
Set the text and attributes of a textlayout object.
- Parameters
-
textlayout | The textlayout object. |
utf8 | The text to render. |
jfont | The font with which to render the text. |
x | The text is placed within rect specified by x, y, width, height. |
y | The text is placed within rect specified by x, y, width, height. |
width | The text is placed within rect specified by x, y, width, height. |
height | The text is placed within rect specified by x, y, width, height. |
justification | How to justify the text within the rect. |
flags | Additional flags to control behaviour. |
Set the text of a textlayout object.
- Parameters
-
textlayout | The textlayout object. |
utf8 | The text to render. |
jfont | The font with which to render the text. |
Set the color to render text in a textlayout object.
- Parameters
-
textlayout | The textlayout object for which to set the color. |
textcolor | The color for the text. |
Create a new textlayout object.
This gives a hint to the textlayout as to what the text bgcolor will be. It won't actually paint the bg for you. But, it does let it do a better job.
- Parameters
-
g | The graphics context for the textlayout. |
bgcolor | The background color for the textlayout. |
- Returns
- The new textlayout object.