seek-oss / capsize

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

createFontStack: Ensure provided `size-adjust` is factored into overrides #199

Closed michaeltaranto closed 2 months ago

michaeltaranto commented 2 months ago

Ensures a custom size-adjust value provided via the fontFaceProperties option is factored into the calculations for the metric overrides.

Example

If a custom size-adjust value is provided:

createFontStack(
  [ merriweatherSans, arial ],
  {
    fontFaceProperties: {
      sizeAdjust: '300%'
    }
  },
)

The resulting metric overrides are now adjusted accordingly:

 @font-face {
   font-family: "Merriweather Sans Fallback";
   src: local('Arial');
-  ascent-override: 92.3409%;
+  ascent-override: 32.8%;
-  descent-override: 25.619%;
+  descent-override: 9.1%;
   line-gap-override: 0%;
   size-adjust: 300%;
 }
changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: 0f0dd7b819282fdf451133b2bd640598abe2d661

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------- | ----- | | @capsizecss/core | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR