seek-oss / capsize

Flipping how we define typography in CSS.

Home Page:https://seek-oss.github.io/capsize/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@capsizecss/metrics missing metrics

jlarmstrongiv opened this issue · comments

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?

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.

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!