-
Notifications
You must be signed in to change notification settings - Fork 35
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
Basic new line support for left to right scripts #712
Conversation
i made the example more interactive. Its pretty fun now. and added a few justification options that we can toggle or remove code for. Screencast.from.2024-04-07.21-18-42.webm |
I think it is worthwhile to add a validation example (screenshot test) to cover the different cases you have supported. Very cool and super useful! Awesome work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work! Exciting to see the text rendering improving on this front 🚀
27bb637
to
5802c12
Compare
6adb0ee
to
1a0d89e
Compare
fa5a656
to
05c8920
Compare
I'm not sure how far I want to push this concept. Text shaping is "hard" the concept of a new line in latin languages (left to right, top to bottom) is something I understand. I cannot say that I really understand right to left languages, nor that I would be able to give meaningful inputs on top to bottom languages. I'm also concerned about just the viability of me writing this for the first time as I am definitely not an expert in this. To be clear, I think that a "new line" is really useful, but I just don't know if I can meaningfully setup good test case even for myself for other writing orientations. |
We can cut off the scope at this point and save the rest for the future. Let's wrap it up nicely and address any remaining code review comments. |
405007f
to
25d2968
Compare
I added:
I noticed that you don't seem to care too much about the git history within the pull request. |
@almarklein can you review this once more in its final state? (I don't know enough about the text rendering subsystems to judge) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work. Great to see a validation example and unit tests!
🚀 |
Thank for you working on the scope and merging this! We are super excited to try this out along in production to help our many aspects of our communication to end users! |
But most of all, thank you for helping teach me all about different aspects of text rendering! |
So my team seemed to need to use newline to set text.
I gave it a go since it seemed easier than to try to always just guess the height of lines.
text_justify
as a new parameter. Options:"hello \nworld"
vs"hello\n world"
vs"hello \nworld"
\r
, (as before, mostly ignored)\f
, (who uses this for real?)\t
(just ignore)outdated comment
I'm not too proud of this, but it does most of the things we need.I'm struggling to choose the best path for the implementation. I'm still trying to understand what things mean:
"\n\n"
means new paragraph."\n"
a forced new line? So if text wraps.I might have to put this on pause while we internally pursue a different approach, but leaving it here for a bit while I give it more thought. It was interesting to learn about fonts by reading your discussion.
xref: #391
Touches on the points:
Performance stats:
generate_glyph: 18.1 ms total 1.81 us per glyph
generate_glyph: 27.8 ms total 2.78 us per glyph
For future work: