-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Better visual centering of text #8320
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
Conversation
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.
|
That's the browser default font, right? If I draw a single line of text, and draw a straight line at the y value I want my text centered at, on this PR it looks like this:
Whereas previously it looked like this, which seems less centered: Live version to test it out: https://editor.p5js.org/davepagurek/sketches/DJt2049Qn To me, the above looks much more like the text is centered at the line I draw. For multi lines, it does look less centered with these changes:
So maybe this is telling me that there's something happening in the single line case that's becoming a problem? Single line is a tad different because |
|
I think either of those for the default font is good for me, but for other fonts it gets quite offset. Ideally I'd want it halfway between the alphabetic baseline and the caps height. This PR doesnt do that perfectly, definitely open to more suggestions there. |
|
as a bonus, the existing screenshots on dev-2.0 for text alignment seem to work, because this new iteration seems to leave more fonts aligned how they were before, while updating the problematic ones. |
ksen0
left a comment
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.
Thanks for the helpful overview table! Very minor/optional: is there a visual test that can be added to prevent regression? Because the arithmetic of yOff is more complex now / includes a helper





























Resolves #8319
Changes:
Screenshots of the change:
PR Checklist
npm run lintpasses