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

feat(reason-skia): bind to FontMetrics char width functions #904

Merged
merged 1 commit into from
Jun 8, 2020

Conversation

zbaylin
Copy link
Member

@zbaylin zbaylin commented Jun 8, 2020

This is a really small change that just adds two functions from FontMetrics: the average character width and the maximum character width. These functions make it easy to test if a loaded font is monospace through

FontMetrics.avgCharacterWidth(metrics) == FontMetrics.maxCharacaterWidth(metrics)

I tested this with Consolas and it worked. Fortunately it also worked with FiraCode (I was worried that maybe the ligatures would register strangely).

Copy link
Member

@glennsl glennsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@bryphe bryphe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! This seems more reliable than the current strategy we're using in Onivim (test a couple of big chacaters)

@zbaylin zbaylin merged commit 5a6c200 into master Jun 8, 2020
@Et7f3 Et7f3 deleted the feat/reason-skia/char-widths branch June 16, 2020 16:39
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.

3 participants