Skip to content
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

Merged
merged 7 commits into from
Oct 15, 2019
Merged

Conversation

ansis
Copy link
Contributor

@ansis ansis commented Oct 4, 2019

This ports support for icon-text-fit combined with vertical text. This works with both variable and non-variable placement. fix #8806

A 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

  • briefly describe the changes in this PR
  • post benchmark scores
  • manually test the debug page

@asheemmamoowala asheemmamoowala added this to the release-sangria milestone Oct 7, 2019
Copy link
Contributor

@arindam1993 arindam1993 left a 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.

src/symbol/placement.js Outdated Show resolved Hide resolved
const placedOrientation = this.placedOrientations[symbolInstance.crossTileID];
const verticalHidden = (placedOrientation === WritingMode.horizontal || placedOrientation === WritingMode.horizontalOnly) ? 1 : 0;
const horizontalHidden = placedOrientation === WritingMode.vertical ? 1 : 0;

Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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?

src/symbol/placement.js Outdated Show resolved Hide resolved
src/symbol/placement.js Outdated Show resolved Hide resolved
src/symbol/placement.js Outdated Show resolved Hide resolved
@ansis ansis merged commit 79c3534 into master Oct 15, 2019
@ansis ansis deleted the vertical-icon-text-fit branch October 15, 2019 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

port support for using icon-text-fit with vertical text
3 participants