Use a line-height of 1.3x for the default text styles #587
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It looks like Swing uses a line height that is 1.3 times the font size, but that is not expressed anywhere I could find. I got the value by experimentation and pixel counting, like a proper DF review would 🙃 Using this value seems to work at both default and h[0-5] text sizes.
Having a non-default line height is a bit of a pain for users, since they need to remember updating the line height too when they customize the font size in a text style; however, we can't do anything about it, and in general, folks should stick to the predefined text styles.
To help, we now provide a
TextStyle.copyWithSize()
function that automatically sets the correct line height, making this slightly less painful.Comparison between Swing (top) and Compose (bottom):
The difference is subtle, but it's there. I pixel counted and they match exactly with Swing (with a 1px tolerance on bigger text sizes) across all predefined text styles.
This closes #585