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

getMetricsForFamily returns null for font families containing multiple spaces (e.g., "IBM Plex Mono") #127

Closed
AleksandrHovhannisyan opened this issue Mar 1, 2023 · 0 comments · Fixed by #128
Labels
bug Something isn't working

Comments

@AleksandrHovhannisyan
Copy link
Contributor

AleksandrHovhannisyan commented Mar 1, 2023

🐛 The bug

I'm trying to read the font metrics for IBM Plex Mono (this issue is actually reproducible with any typeface that has more than one space in its family name), but getMetricsForFamily is returning null. This is because of the following line of code:

https://github.com/danielroe/fontaine/blob/e7391ee7593f4e67dbdcb8fdfd045c5fcc3f9e62/src/metrics.ts#L15

Which should do a global replacement for spaces:

const name = camelCase(family).replace(/ /g, '')

🛠️ To reproduce

N/A (invoke getMetricsForFamily with IBM Plex Mono or any other font family with multiple spaces in its name)

🌈 Expected behaviour

Current behavior: IBM Plex Mono becomes iBMPlex Mono

Expected behavior: IBM Plex Mono becomes iBMPlexMono, allowing us to key in here correctly:

https://github.com/seek-oss/capsize/blob/42d6dc39d58247bc6b9e013a4b1c4463bf287dca/packages/metrics/src/entireMetricsCollection.json#L5842-L5852

ℹ️ Additional context

No response

@AleksandrHovhannisyan AleksandrHovhannisyan added the bug Something isn't working label Mar 1, 2023
AleksandrHovhannisyan added a commit to AleksandrHovhannisyan/fontaine that referenced this issue Mar 1, 2023
AleksandrHovhannisyan added a commit to AleksandrHovhannisyan/fontaine that referenced this issue Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant