unjs / fontaine

Automatic font fallback based on font metrics
MIT License
1.54k stars 23 forks source link

feat!: `size-adjust` metric calculation #181

Closed GitRowin closed 1 year ago

AleksandrHovhannisyan commented 1 year ago

Hi, quick question: Was it intentional to remove the ability to specify multiple fallbacks? Prior to this commit, we could pass in fallbacks as an array, and the code mapped each one under the hood:

https://github.com/danielroe/fontaine/commit/49133794832fe8fecf6f99ffa166150fc4b21a11#diff-9fda4173044ba9935eb8372745516c4f87b84c993369057f66546b231e2e7f78L60

With this PR, that was replaced with a single fallback.

danielroe commented 1 year ago

Yes, this is because the size-adjust calculation has to be the ratio between two fonts. I'd be happy accepting an array again, though this would increase the amount of CSS generated.

AleksandrHovhannisyan commented 1 year ago

Got it. Yeah, I think it would be nice for folks who specify a font stack with multiple fallbacks (e.g., capsize has a createFontStack utility that accepts multiple font metrics). But I can also see how this would be overkill.