<span foreground="blue" size="100">Blue text</span> is <i>cool</i>!
Using the pango markup language to markup text and parsing the
result with the pango.parse_markup
()
function is a convenient way to generate the pango.AttrList
and plain text that can be used in a pango.Layout
.
The root tag of a marked-up document is
<markup>
, but the pango.parse_markup
()
function allows you to omit this tag, so you will most likely never need to
use it. The most general markup tag is <span>
. The
<span>
tag has the following attributes:
| A font description string, such as "Sans Italic 12"; note that any other span attributes will override this description. So if you have "Sans Italic" and also a style="normal" attribute, you will get Sans normal, not italic. |
| A font family name such as "normal", "sans", "serif" or "monospace". |
| A synonym for font_family |
| The font size in thousandths 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'. |
| The slant style - one of 'normal', 'oblique', or 'italic' |
| The font weight - one of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight. |
| The font variant - either 'normal' or 'smallcaps'. |
| The font width - one of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'. |
| An RGB color specification such as '#00FF00' or a color name such as 'red'. |
| An RGB color specification such as '#00FF00' or a color name such as 'red'. |
| The underline style - one of 'single', 'double', 'low', or 'none'. |
| The vertical displacement from the baseline, in ten thousandths of an em. Can be negative for subscript, positive for superscript. |
| 'true' or 'false' whether to strike through the text. |
| If True enable fallback to other fonts
of characters are missing from the current font. 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. |
| A language code, indicating the text language. |
There are a number of convenience tags that encapsulate specific span options:
| Make the text bold. |
| Makes font relatively larger, equivalent to <span size="larger">. |
| Make the text italic. |
| Strikethrough the text. |
| Subscript the text. |
| Superscript the text. |
| Makes font relatively smaller, equivalent to <span size="smaller">. |
| Use a monospace font. |
| Underline the text. |