MCPcopy Create free account
hub / github.com/fontsource/fontsource / formatSlantValue

Function formatSlantValue

packages/core/src/utils/style.ts:38–47  ·  view source on GitHub ↗
(axis: VariableFontAxis)

Source from the content-addressed store, hash-verified

36 : `${axis.min}% ${axis.max}%`;
37
38export const formatSlantValue = (axis: VariableFontAxis): string => {
39 const min = Number(axis.min);
40 const max = Number(axis.max);
41 const minDegrees = Math.abs(min);
42 const maxDegrees = Math.abs(max);
43
44 return min === max
45 ? `${minDegrees}deg`
46 : `${Math.min(minDegrees, maxDegrees)}deg ${Math.max(minDegrees, maxDegrees)}deg`;
47};
48
49export const findClosestWeight = (weights: number[], target = 400): number => {
50 if (weights.length === 0) return target;

Callers 3

extractFontStyleFunction · 0.90
getFaceStyleFunction · 0.90
utils.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected