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

Thomas Schüttenberg thomas at qgis.de
Wed May 15 07:20:19 PDT 2024


Ha!
I found an other way around to do the trick, suitable for my use case at least:

1) increasing the (overall) text size setting on the text tab by 2/3
2) putting only the attributes/text strings of the second and following lines between <sub>...</sub> tags, which renders them about 2/3 smaler, i.e. same as before. 

The (reverse) result is a multi line label with the first line emphazised by its larger size! ;-)

"Bezeichnung" || '<p><sub>D ' || round("Deckelhohe",2) || '</sub></p><p><sub>S ' || round( "Sohlhohe" ,2) || '</sub></p>'

happy QGISing everyone!
Thomas


> Thomas Schüttenberg via QGIS-User <qgis-user at lists.osgeo.org> hat am 15.05.2024 15:04 CEST geschrieben:
> 
>  
> Hi Stefan,
> thanks for the hint.
> The size value can be made variable (as visible in the expression builder preview), but on the canvas there is yet no dynamic change what so ever.  :-/
> 
> Best regards
> Thomas
> 
> 
> > Stefan Giese (WhereGroup) via QGIS-User <qgis-user at lists.osgeo.org> hat am 15.05.2024 10:24 CEST geschrieben:
> > 
> >  
> > 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
> > 
> > 
> > _______________________________________________
> > 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
> _______________________________________________
> 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


More information about the QGIS-User mailing list