Difference between revisions of "FontBase:layoutText"
(Created page with "__NOTOC__ '''Available since:''' Gideros 2017.10<br/> === Description === <br /> Compute the layout of the given text according to a given rectangular region size, layout flag...") |
|||
Line 18: | Line 18: | ||
- line: line number this chunk belongs to | - line: line number this chunk belongs to | ||
<source lang="lua"> | <source lang="lua"> | ||
− | (table) | + | (table) = FontBase:layoutText(text,width,height,flags,letterSpacing,lineSpacing,tabSpace,breakChar) |
</source> | </source> | ||
− | '''text | + | '''text''': (string) ''''''<br/> |
− | '''width | + | '''width''': (number) ''''''<br/> |
− | '''height | + | '''height''': (number) ''''''<br/> |
− | '''flags | + | '''flags''': (number, default=FontBase.TLF_NOWRAP) ''''''<br/> |
− | '''letterSpacing | + | '''letterSpacing''': (number, default = 0) ''''''<br/> |
− | '''lineSpacing | + | '''lineSpacing''': (number, default = 0) ''''''<br/> |
− | '''tabSpace | + | '''tabSpace''': (number, default = 4) ''''''<br/> |
− | '''breakChar | + | '''breakChar''': (string) '''optional'''<br/> |
'''Returns''' (table) A table describing how to draw the given text.<br/> | '''Returns''' (table) A table describing how to draw the given text.<br/> |
Revision as of 10:19, 23 August 2018
Available since: Gideros 2017.10
Description
Compute the layout of the given text according to a given rectangular region size, layout flags and other parameters.
Refer to `TextField:setLayout` for a description of the arguments.
The returned table contains the following fields:
- x,y,w,h: Computed bounding box of the full text
- lines: The number of lines used to display the text
- parts: Information about individual chunks of texts.
Each table in the part field of the returned table describe the placement of chunks of text. Their fields are:
- text: The text to display in this chunk
- x,y,w,h: Computed bounding box of this chunk
- dx,dy: Coordinates to draw this chunk at
- sep: separator character that came just after this chunk in text block
- line: line number this chunk belongs to
(table) = FontBase:layoutText(text,width,height,flags,letterSpacing,lineSpacing,tabSpace,breakChar)
'text: (string) '
'width: (number) '
'height: (number) '
'flags: (number, default=FontBase.TLF_NOWRAP) '
'letterSpacing: (number, default = 0) '
'lineSpacing: (number, default = 0) '
'tabSpace: (number, default = 4) '
breakChar: (string) optional
Returns (table) A table describing how to draw the given text.