MCPcopy Index your code
hub / github.com/fontsource/fontsource / getVariableAxisKeys

Function getVariableAxisKeys

packages/core/src/utils/variable.ts:52–73  ·  view source on GitHub ↗
(
	variableConfig: VariableAxisConfig,
)

Source from the content-addressed store, hash-verified

50 * Return every published axis key from a variable font config.
51 */
52export const getVariableAxisKeys = (
53 variableConfig: VariableAxisConfig,
54): VariableAxisKey[] => {
55 // Filter out any inactive axes and `ital` since it's always included.
56 const direct = Object.keys(variableConfig).filter(
57 (axisKey) => axisKey !== 'ital' && Boolean(variableConfig[axisKey]),
58 );
59
60 const axisKeys = new Set(direct);
61 const standardAxes = direct.filter((key) => STANDARD_PUBLISHED_AXES.has(key));
62 const customAxes = direct.filter((key) => !STANDARD_PUBLISHED_AXES.has(key));
63
64 if (standardAxes.length > 1) {
65 axisKeys.add('standard');
66 }
67
68 if (customAxes.length > 0) {
69 axisKeys.add('full');
70 }
71
72 return Array.from(axisKeys);
73};
74
75/** Return the published CSS `font-style` for one axis key variant. */
76export const getFaceStyle = (

Callers 3

utils.test.tsFile · 0.90
selectVariableAxisKeyFunction · 0.85
getRequestedAxisKeysFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected