-
-
Notifications
You must be signed in to change notification settings - Fork 710
Description
Incomplete chunks at the end of the line
When using the TextLayout
to render the left-aligned chunkified text, the text doesn't break only at the entire chunks, i.e.:

Expected layout
8208 8811 1111
1111 11
Root cause
TextLayout
uses Spans
to render the individual lines, in particular, the function fit_horizontally
. The issue is that the function goes only character-by-character and doesn't look at the following characters to see if they would complete a chunk at the beginning of another line.
Fix
We would have to predict if the entire chunk fits the line in the function Span::fit_horizontally
Center and Right alignment do not work at all with chunkified text
When using the center alignment, the first chunk is rendered in the middle of the line, the second in the middle of the right half line, ..., until the text doesn't fit.

Severity
The TextLayout
for the centered chunkified text is needed for the Eckhart
's PIN Keyboard screen: Figma. For now, the left alignment is used.
Root cause
The functionTextLayout::layout_text
uses Spans
to render the individual lines. In the normal text, the Span
corresponds to one line, and the alignment works properly. After the end of the span, the span is aligned in the remaining space. In the normal text, the remaining space is the entire line.
But in the case of the chunkified text, one span corresponds to one chunk because the chunk gap has to be rendered. This is also the reason for the strange rendering because:
The remaining space for the first chunk is the entire line, the remaining space for the second chunk is the right half of the line, ...
Fix
The alignment should be done once per line, not after the each Span
is processed.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status