Skip to content
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

Improve handling of fractional width fonts #525

Merged
merged 1 commit into from
Jul 6, 2022

Conversation

citizenmatt
Copy link
Member

The default font for the corretto-11 JDK (at least on my Mac) is Menlo 12 point. This results in nice 8 pixel character widths and integer maths. If jbr-11 is used, the font is JetBrains Mono 13 point, which has characters that are 7.8 pixels wide (I don't know why a larger font has a smaller pixel side, but that's not really the problem here).

Most APIs to work with editor positions uses integers, which can cause rounding errors. I don't think this caused any obvious issues in production - possibly some minor off-by-one (or two) errors in column positioning, but it does cause issues with tests, where we need reproducibility.

This PR updates EditorHelper to overcome rounding errors in scrolling, and updates tests to correctly calculate expected offsets. Tests now run on both corretto-11 and jbr-11.

@AlexPl292
Copy link
Member

Fonts:
Me previously: It's about how fancy you can draw a letter.
Me now: MATH

Thank you for the fix :)

@AlexPl292 AlexPl292 merged commit 62632a4 into JetBrains:master Jul 6, 2022
@citizenmatt citizenmatt deleted the jbr-fractional-font-fixes branch July 6, 2022 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants