🎥 Make videos programmatically with React
allow strings
Jonny Burger0ec8b32d5bcf
diff --git a/packages/docs/docs/layout-utils/measure-text.md b/packages/docs/docs/layout-utils/measure-text.mdindex 452e01ff25..5e36db0ce9 100644--- a/packages/docs/docs/layout-utils/measure-text.md+++ b/packages/docs/docs/layout-utils/measure-text.md@@ -28,9 +28,9 @@ Same as CSS style `font-family`### `fontSize`-_Required_ _number_+_Required_ _number_ / _string_-Same as CSS style `font-size`. Only _numbers_ allowed, unit `px`+Same as CSS style `font-size`. Since v4.0.125, strings are allowed too, before only numbers.### `fontWeight`diff --git a/packages/layout-utils/src/layouts/measure-text.ts b/packages/layout-utils/src/layouts/measure-text.tsindex 2789c33b8b..ea7f785ac9 100644--- a/packages/layout-utils/src/layouts/measure-text.ts+++ b/packages/layout-utils/src/layouts/measure-text.ts@@ -6,7 +6,7 @@ type Dimensions = {export type Word = {text: string;fontFamily: string;- fontSize: number;+ fontSize: number | string;fontWeight?: number | string;letterSpacing?: string;fontVariantNumeric?: string;@@ -35,7 +35,8 @@ export const measureText = ({node.style.position = 'absolute';node.style.top = `-10000px`;node.style.whiteSpace = 'pre';- node.style.fontSize = `${fontSize}px`;+ node.style.fontSize =+ typeof fontSize === 'string' ? fontSize : `${fontSize}px`;if (fontWeight) {node.style.fontWeight = fontWeight.toString();