-
Notifications
You must be signed in to change notification settings - Fork 88
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
Line wrapping/text reflow does not respect buffer size #219
Comments
Did a little investigation here, It looks like this example uncovers two possible issues with layout: It looks like cosmic-text should treat wrapping mode as 'best case' like the web. When Second, I have no idea why your example has an empty run. (Latest master branch)
|
Awesome, I also discovered the empty run (due to unwrapping the first and last glyphs to measure width).
However, the wrapping that I've seen overruns on are not due to insufficient space for a word, visibly, there is a solution where no overruns occur as there is plenty of horizontal space for multiple words, and large enough vertical space for it to wrap more lines. |
Absolutely, I am developing a UI framework https://github.com/ten3roberts/violet, which is where I discovered it. I can push out a branch with an isolating example of a text block being wrapped. The renderer that consumes the text is rather primitive at the moment, and contained in |
Edit: Glyph fallback and empty run fix is merged into master now. I'll look into this overflow one as soon as I can repro it. |
I have noticed that the buffer size set by
Buffer.set_size
is not always respected by the line wrapping, but overruns slightly, usually by the half end of the word.I can reproduce this with varying texts and fonts, and discovered this when writing my GUI library which needs to limit text sizes to fit.
I have managed to find the minimal repro.
The code has the same effect if you measure the distance between the first and last glyph, so
line_w
is correct. Rendering the text also shows that it overflows despite having vertical space to wrap.The text was updated successfully, but these errors were encountered: