-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[BUGFIX] Read SLD TextSymbolizer set units to pixels #33725
[BUGFIX] Read SLD TextSymbolizer set units to pixels #33725
Conversation
LGTM... BTW @rldhont did you check if during SLD output of the font, it is always converted to pixel units? (could be a possible bug) |
@rldhont waiting for test fix to accept the PR |
@luipir I have check that every units are converted to pixels. |
@luipir code fixed |
One consideration here is that pixel unit sizes have very limited use in QGIS. If you set the font size and parameters to a pixel sized unit, then any outputs made from that map in hi resolutions (such as from a print layout) will have tiny sizes. So it depends what the intention is here... if it's for exact 1:1 match of the SLD then the change is good, but if it's to aid users with making usable maps from an SLD style, then you're much better doing a conversion to a mm based size! |
The intention is to do the same as createSymbolizerFromSld functions, so it's for exact 1:1 match of SLD. Some enhancements have to be done in the QGIS SLD readers:
|
@nyalldawson do you agree to merge postponing enhancement listed by @rldhont ? |
@aaime FYI in case affect your SLD based workflows (I suppose it does not) |
I don't have a strong opinion either way about this - I just wanted to point out the inherent issue with pixel based units |
SLD indeed works in pixels by default. There are no other screen units, if one wants, it is possible to use ground units, meters or feet, but that has an explicit attribute at the symbolizer level (check the Symbology Encoding extension, look for the "uom" attribute). Ah, about print-outs, both MapServer and GeoServer allow to specify a "DPI" vendor parameter in that case, which ends up rescaling the pixel units and, more importantly, the scale denominators calculation, according to the output DPI. SLD assumes roughly 91dpi by default. It would seem like a useful behavior for QGIS as well (I understand it's out of this PR scope). |
@rldhont so we can't assume pixel as default without checking the context! |
@aaime
What are the available |
Quoting from the Symbology Encoding 1.1 specification:
|
@aaime can you review the code ? |
@rldhont test seems does not cover in case of "uom" but yust default (pixels) https://github.com/qgis/QGIS/pull/33725/files#diff-106be592650b55ccae79c83eecd15cebR4477 |
d39dbc3
to
3a66cd8
Compare
3a66cd8
to
95c3b02
Compare
95c3b02
to
dbb53be
Compare
Description
The SLD unit is pixels so font size unit, buffer unit, offset unit and distance unit have to be set to render pixels unit.
Checklist
Fixes #11111
at the bottom of the commit messagescripts/prepare-commit.sh
script before each commit