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

@capsizecss/metrics missing metrics #119

Open
jlarmstrongiv opened this issue Dec 12, 2022 · 3 comments
Open

@capsizecss/metrics missing metrics #119

jlarmstrongiv opened this issue Dec 12, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@jlarmstrongiv
Copy link

29 Google Fonts at the time of writing are missing the required metrics for capsize.

The required metrics are:

{
    capHeight: 700,
    ascent: 1058,
    descent: -291,
    lineGap: 0,
    unitsPerEm: 1000,
}

The incomplete fonts are:

Abhaya Libre
  missing capHeight
Anaheim
  missing capHeight
Averia Gruesa Libre
  missing capHeight
Averia Libre
  missing capHeight
Averia Sans Libre
  missing capHeight
Averia Serif Libre
  missing capHeight
Bentham
  missing capHeight
Buda Light
  missing capHeight
Cantarell
  missing capHeight
Caudex
  missing capHeight
Coda
  missing capHeight
Coda Caption ExtraBold
  missing capHeight
Coiny
  missing capHeight
Della Respira
  missing capHeight
Gidugu
  missing capHeight
Glegoo
  missing capHeight
Kavivanar
  missing capHeight
Kristi
  missing capHeight
M PLUS 1p
  missing capHeight
Mina
  missing capHeight
News Cycle
  missing capHeight
Oxygen
  missing capHeight
Pavanam
  missing capHeight
Pontano Sans
  missing capHeight
Rounded Mplus 1c
  missing capHeight
Seymour One
  missing capHeight
Six Caps
  missing capHeight
Vibur
  missing capHeight
Yellowtail
  missing capHeight

I checked the actual font tables of an example Averia Serif Libre and found that the capHeight value is missing. What are other ways we can calculate capHeight?

@jlarmstrongiv
Copy link
Author

@michaeltaranto
Copy link
Contributor

Hey 👋 yep Capsize extracts the internal metrics available within the font files, so if there are metrics missing they will not be populated. I have audited the Google Fonts library for both missing and correctness of values and these issues are definitely outliers.

If you are using Typescript, the types are generated and will catch missing metrics at build time.

I have considered populating these (even manually as there are so few) but that will create manual review overhead if the upstream metrics are populated/changed on Google Fonts.

@jlarmstrongiv
Copy link
Author

I have considered populating these (even manually as there are so few) but that will create manual review overhead if the upstream metrics are populated/changed on Google Fonts.

I completely agree, avoiding manual review is key.

If you are using Typescript, the types are generated and will catch missing metrics at build time.

That’s a good start! I wonder if it would be possible to include a smart fallback or if a separate script could generate the metrics for a particularly troublesome fonts missing the cap-height.

Perhaps, it would be possible to measure the cap-height of particular letters. Maybe the letter H or a median/average of the letters BDEFHIKLRTUVXYZ and do a few sanity checks comparing to the ascent.

If you have any suggestions for making the script better or more accurate, please let me know!

@michaeltaranto michaeltaranto added the enhancement New feature or request label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants