Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

explain why we need this function

Oleg Isonenfa81279c94c7
diff --git a/packages/fonts/src/font-data.ts b/packages/fonts/src/font-data.ts
index d582b8738b..6c2c2d2d5e 100644
--- a/packages/fonts/src/font-data.ts
+++ b/packages/fonts/src/font-data.ts
@@ -34,6 +34,8 @@ export const parseSubfamily = (subfamily: string) => {
return { style, weight: Number(weight) };
};
+// Family name can contain additional information like "Roboto Black" or "Roboto Bold", though we need pure family name, because the rest is already encoded in weight and style.
+// We need a name we can reference in CSS font-family property, while CSS matches it with the right font-face considering the weight and style.
export const normalizeFamily = (family: string, subfamily: string) => {
let simplifiedFamily = family;
subfamily