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

Function formatSlantValue

packages/core/src/utils/style.ts:38–46  ·  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 // OpenType slnt and CSS oblique use opposite signs; reverse the endpoints too.
40 const min = Number(axis.min);
41 const max = Number(axis.max);
42 const minDegrees = -max;
43 const maxDegrees = -min;
44
45 return min === max ? `${minDegrees}deg` : `${minDegrees}deg ${maxDegrees}deg`;
46};
47
48export const findClosestWeight = (weights: number[], target = 400): number => {
49 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