-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Icon text fit padding is not applied correctly on SDF images. #15415
Comments
@alexshalamov, from a previous discussion about this implementation in gl-native, you said:
Do you think that’s the explanation for what’s going on here? This screenshot doesn’t contain many labels, but when @fabian-guerra and I were looking at the simulator, it looked like using even edge padding consistently made the bottom padding thinner than the top padding. As you noted, there was variation in the left right padding based on label character length. Ultimately, we concluded that |
@chloekraw Tested with master and padding is calculated correctly. 5px10pxAnd yes, borders may become thicker or thinner if text box changes image's aspect ratio. |
Thanks @alexshalamov. @LukasPaczos can you reproduce on Android? |
@alexshalamov I'm still seeing this issue with master are you using runtime styling and iOS? |
@fabian-guerra I use glfw-app (linux) and padding is set within the style. |
@alexshalamov I'm using runtime styling and double checked the values from iOS where passed correctly to core and I can reproduce this issue on |
I think the issue is also reproducible on Android. In the below example, I added a 5px top and bottom padding using RTS, each box is also 5x5px. You can see that at the top you can fit 2 boxes which would mean that the top padding is twice the size of the bottom one, even though they were set equally to 5px. This would confirm what @fabian-guerra is seeing on iOS, but I'm not sure if my methodology is correct. Can that be related to the glyphs themselves? Can they be offset? |
@LukasPaczos talked with @fabian-guerra, issue could be related to runtime styling, as I cannot reproduce bug when property is set via style json. Will take a look tomorrow. |
Tried to reproduce with style that @fabian-guerra gave me, I can see that padding between text box and icon is correct, however, inside text box glyphs are shifted, that could be due to the other symbol layer properties:
With default style values "layout": {
"icon-image": "plate",
"icon-text-fit": "both",
"text-font": [
"DIN Offc Pro Regular",
"Arial Unicode MS Regular"
],
"symbol-placement": "point",
"icon-text-fit-padding": [10, 10, 10, 10],
"text-field": "垂直ラベル"
}, I get following result: |
Thanks to @alexshalamov @fabian-guerra's thorough investigative efforts, we've confirmed there's no bug in core. The issue is caused by differing font baselines and mapbox/mapbox-gl-js#191 is needed in -native to resolve. Specifically in the OP, there's extra top padding in |
When using a symbol layer with an SDF icon and setting the padding to have an even space e.g.
5, 5, 5, 5
the rendered padding is incorrect.Steps to reproduce
Expected behavior
The rendered symbol should have even padding.
Actual behavior
Configuration
Mapbox SDK versions: 5.2.0
iOS/macOS versions: 12.4
Device/simulator models: iPhone X
Xcode version: 10.3
The text was updated successfully, but these errors were encountered: