Skip to content

SDF Text Layout Refactor #223

@frank-weindel

Description

@frank-weindel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions