Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Better line-breaking support for bidirectional text #7112

Closed
ChrisLoer opened this issue Nov 17, 2016 · 1 comment
Closed

Better line-breaking support for bidirectional text #7112

ChrisLoer opened this issue Nov 17, 2016 · 1 comment
Assignees
Labels
Core The cross-platform C++ core, aka mbgl text rendering

Comments

@ChrisLoer
Copy link
Contributor

Our current line-breaking algorithm has a naive approach to handling text that isn't fully Left-to-Right: if the "base" direction of a label is Right-to-Left instead of LTR, it breaks lines upwards instead of downwards. This is broken two ways:

  • If a label starts with RTL text but contains an embedded LTR string with a line break, the two LTR lines will appear in the opposite of the expected order.
  • If a label with multiple lines of RTL text also has an icon, the RTL text can overlay the icon.

The fix is to break our application of the bidirectional algorithm and Arabic shaping into two passes. In the first pass, we perform bidirectional layout and shaping on the entire label as one line. After performing shaping, we go through the line to choose line break points. On the second pass, we reapply the bidirectional algorithm with the line break points pre-set in order to get the correct behavior for line breaks of embedded LTR/RTL text.

@ChrisLoer ChrisLoer self-assigned this Nov 17, 2016
@1ec5 1ec5 added Core The cross-platform C++ core, aka mbgl text rendering labels Nov 19, 2016
@1ec5 1ec5 changed the title [core] Better line-breaking support for bidirectional text Better line-breaking support for bidirectional text Nov 19, 2016
@ChrisLoer
Copy link
Contributor Author

Closed with #7123

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl text rendering
Projects
None yet
Development

No branches or pull requests

2 participants