-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
enable size-adjust
metric calculation
#8
Comments
I think you can improve the horizontal mismatch, but not solve it. Looking at the "On Font Width..." section at the bottom of this notes on calculating font metric overrides document, because the width of each character contributes a different amount to the width of the line, the In this example, you can see how size-adjust can make the fallback font match up exactly for the configured text value, "abcdefghijklmnopqrstuvwxyz": But for different text content, that size adjustment will no longer match so perfectly: |
That is correct. As the document says:
Nevertheless, it offers a real improvement 😉 |
As far as I understand Next 13 just implemented this too 😄 https://twitter.com/Una/status/1584967596847542272 |
This is fundamentally an awesome idea. My bet is that in the long run, what fontaine and Next are doing becomes native browser functionality in some way |
FYI - For anyone who cares about the CLS core web vital on mobile, |
I use Malte Ubl's tool here to get my size-adjust calculations: https://www.industrialempathy.com/perfect-ish-font-fallback/. Source code here: https://www.industrialempathy.com/perfect-ish-font-fallback/font.js (NOTE: not open source, likely copyrighted). I admittedly don't follow the logic for /* Make a custom fallback font based on the local Arial */
@font-face {
font-family: "Fira Sans-fallback";
size-adjust: 102.59%;
src: local("Arial");
} Metrics: "arial": {
"familyName": "Arial",
"category": "sans-serif",
"capHeight": 1467,
"ascent": 1854,
"descent": -434,
"lineGap": 67,
"unitsPerEm": 2048,
"xHeight": 1062,
"xWidthAvg": 904
},
"firaSans": {
"familyName": "Fira Sans",
"category": "sans-serif",
"capHeight": 689,
"ascent": 935,
"descent": -265,
"lineGap": 0,
"unitsPerEm": 1000,
"xHeight": 527,
"xWidthAvg": 458
},
But it's unclear what "matching ex heights" means in terms of the computations. |
BTW, @danielroe, I started using |
implemented in #181! |
Currently we can use metrics to adjust vertical height accurately. There's still a horizontal mismatch though, even if slight, and we can likely solve this by applying the right metrics to
size-adjust
.The text was updated successfully, but these errors were encountered: