TEXT ​
Writes a specific text.
Syntax ​
TEXT strValue [ x:measureValue ] [ y:measureValue ] [ w:measureValue ] [ h:measureValue ]
[ line-break:modifier ] [ line-height:measureValue ] .
Parameters ​
<main-parameter>
(strValue) - The text to display.x
(measureValue / modifier, optional) - The x-coordinate for the position of the text. The default is0cm
.y
(measureValue / modifier, optional) - The y-coordinate for the position of the text. The default is0cm
.w
(measureValue / modifier, optional) - The horizontal alignment and the available width for the text. Possible alignments arel
,c
andr
. The default isl
and an unconstrained width.h
(measureValue / modifier, optional) - The vertical alignment and the available height for the text. Possible alignments aret
,c
andb
. The default ist
and an unconstrained height.line-break
(modifier, optional) - Setting for automatically adding line-breaks when the maximum width is reached. Possible values arewords
,rigorous
andoff
. The default isoff
.line-height
(measureValue, optional) - The height of a line, which is relevant when the text is split into multiple lines. The default is based on the used font size.
Details ​
The style of this command is defined by the FONT
command.
The text to display is specified through the <main-parameter>
, which can be either a literal or an expression. The text will be displayed at the position specified through x
and y
. The parameters w
and h
allow to set the alignment and space for the text. The space for the text is only relevant when automatic line breaks are turned on through the line-breaks
parameter.
Position ​
The x
and y
values are interpreted in relation to the object's position. They can alternatively be specified as absolute values using the modifier abs
before the measure value. In such a case the coordinate is evaluated in relation to the drawing area instead of the object's position and the object's width / height is changed accordingly. This allows to ensured that an attribute is always in a determined column on the drawing area and is displayed independent of how far left or right the object is. For example x:abs:0.5cm
will print the text always 0.5cm from the left edge fo the drawing area. Avoid specifying a position as abs
when smart-symbol-size
is used for the GRAPHREP
as it will set the object's width and height to 0cm.
Alignment ​
There are nine possibilities to align the lines of the displayed text. These result from the possible combinations of the horizontal (l
- left, c
- centred, r
- right) with the vertical (t
- top, c
- centred, b
- bottom) alignment. The type of alignment determines how the (invisible) rectangle including the whole text is positioned in relation to the position (x
, y
). For example w:c
and h:c
will align the text centered on the position. Individual lines are aligned according to the horizontal alignment specified within this rectangle.
Line Height and Line Breaks ​
The line-height
specifies the height to consider for a line. This does not change the actual height of the text as specified by the FONT
style, but s used instead to reduce or increase the space between separate lines. By default the line height is based on the used font size.
The setting for automatic line breaks is controlled through the line-break
parameter, which can be set to words
, rigorous
or off
. If set to words
or rigorous
, then text longer than the allowed width will be broken into several lines. In case of words
a line break is inserted before the first word which goes beyond the permitted width, but will not break inside of a whole word, even if a word by itself is longer than the allowed width. In case of rigorous
a line break is also inserted before the first word which goes beyond the permitted width when possible or if a whole word is longer than the allowed width, then a line break is inserted before the first letter which goes beyond the permitted width. When the available space specified by h
is reached, then the value will be cut off and three dots ...
appended at its end. Automatic line breaks can be turned off
, in which case any specified restriction on width and height are ignored. Manual line breaks (through \n
as part of the text value) are always possible.
Caution
Here the default value for like-break
is off
, which is different from the default value used in ATTR
.
Connector Rotation ​
Text is not rotated automatically when drawing relations to fit their angle.
View Font Size ​
The size of text displayed via this command is not influenced by the View -> Font size... setting in the Modelling Toolkit.
See Also ​
Examples ​
Print the text "Hello World".
GRAPHREP
TEXT "Hello World"
Print a text inside a rectangle, but only print as much of the text as fits in the rectangle.
GRAPHREP
# Note: SHADOW is on by default.
RECTANGLE x:-1cm y:-0.5cm w:2cm h:1cm
TEXT "A longer text, more than fits in the rectangle" w:c:1.8cm h:c:0.9cm line-break:rigorous
Print the first three letters of the value of the attribute "Continent", prepend it with a "c: " and center it horizontally. Use the "Courier New" font for the text. Unlike ATTR
it does not provide the typical interaction with the attribute (click value to open input window).
GRAPHREP
AVAL sContinent:"Continent"
FONT "Courier New"
TEXT ("c: " + copy(sContinent, 0, 3)) w:c
Versions and Changes ​
Available since ADOxx 1.3