Skip to content

🎥 Make videos programmatically with React

add fontVariantNumeric

Jonny Burger4ab817ce553b
diff --git a/packages/docs/docs/layout-utils/fill-text-box.md b/packages/docs/docs/layout-utils/fill-text-box.md
index 4b0ca5368f..8db1acd8f3 100644
--- a/packages/docs/docs/layout-utils/fill-text-box.md
+++ b/packages/docs/docs/layout-utils/fill-text-box.md
@@ -4,7 +4,7 @@ title: fillTextBox()
crumb: "@remotion/layout-utils"
---
-_Available from v4.0.54_
+## fillTextBox()<AvailableFrom v="4.0.57"/>
_Part of the [`@remotion/layout-utils`](/docs/layout-utils) package._
@@ -28,11 +28,9 @@ The max lines of the box.
## Return value
-An object with an `add` method, which can be used to add words to the text box.
+An object with an `add()` method, which can be used to add words to the text box.
-### `add`
-
-Arguments:
+### Arguments
#### `text`
@@ -58,6 +56,12 @@ _string_
Same as CSS style `font-weight`.
+#### `fontVariantNumeric`
+
+_string_
+
+Same as CSS style `font-variant-numeric`.
+
### Return value
The add method returns an object with two properties:
diff --git a/packages/layout-utils/src/layouts/fill-text-box.ts b/packages/layout-utils/src/layouts/fill-text-box.ts
index 3ba5624480..dbc56b00c7 100644
--- a/packages/layout-utils/src/layouts/fill-text-box.ts
+++ b/packages/layout-utils/src/layouts/fill-text-box.ts
@@ -16,6 +16,7 @@ export const fillTextBox = ({
fontWeight,
fontSize,
letterSpacing,
+ fontVariantNumeric,
}: Word): {
exceedsBox: boolean;
newLine: boolean;
@@ -32,7 +33,14 @@ export const fillTextBox = ({
const lineWithWord: Word[] = [
...lineToUse,
- {text, fontFamily, fontWeight, fontSize, letterSpacing},
+ {
+ text,
+ fontFamily,
+ fontWeight,
+ fontSize,
+ letterSpacing,
+ fontVariantNumeric,
+ },
];
const widths = lineWithWord.map((w) => measureText(w).width);
@@ -45,6 +53,7 @@ export const fillTextBox = ({
fontWeight,
fontSize,
letterSpacing,
+ fontVariantNumeric,
});
return {exceedsBox: false, newLine: false};
@@ -61,6 +70,7 @@ export const fillTextBox = ({
fontWeight,
fontSize,
letterSpacing,
+ fontVariantNumeric,
},
];
return {exceedsBox: false, newLine: true};