Expose more information about text layout.

This commit is contained in:
Twan van Laarhoven
2020-05-10 14:12:53 +02:00
parent 1c35183839
commit e8eacac5e7
6 changed files with 145 additions and 23 deletions
+4 -3
View File
@@ -110,9 +110,10 @@ The rest of the properties depend on the type of [[type:field]] this style is fo
<img src="style-text-mask.png" alt=""/><br/>
The same mask image is also used to determine the size and shape of the box.
To include a certain pixel in the size/shape but not allow text to be placed there, it can be made dark gray (a value less than 128).
| ^^^ @content width@ [[type:double]] ''automatic'' When read from a script, gives the width of the current content in this box.
| ^^^ @content height@ [[type:double]] ''automatic'' When read from a script, gives the height of the current content in this box.
| ^^^ @content lines@ [[type:int]] ''automatic'' When read from a script, gives the number of lines of the current content in this box.
| ^^^ @layout@ [[type:text layout]] ''automatic'' When read from a script, gives information on the layout of text in this box.
| ^^^ @content width@ [[type:double]] ''automatic'' When read from a script, gives the width of the current content in this box. Equivalent to @layout.width@
| ^^^ @content height@ [[type:double]] ''automatic'' When read from a script, gives the height of the current content in this box. Equivalent to @layout.height@
| ^^^ @content lines@ [[type:int]] ''automatic'' When read from a script, gives the number of lines of the current content in this box. Equivalent to @length(layout.lines)@
! <<< <<< <<< <<<
| @"choice"@,<br/>@"multiple choice"@,<br/>@"boolean"@
+28
View File
@@ -0,0 +1,28 @@
Data type: text layout info
DOC_MSE_VERSION: since 2.0.2
This type contains information on rendered text.
The text is devided into 'lines', 'paragraphs' and 'blocks.
A line is a line on the screen.
A paragraph is one or more lines, ending in an explicit line break, a "\n" in the text.
A block is one or more paragraphs, ending in a line, "<line>\n</line>".
It is possible to dig deeper into blocks, for example
> card_style.text.layout.blocks[1].lines[0].middle
Is the middle of the first line of the second block.
--Properties--
! Property Type Description
| @width@ [[type:double]] Width of this line or group of lines in pixels.
| @height@ [[type:double]] Height of this line or group of lines in pixels.
| @top@ [[type:double]] Top y coordinate
| @middle@ [[type:double]] Middle y coordinate
| @bottom@ [[type:double]] Bottom y coordinate
| @lines@ [[type:list]] of [[type:text layout]]s The lines in this part of the text.
| @paragraphs@ [[type:list]] of [[type:text layout]]s The paragraphs in this part of the text.
| @blocks@ [[type:list]] of [[type:text layout]]s The blocks in this part of the text.
| @separators@ [[type:list]] of [[type:double]]s The y coordinates of separators between blocks.