Skip to content

Label formatting, using XML.

Dmitry Mamontov edited this page Jan 10, 2020 · 1 revision

Formatting in labels

Starting from ** 1.7.0** Saddy will support formatting in labels via XML-like syntax, if it enabled via "hasformatting" boolean property (use "Use formatting in text?" checkbox to enable it in iface-editor).

How to use formatting.

Those parts of text, which does not belong into tags will be formatted via default formatting settings for label. However, you can use any tag to specify formatting. Note, that nested formatting is also supported.

Use "div" tag to specify text block, that will be indented with new line.

Formatting in Saddy differs from standard HTML formatting, since Saddy does not use CSS for formatting and relies to tag attributes instead.

The following attributes is supported:

  • underline - makes text underlined. Supported values: "true", "false"
  • strikethrough - adds a strikethrough line. Supported values: "true", "false"
  • bold - adds bold font emulation for text. Supported values: "true", "false"
  • italic - adds italic font emulation for text. Supported values: "true", "false"
  • font - specifies font name to be used with content of tag. Note, that if font will be not found, it wont be reloaded and default font will be used. Change string content to re-attempt search for font.
  • size - specifies font size to be used. Supported values are: unsigned number (14, 28) for specifying size in pixels. Add "pt" or "px" for specifying size in points or pixels (For example: "28pt" sets size of font to 28 points, "32px" sets size of font to 32 pixels)
  • linespacing - specifies line spacing to be used. Supported values are: unsigned number (14, 28) for specifying in pixels. Add "px" or "%" for specifying size in pixels or percents. (For exmple: "28px" gives linespacing to 28 pixels, "32%" sets linespacing of font 32 percents)
  • color - specifies color of font to be used. Supported values are: "#RRGGBB", "#RRGGBBAA", where R,G,B,A are hexadecimal digits or color name as string. See src/util/colortable.cpp for the list of known colors.

Appendix

Please, note that it's supported only from 1.7.0