Text shaper handling of line trailing whitespace

This is kinda an issue that I'm opening for myself, to remind me to tackle this problem when I can.

In essence, the current line wrapper considers a space at the end of a word as part of the space for that word. This leads center-aligned text to be slightly off-center, as the width of the invisible trailing space character on the line is being included in its width. Additionally, there are pathological layout problems in which a string of text is poorly handled by the shaper because it thinks it cannot fit on any line, but it would actually fit if the trailing space were discarded.

An example of one of those pathological cases can be seen by changing the gioui.org/example/hello program so that the text reads "change and openness; for". Then resize the window to be narrow enough that "openness; " (space included) doesn't fit. Screenshot.

Thanks to ~jonegil for creating the program that made me notice these problems!

Assigned to
5 months ago
5 months ago
No labels applied.