diff --git a/src/css/render.ts b/src/css/render.ts index e07d05b..747b328 100644 --- a/src/css/render.ts +++ b/src/css/render.ts @@ -31,7 +31,7 @@ export async function generateFontFallbacks (family: string, data: NormalizedFon for (const fallback of fallbacks) { css.push(generateFallbackFontFace(metrics, { ...fallback, - metrics: await getMetricsForFamily(fallback.name) || undefined + metrics: await getMetricsForFamily(fallback.font) || undefined })) } return css diff --git a/test/basic.test.ts b/test/basic.test.ts index f9b443a..d3dc170 100644 --- a/test/basic.test.ts +++ b/test/basic.test.ts @@ -120,9 +120,9 @@ describe('features', () => { "@font-face { font-family: "Lato Fallback: Arial"; src: local("Arial"); - size-adjust: 100%; - ascent-override: 98.7%; - descent-override: 21.3%; + size-adjust: 97.4159%; + ascent-override: 101.3181%; + descent-override: 21.865%; line-gap-override: 0%; }", ] @@ -132,9 +132,9 @@ describe('features', () => { "@font-face { font-family: "Nunito Fallback: Arial"; src: local("Arial"); - size-adjust: 100%; - ascent-override: 101.1%; - descent-override: 35.3%; + size-adjust: 101.7204%; + ascent-override: 99.3901%; + descent-override: 34.703%; line-gap-override: 0%; }", ] @@ -148,9 +148,9 @@ describe('features', () => { "@font-face { font-family: "Oswald Fallback: Times New Roman"; src: local("Times New Roman"); - size-adjust: 100%; - ascent-override: 119.3%; - descent-override: 28.9%; + size-adjust: 90.5221%; + ascent-override: 131.791%; + descent-override: 31.9259%; line-gap-override: 0%; }", ] @@ -160,9 +160,9 @@ describe('features', () => { "@font-face { font-family: "Fredoka Fallback: Tahoma"; src: local("Tahoma"); - size-adjust: 100%; - ascent-override: 97.4%; - descent-override: 23.6%; + size-adjust: 101.2772%; + ascent-override: 96.1717%; + descent-override: 23.3024%; line-gap-override: 0%; }", ] diff --git a/test/parse.test.ts b/test/parse.test.ts index 104661b..6a1e244 100644 --- a/test/parse.test.ts +++ b/test/parse.test.ts @@ -23,9 +23,9 @@ describe('parsing', () => { "@font-face { font-family: "Open Sans Fallback: Times New Roman"; src: local("Times New Roman"); - size-adjust: 100%; - ascent-override: 106.8848%; - descent-override: 29.2969%; + size-adjust: 116.6056%; + ascent-override: 91.6635%; + descent-override: 25.1248%; line-gap-override: 0%; } @@ -82,19 +82,19 @@ describe('parsing', () => { "@font-face { font-family: "Poppins Fallback: Arial"; src: local("Arial"); - size-adjust: 100%; - ascent-override: 105%; - descent-override: 35%; - line-gap-override: 10%; + size-adjust: 113.7274%; + ascent-override: 92.326%; + descent-override: 30.7753%; + line-gap-override: 8.793%; } @font-face { font-family: "Poppins Fallback: Times New Roman"; src: local("Times New Roman"); - size-adjust: 100%; - ascent-override: 105%; - descent-override: 35%; - line-gap-override: 10%; + size-adjust: 125.5306%; + ascent-override: 83.6449%; + descent-override: 27.8816%; + line-gap-override: 7.9662%; } @font-face {