Re: [Qgis-user] Labeling: Allow HTML Formatting, text-size and map units
On Thu, 16 May 2024 at 23:51, chris hermansen via QGIS-User wrote: > > Thomas and list, > > On Thu, May 16, 2024, 06:39 Thomas Schüttenberg wrote: >> >> Hi Chris, >> >> yes I tried that. Any css-unit I could think of as well as em, % and >> code-words (large). But only pt resulted in a visible change on the canvas. We're a little constrained by the subset of css which the Qt library supports. See https://doc.qt.io/qt-6/richtext-html-subset.html#css-properties Unfortunately Qt CSS only supports font sizes in pt or px, not %. This could be an enhancement which the QGIS project considers sponsoring in Qt in future -- I can certainly see the limitation for a use case like you describe! Nyall >> >> Not sure if it is just not implemented or if it is a bug. > > > So ... works but doesn't... That seems to be > surprising behaviour. > > I can get that CSS style directives might not work the way one might hope > (that often happens to me in other circumstances...) > > This is tempting me to experiment. Thanks for that! > >> >> Thomas >> >> > chris hermansen hat am 15.05.2024 21:00 CEST >> > geschrieben: >> > >> > >> > Thomas and list, >> > >> > >> > On Wed, May 15, 2024 at 7:20 AM Thomas Schüttenberg via QGIS-User >> > wrote: >> > > 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 ... 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" || 'D ' || round("Deckelhohe",2) || >> > > 'S ' || round( "Sohlhohe" ,2) || '' >> > > >> > In your first note you mentioned: >> > >> > > 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. >> > >> > I suppose you tried style="font-size: 75%;" and maybe style="font-size: >> > 0.75em;", and they did not work? >> > >> > I wonder if, besides ..., you might have tried >> > ...? >> > -- >> > >> > Chris Hermansen · clhermansen "at" gmail "dot" com >> > >> > C'est ma façon de parler. > > ___ > QGIS-User mailing list > QGIS-User@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@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Labeling: Allow HTML Formatting, text-size and map units
Thomas and list, On Thu, May 16, 2024, 06:39 Thomas Schüttenberg wrote: > Hi Chris, > > yes I tried that. Any css-unit I could think of as well as em, % and > code-words (large). But only pt resulted in a visible change on the canvas. > > Not sure if it is just not implemented or if it is a bug. > So ... works but doesn't... That seems to be surprising behaviour. I can get that CSS style directives might not work the way one might hope (that often happens to me in other circumstances...) This is tempting me to experiment. Thanks for that! > Thomas > > > chris hermansen hat am 15.05.2024 21:00 CEST > geschrieben: > > > > > > Thomas and list, > > > > > > On Wed, May 15, 2024 at 7:20 AM Thomas Schüttenberg via QGIS-User < > qgis-user@lists.osgeo.org> wrote: > > > 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 ... 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" || 'D ' || round("Deckelhohe",2) || > 'S ' || round( "Sohlhohe" ,2) || '' > > > > > In your first note you mentioned: > > > > > 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. > > > > I suppose you tried style="font-size: 75%;" and maybe style="font-size: > 0.75em;", and they did not work? > > > > I wonder if, besides ..., you might have tried > ...? > > -- > > > > Chris Hermansen · clhermansen "at" gmail "dot" com > > > > C'est ma façon de parler. > ___ QGIS-User mailing list QGIS-User@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Labeling: Allow HTML Formatting, text-size and map units
Hi Chris, yes I tried that. Any css-unit I could think of as well as em, % and code-words (large). But only pt resulted in a visible change on the canvas. Not sure if it is just not implemented or if it is a bug. Thomas > chris hermansen hat am 15.05.2024 21:00 CEST > geschrieben: > > > Thomas and list, > > > On Wed, May 15, 2024 at 7:20 AM Thomas Schüttenberg via QGIS-User > wrote: > > 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 ... 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" || 'D ' || round("Deckelhohe",2) || > > 'S ' || round( "Sohlhohe" ,2) || '' > > > In your first note you mentioned: > > > 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. > > I suppose you tried style="font-size: 75%;" and maybe style="font-size: > 0.75em;", and they did not work? > > I wonder if, besides ..., you might have tried ...? > -- > > Chris Hermansen · clhermansen "at" gmail "dot" com > > C'est ma façon de parler. ___ QGIS-User mailing list QGIS-User@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Labeling: Allow HTML Formatting, text-size and map units
Thomas and list, On Wed, May 15, 2024 at 7:20 AM Thomas Schüttenberg via QGIS-User < qgis-user@lists.osgeo.org> wrote: > 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 ... 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" || 'D ' || round("Deckelhohe",2) || > 'S ' || round( "Sohlhohe" ,2) || '' > > In your first note you mentioned: 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. I suppose you tried style="font-size: 75%;" and maybe style="font-size: 0.75em;", and they did not work? I wonder if, besides ..., you might have tried ...? -- Chris Hermansen · clhermansen "at" gmail "dot" com C'est ma façon de parler. ___ QGIS-User mailing list QGIS-User@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Labeling: Allow HTML Formatting, text-size and map units
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 ... 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" || 'D ' || round("Deckelhohe",2) || 'S ' || round( "Sohlhohe" ,2) || '' happy QGISing everyone! Thomas > Thomas Schüttenberg via QGIS-User 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 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( > > '%2', > > @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@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.gi...@wheregroup.com > > www.wheregroup.com > > Geschäftsführer: > > Olaf Knopp, Peter Stamm > > Amtsgericht Bonn, HRB 9885 > > > > > > ___ > > QGIS-User mailing list > > QGIS-User@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@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@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Labeling: Allow HTML Formatting, text-size and map units
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 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( > '%2', > @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@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.gi...@wheregroup.com > www.wheregroup.com > Geschäftsführer: > Olaf Knopp, Peter Stamm > Amtsgericht Bonn, HRB 9885 > > > ___ > QGIS-User mailing list > QGIS-User@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@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Labeling: Allow HTML Formatting, text-size and map units
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( '%2', @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@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.gi...@wheregroup.com www.wheregroup.com Geschäftsführer: Olaf Knopp, Peter Stamm Amtsgericht Bonn, HRB 9885 ___ QGIS-User mailing list QGIS-User@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] Labeling: Allow HTML Formatting, text-size and map units
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@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user