A markup_text displays text formatted using Pango markup. The markup can mix fonts, sizes, styles and colours within one text, for example:
new(T, markup_text("Hello <b>bold</b> and <span foreground='red'>red</span>")),
send(Picture, display, T, point(10, 10)).
Unlike class text, a
markup_text cannot be edited and has no caret or selection. Its layout
is done by Pango, which also handles wrapping lines at a given markup_text<-width,
aligning, justifying and ellipsizing them. The size of a markup_text is
computed from its content and layout. Text that has no colour in the
markup is drawn using
graphical<-colour.
To rotate or scale a markup_text, display it on a figure with a figure<-transform.
The most common tags are <b>, <i>, <u>, <s>, <tt>, <big>,
<small>, <sub> and <sup>.
The <span> tag accepts attributes such as font, size, weight, style, foreground, background,
underline and strikethrough. The characters <, >
and & must be written as <, >
and &.
Besides the colours Pango knows, colour attributes such as foreground
and background accept the name of any existing xpce colour.
Notably, this allows for theme colours, for example
<span foreground='ui_link'>, which follow a change of
theme. Likewise, font_family and face accept
xpce's font families such as
mono, and <tt> uses the family mono,
the font xpce uses for fixed-width text, rather than Pango's Monospace,
on the faint theme colour ui_code_background.
big
are relative to this font.
Defaults: the class variable font
(normal).
->geometry
sets this value if a width is given.
Defaults: @nil (lines are only broken at newlines)
<-width
or, if there is no width, within the longest line.
Defaults: left
<-width.
Defaults: @off
none and a markup_text<-width
is given, lines are not wrapped. Instead, text that does not fit is
replaced by ... at the indicated place.
Defaults: none
Defaults: 0
<-width.
The height is determined by the content.