Packages

@capsizecss/metrics

4.5.0 · 17 Nov 2026MIT472.5k / weekRepositorynpmAtom feed

Your version

0.2.0

23 Mar 2022Where it was published

0.4.0 is the newest release of 0.2.x.

In short

1 new2 fixed

Release note

Minor Changes

  • Expose xHeight metadata when available

  • metrics: Ensure generated types reflect extracted metadata

    The constructed types will now align with the metadata available from the font itself. This will ensure that TypeScript consumers receieve build time feedback for incomplete metrics, allowing manual overrides to complete the required FontMetric data.

Example

When the font metadata does not include a `capHeight`:

```js
{
  familyName: 'My Incomplete Font',
  ascent: 860,
  descent: -348,
  lineGap: 0,
  unitsPerEm: 1024
}
```

TypeScript will now error when providing the metrics, rather than accepting them and rendering incorrectly.

```ts
import myIncompleteFontMetrics from '@capsizecss/metrics/myIncompleteFont';
import { createStyleObject } from '@capsizecss/core';

createStyleObject({
  fontSize: 16,
  leading: 24,
  // Errors with incomplete metrics, missing `capHeight`
  fontMetrics: myIncompleteFontMetrics,
});
```

This allows consumers to resolve missing values and complete the contract.

```ts
createStyleObject({
  fontSize: 16,
  leading: 24,
  // Error can be resolved by providing a manual override
  fontMetrics: {
    ...myIncompleteFontMetrics,
    capHeight: 594,
  },
});
```

Resolving missing data

Resolving manual overrides can be done via the [Capsize website](https://seek-oss.github.io/capsize/). After selecting or uploading the font, use the `Edit` button at the end of `Step 1`.

Patch Changes

  • metrics: Update Google Fonts to latest

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.