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

Support multiline Texts #183

Merged
merged 1 commit into from
Aug 25, 2020
Merged

Conversation

BafDyce
Copy link
Contributor

@BafDyce BafDyce commented Aug 14, 2020

See #182 . Since @karroffel assigned the Bug tag to it I tried to find the cause for it and develop a fix.

Some open questions:

  • Do we also need to add scaled_font.line_gap() to the calculation?
  • Are there other (unicode) symbols which are equivalent to \n (or have a similar function)?
  • Are there any other control characters which we might need to support? (LTR, RTL, etc. ?)

@karroffel karroffel added the C-Feature A new feature, making something new possible label Aug 14, 2020
@karroffel
Copy link
Contributor

(I assigned the "bug" label because I would expect that to work 😄 )

There are more line separators, but with full unicode support and support for non-latin languages I think this might become super complex. Maybe there are layouting crates for displaying text that handle all this properly already?

Your patch seems good to me so far, I am just concerned that in order to deal with text properly a LOT of things need to be in place. I think supporting \n is definitely a good start but maybe we can be on the lookout for existing solutions.

@BafDyce
Copy link
Contributor Author

BafDyce commented Aug 14, 2020

Yeah, I totally agree. Text handling IS super complicated. Maybe we can just merge this one and open a new issue "Proper Text support" or something along the lines. Unfortunately, I'm not really experienced with string/text handling in rust and dont know which crates exist out there either.

@karroffel karroffel added the A-UI Graphical user interfaces, styles, layouts, and widgets label Aug 14, 2020
@cart
Copy link
Member

cart commented Aug 14, 2020

ab_glyph (the text library we use) has a simple paragraph layout example (which does use line_gap):
https://github.com/alexheretic/ab-glyph/blob/master/dev/src/layout.rs

We should probably also use that. This does seem like a good start and I'm fine making "full multiline support" an iterative process. I'll give this a full review soon.

@cart
Copy link
Member

cart commented Aug 25, 2020

I'm going to merge this for now. Its a usability win and we can sort out line height later.

@cart cart merged commit 7b4bdef into bevyengine:master Aug 25, 2020
BimDav pushed a commit to BimDav/bevy that referenced this pull request Aug 26, 2020
@Moxinilian Moxinilian mentioned this pull request Nov 23, 2020
@DJMcNab
Copy link
Member

DJMcNab commented Jul 6, 2021

@BafDyce We need you to respond in #2373 because of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants