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

SDF Text Layout Refactor #223

Open
frank-weindel opened this issue Mar 29, 2024 · 1 comment
Open

SDF Text Layout Refactor #223

frank-weindel opened this issue Mar 29, 2024 · 1 comment
Milestone

Comments

@frank-weindel
Copy link
Collaborator

frank-weindel commented Mar 29, 2024

The Text Layout engine for the SDF Text Renderer definitely needs a serious rework. The way the code, mostly in layoutText.ts is structured is brittle, difficult to understand, relies on hacks and is prone to infinite loops (see #220). But it also comes with certain functional limitations that aren't easy to resolve with the way the code is currently structured.

Overflow Suffix Limitation

There are at least a few issues with how the overflow suffix (i.e. the truncating "..." sequence) is placed, when contain is set to 'both':

  • If a single word, at the beginning of a line, can't fit on a line it is not truncated
  • The mechanism that tries to make sure a suffix fits at the end of a line can truncate text that fits the line pefectly.
  • Overflow suffix may bleed off the edge of the contained box width.

Solution

The solution is a refactor that simplifies the code flow and allows for more intelligent calculation/placement of the overflow suffix.

github-merge-queue bot pushed a commit that referenced this issue Mar 29, 2024
Another hack to prevent an infinite loop situation that was introduced
in v0.8.0.

I've written up an issue to address more wholistically the issues with
the SDF layout engine
- #223

Fixes #220
@wouterlucas wouterlucas added this to the Release Candidate 1 milestone Apr 3, 2024
@elsassph
Copy link
Contributor

elsassph commented Apr 5, 2024

Worth also removing the overly complex "text state" system with dynamic properties overriding. A simpler object with a dirty flag would be better as it's not directly exposed to library users.

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

No branches or pull requests

3 participants