Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure html label section and add word-spacing #9249

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

folinimarc
Copy link
Contributor

@folinimarc folinimarc commented Sep 11, 2024

Fixes #9245

This PR proposes the following changes:

  • Document the word-spacing CSS property.
  • Refactor the "Allow HTML Formatting" into its own subsection to de-clutter the text tab bullet point list.
  • Change some of the wording to be more precise, i.e. distinguish between CSS properties and HTML tags.

Discussed with @selmaVH1 at Hackfest, thanks Selma!

Copy link
Collaborator

@DelazJ DelazJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea for the dedicated section @folinimarc

docs/user_manual/style_library/label_settings.rst Outdated Show resolved Hide resolved
docs/user_manual/style_library/label_settings.rst Outdated Show resolved Hide resolved
docs/user_manual/style_library/label_settings.rst Outdated Show resolved Hide resolved
docs/user_manual/style_library/label_settings.rst Outdated Show resolved Hide resolved
@folinimarc
Copy link
Contributor Author

folinimarc commented Sep 13, 2024

@DelazJ Re-requesting review. I added your suggestions and while doing so streamlined the html and css sections a little more.

Copy link
Collaborator

@DelazJ DelazJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a question and a formatting suggestion

With :guilabel:`Allow HTML Formatting` enabled, you need to provide the HTML code in the :guilabel:`Value` field.
Use whitespaces instead of tabs for any kind of indentation.
The expression is parsed and any supported HTML tag overrides its corresponding setting in the labels properties.
An exhaustive list of the supported subset of HTML tags and CSS properties can be found `here <https://doc.qt.io/qt-5/richtext-html-subset.html>`_.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@folinimarc Maybe do I misunderstand or nitpick but we do not yet support all these tags/properties, do we? They are more like targets afaict, "to be supported".

Copy link
Contributor

@nyalldawson nyalldawson Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, we only support a small subset of them:

  • font colour
  • font size
  • font family
  • bold
  • italic
  • strike through
  • underline/overline
  • super/subscript
  • br
  • div
  • p

Copy link
Contributor Author

@folinimarc folinimarc Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both for bringing this up and the clarification! I should have seen this myself in the source code (or just stick to the scope of the change >.<). Will update the PR next week as soon as I am back at my laptop.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@folinimarc it might worth waiting till qgis/QGIS#58716 is merged, since that also relates

:ref:`textual properties <text_format>` of the label.
Likewise, you can create/overwrite a text format from there.
CSS properties can be set on HTML tags with the style attribute.
The HTML tag span does not apply any formatting to text by itself and is ideal if you just want to apply CSS styling.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The HTML tag span does not apply any formatting to text by itself and is ideal if you just want to apply CSS styling.
The HTML tag ``span`` does not apply any formatting to text by itself and is ideal if you just want to apply CSS styling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Add support for word-spacing CSS in html labels (Request in QGIS)
3 participants