support icon-text-fit with vertical text - #8835
Conversation
So that we don't have to rewrite the buffers on every frame.
arindam1993
left a comment
There was a problem hiding this comment.
LGTM except for some code duplication.
| const placedOrientation = this.placedOrientations[symbolInstance.crossTileID]; | ||
| const verticalHidden = (placedOrientation === WritingMode.horizontal || placedOrientation === WritingMode.horizontalOnly) ? 1 : 0; | ||
| const horizontalHidden = placedOrientation === WritingMode.vertical ? 1 : 0; | ||
|
|
There was a problem hiding this comment.
Do we need an assertion here that both verticalHidden and horizontalHidden are not 0.
horizontallHidden can also be !verticalHidden, right? since we have 3 writing modes
There was a problem hiding this comment.
That made sense to me but I tried this and it turns out they can both be 0. Switching between vertical and horizontal glyphs happens in updateLineLabels(...) in symbol/projection.js and both versions need to be not hidden for that to work. It relies on a placedOrientation not being set for line labels. This is pretty tricky and it would be great to try to clean this up but it's out of the scope of this pr
There was a problem hiding this comment.
Ah ok!, could you leave a comment about this?
This ports support for
icon-text-fitcombined with vertical text. This works with both variable and non-variable placement. fix #8806A second vertical icon is added to the buffers along with a second vertical icon collision box. Then at placement time it selects the correct icon depending on which version of text it ended up placing.
Vertical text used to be toggled by updating the vertex buffers every frame. I switched this so that it just uses the opacity that only gets updated whenever placement is done. This is simpler and faster.
This enables
render-tests/text-writing-mode/point_label/cjk-variable-anchors-vertical-horizontal-mode-icon-text-fitrender-tests/text-writing-mode/point_label/mixed-multiline-vertical-horizontal-mode-icon-text-fitLaunch Checklist