This commit adds support for the CSS ``background-color`` and
``background-image`` properties when used with HTML labels.
- Backgrounds are supported for block items (eg ``<div>``) or inline
items (eg ``<span>``)
- For images, the CSS should be formatted as ``background-image: url(xx)``.
It supports local file paths, http links, or base64 embedded content
- Backgrounds are not supported for curved text
- HTML backgrounds are always rendered above any background shape for
the label, and below drop shadows/buffers
Sponsored by City of Freiburg im Breisgau
Adds support for CSS margin properties for block elements in
the text renderer. Specifically:
- This is available for block type elements only, eg DIV, P, H1-H6.
- Margins are NOT available for spans or other non-block content (due to Qt
limitations)
- Margins can be specified in pt units only
- Margins can be specified either via "margin-left: 5pt; margin-right:
10pt" etc, or "margin: 5pt 0pt 10pt 0pt"
- Negative margins are supported for the bottom margin ONLY (due to Qt
limitations)
Adds support for the line-height CSS property in HTML formatted labels.
Supports line-height in either points or percent, eg "line-height:
40pt" or "line-height: 40%"
Allows use of img tags in HTML label content. The following logic
is applied:
- Image path is set via the src="xxx" attribute. Local, HTTP, and
base64 encoded paths are permitted
- Any image format readable by QGIS can be used
- Image sizes can be specified via the width="##" and height="##"
attributes. If width or height is not specified it will automatically
be calculated from the original image size
- If width or height are specified, they are considered to be
in POINTS
- The css width/height settings are NOT respected (this is a Qt
limitation)
- Images are not supported for curved text labels
- Images are placed inline only, floating images are not supported
Sponsored by City of Freiburg im Breisgau
For multi-line labels, this allows use of either:
- HTML <p align="xxx"> attributes
- CSS "text-align: xxx"
- HTML <center>some text</center> tags
Supported alignments are left, right, center and justify
Horizontal alignment can be used in all contexts where
HTML text is rendered, EXCEPT for curved labels (since they
are restricted to single-line text)
Sponsored by City of Freiburg im Breisgau
...and other places HTML text formatting is accepted.
This allows use of CSS "word-spacing: 12" to increase the word
spacing in a section of HTML text. The word spacing is always
treated as being in point units.
Adjust the QgsTextRenderer::calculateScaleFactorForFormat logic
so that small text is scaled up to at least 50 pixels when
calculating text metrics
This avoids tiny differences in calculated text metrics for small
text from affecting how text wrapping is calculated, which can
otherwise result in words at the end of lines "bouncing" from line
to line as layouts and maps are zoomed out