@capsizecss/core
4.1.3 · 12 Nov 2025MIT205.9k / weekRepositoryHomepagenpmAtom feed
8 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 4.x · latest line
4.1.2
8 May 2024createFontStack: Prefer
postscriptNameorfullNamefor fallback sourceThe
@font-facedeclaration aliases generated bycreateFontStacknow favourpostscriptNameandfullNameoverfamilyNamefrom the provided metrics when selecting a local font face as a fallback.MDN recommends using either
fullNameandpostscriptNamewhen accessing local fonts to ensure the best matching across platforms, while also enabling selection of a single font face within a larger family, e.g.Arial BoldorArial-BoldMTwithinArial.
For details see MDN.⚠️ Note: Falling back to
familyName(original behaviour) makes this work backwards compatible with older versions of font metrics.
4.1.1
5 May 2024createFontStack: Apply
line-gap-overridewith nolineGapin preferred fontEnsure that the
line-gap-overrideproperty is applied correctly when overriding a fallback font with a web font that has nolineGap.
Previously if the override was zero it would be omitted from the declaration, rather than the correct behaviour of overriding the fallback metric to zero.createFontStack: Ensure provided `size-adjust` is factored into metric overrides
Ensures a custom
size-adjustvalue provided via thefontFacePropertiesoption is factored into the calculations for the metric overrides.
4.1.0
8 Mar 2024xWidthAvg: Add
subsetsupport for non-latin character setsPreviously the
xWidthAvgmetric was calculated based on the character frequency as measured from English text only.
This resulted in thexWidthAvgmetric being incorrect for languages that use a different unicode subset range, e.g. Thai.Supporting Thai now enables adding support for other unicode ranges in the future.
4.0.0
16 Feb 2024- Breaking
Precompile Capsize packages with [Crackle]
Migrating Capsize packages to be precompiled with [Crackle], with a key change being Crackle now handles entry points instead of [Preconstruct].
Other benefits include:
createFontStack: Append original fallback font name to the font stack
The
fontFamilyreturned fromcreateFontStacknow includes the original fallback font name(s). These are appended to the end of the font stack in the case the preferred font and generated fallbacks are not available.import lobster from '@capsizecss/metrics/lobster'; import arial from '@capsizecss/metrics/arial'; const { fontFamily } = createFontStack([lobster, arial]);Where
fontFamilyis now:- `Lobster, 'Lobster Fallback: Arial'` + `Lobster, 'Lobster Fallback: Arial', Arial`
createFontStack: Quote
font-familyin@font-facedeclaration if neededPreviously, when using
fontFaceFormat: 'styleObject', the generated fallback name was not quoted as necessary within the@font-facedeclaration.
This could cause issues if the font family name contained spaces or other characters that required quoting.
- 3.x
3.1.1
7 Jun 2023createFontStack: Apply metric overrides conditionally
Addresses an issue where metric overrides would be applied for fonts with the same metric values.
Theascent-override,descent-overrideandline-gap-overrideproperties are now all conditional, only returned when the metrics differ between the preferred font and its fallback(s).
3.1.0
31 Jan 2023Add
createFontStackfor metrics-based font family fallbacks.Creates metrics-based
@font-facedeclarations to improve the alignment of font family fallbacks, which can dramatically improve the Cumulative Layout Shift metric for sites that depend on a web font.Add additional properties to
FontMetricstype definition.Previously the
FontMetricstype captured only the metrics required by the options for thecreateStyleObjectandcreateStyleStringAPIs.
With additional APIs coming that require a different subset of metrics, the type now reflects the structure of the data from themetricspackage.The additional properties are:
familyName,category,xHeightandxWidthAvg.
See documentation for more details.
3.0.0
23 Aug 2021- Breaking
The
capsizepackage has been moved to its own organisation on npm called@capsizecss. This will allow an official ecosystem of tooling to be added over time.
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.