Documentation‎ > ‎Concepts‎ > ‎

Markup Strings

A markup string contains not only the text but also its formatting.

Copyright notice: the following two tables are copies of the Pango gtk documentation.

A simple example of a marked-up string might be: "<span foreground="blue" size="x-large">Blue text</span> is <i>cool</i>!"

In order to display "<" or ">" in the markup string then use then escape codes or &lt; and &gt; -also note, the code must be terminated with a semicolon. The equivalents of \n and \r are &#13; and &#10;.

Learn more about HTML Special Codes.


<span> Attributes

font, font_desc

A font description string, such as "Sans Italic 12". Note: Any other span attribute will override this description. So if you have "Sans Italic" and also a style="normal" attribute, you will get Sans normal, not italic.

font_family, face

A font family name

font_size, size

Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'. If you want to specify a absolute size, it's usually easier to take advantage of the ability to specify a partial font description using 'font'; you can use font='12.5' rather than size='12800'.

font_style, style

One of 'normal', 'oblique', 'italic'

font_weight, weight

One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight

font_variant, variant

One of 'normal' or 'smallcaps'

font_stretch, stretch

One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'

foreground, fgcolor, color

An RGB colour specification such as '#00FF00' or a colour name such as 'red'

background, bgcolor

An RGB colour specification such as '#00FF00' or a colour name such as 'red'

underline

One of 'none', 'single', 'double', 'low', 'error'

underline_color

The colour of underlines; an RGB colour specification such as '#00FF00' or a colour name such as 'red'

rise

Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.

strikethrough

'true' or 'false' whether to strike through the text

strikethrough_color

The colour of strikethrough lines; an RGB colour specification such as '#00FF00' or a colour name such as 'red'

fallback

'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.

lang

A language code, indicating the text language

letter_spacing

Inter-letter spacing in 1024ths of a point.

gravity

One of 'south', 'east', 'north', 'west', 'auto'.

gravity_hint

One of 'natural', 'strong', 'line'.

Convenience tags

b

Bold

big

Makes font relatively larger, equivalent to <span size="larger">

i

Italic

s

Strikethrough

sub

Subscript

sup

Superscript

small

Makes font relatively smaller, equivalent to <span size="smaller">

tt

Monospace font

u

Underline

Example

set label [gnocl::label /
    -text {%<<span foreground="blue"><b>H<i>ello</i></b></span> <span foreground="red"><i>World</i></span>}]

gnocl::window /
    -title "Label" /
    -child $label


Comments