-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
support icon-text-fit with vertical text #8835
Conversation
So that we don't have to rewrite the buffers on every frame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok!, could you leave a comment about this?
This ports support for
icon-text-fit
combined 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-fit
render-tests/text-writing-mode/point_label/mixed-multiline-vertical-horizontal-mode-icon-text-fit
Launch Checklist