[Qgis-user] Labeling: Allow HTML Formatting, text-size and map units

Stefan Giese (WhereGroup) stefan.giese at wheregroup.com
Wed May 15 01:24:48 PDT 2024


Hi Thomas,

you can try to involve the map_scale variable into a dynamic size of the 
HTML Label, something like:

with_variable('fs', 25000/@map_scale,
       format(
      '<h1 style="font-size:%1pt;">%2</h1>',
      @fs , title( "Name" )))

Best regards

Stefan

Am 15.05.2024 um 09:13 schrieb Thomas Schüttenberg via QGIS-User:
> Hi there!
>
> I am just playing arund with html enhanced labeling, using the option "Allow HTML Formatting" on the text tab (https://docs.qgis.org/3.34/en/docs/user_manual/style_library/label_settings.html#text-tab).
>
> Now I wonder how/if it is possible to override the text-size in such a manner, that my label as a whole is still scale dependend and is respecting the given map units including the minimum and maximum scale (https://docs.qgis.org/3.34/en/docs/user_manual/introduction/general_tools.html#unit-selector)?
>
> Imagine you have a multi line label with the text size set to 2 meters map units and a maximum scale at 1:5000.
> Now the first line should be double in text size and therefore I use something like style="font-size:20pt" (see example in manual above).
>
> But only pt (points) seams to work as the unit in this place, which gives a fixed size throughout all scales and does not respect the behavior of the map units with maximum scale setting.
>
> Does anyone know a trick to achieve this anyhow?
>
> All the Best!
> Thomas
> _______________________________________________
> QGIS-User mailing list
> QGIS-User at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-- 
Mit freundlichen Grüßen
Stefan Giese
Projektleiter/Consultant
*********************************************
Aufwind durch Wissen!
Web-Seminare und Online-Schulungen
bei der www.foss-academy.com
*********************************************
WhereGroup GmbH
Schwimmbadstr. 2
79100 Freiburg
Germany

Tel.: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11

stefan.giese at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885




More information about the QGIS-User mailing list