-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Center-align all text vertically #5117
Conversation
It doesn't really help. I think the problem is mixing fonts that don't properly center the text in them. We could center on the visual bounds, but the problem with that would be that text would move vertically when you add new letters to a I think the code in this PR is still an improvement. You can tweak the problematic fonts on load with |
EDIT: oh wait i meant to apply that diff to 😮 i really got some different results.. + font_data.insert(
+ "Cantarell".to_owned(),
+ FontData::from_static(include_bytes!("/usr/share/fonts/truetype/Cantarell-VF.otf")),
+ );
families.insert(
FontFamily::Proportional,
vec![
- "Ubuntu-Light".to_owned(),
+ "Cantarell".to_owned(),
"NotoEmoji-Regular".to_owned(),
"emoji-icon-font".to_owned(), and if i remove all the |
Good point… I'll try out your ascent idea in a separate PR then and hold off on this one for a little bit |
861df4f
to
a32f53a
Compare
There is a big downside to using I think there should be a solution to this though, which looks something like this:
I guess I need to do some more experiments… EDIT: actually, the old code didn't do a good job of this either, so this is not necessarily a blocker. It would just be nice to be able to fix it all in one go. |
Ok, I think this is good now! |
* Closes emilk#4929 * Builds on top of emilk#2724 by @lictex (ptal!) * Implement `Center` and `Max` vertical text alignment properly * Change default vertical alignment of text to centering The end result is that text centers better in buttons and other places, especially when mixing in emojis. Before, mixing text of different heights (e.g. emojis and latin text) in a label or button would cause the text to jump vertically. ## Before This is `master`, with custom `FontTweak` to move fonts up and down: <img width="1714" alt="image" src="https://github.com/user-attachments/assets/a10e2927-e824-4580-baea-124c0b38a527"> <img width="102" alt="image" src="https://github.com/user-attachments/assets/cd41f415-197b-42cd-9558-d46d63c21dcb"> ## After This PR, with the default (zero) `FontTweak` <img width="102" alt="image" src="https://github.com/user-attachments/assets/15e7d896-66b1-4996-ab58-dd1850b19a63"> <img width="1714" alt="image" src="https://github.com/user-attachments/assets/54ec708c-7698-4754-b1fc-fea0fd240ec9">
Center
andMax
vertical text alignment properlyThe end result is that text centers better in buttons and other places, especially when mixing in emojis.
Before, mixing text of different heights (e.g. emojis and latin text) in a label or button would cause the text to jump vertically.
Before
This is
master
, with customFontTweak
to move fonts up and down:After
This PR, with the default (zero)
FontTweak