seek-oss / capsize

Flipping how we define typography in CSS.
https://seek-oss.github.io/capsize/
MIT License
1.51k stars 37 forks source link

createFontStack returns incorrect values for fonts with the same metrics #136

Closed KelvinOm closed 1 year ago

KelvinOm commented 1 year ago

We use appleSystem and BlinkMacSystemFont metrics to create a font stack.

createFontStack([appleSystem, BlinkMacSystemFont])

Calling this method returns this

@font-face {
  font-family: "-apple-system Fallback";
  src: local('BlinkMacSystemFont');
  ascent-override: 95.2148%;
  descent-override: 20.5078%;
}

Both fonts have the same meters(here and here) and the return value should not have ascent-override and descent-override styles. The calculation of these parameters is performed by this code. I think that there should be a check of metrics and if the values match, then we should not calculate ascent-override and descent-override parameters.

michaeltaranto commented 1 year ago

Thanks for raising this, let me take a look and loop back.

michaeltaranto commented 1 year ago

Fix published in @capsizecss/core@3.1.1

Thanks again