@remotion/layout-utils 4.0.290 → 4.0.291
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,5 +19,5 @@ export type Word = {
|
|
|
19
19
|
validateFontIsLoaded?: boolean;
|
|
20
20
|
additionalStyles?: ModifyableCSSProperties;
|
|
21
21
|
} & CSSPropertiesOnWord;
|
|
22
|
-
export declare const measureText: ({ text, fontFamily, fontSize, fontWeight, letterSpacing, fontVariantNumeric, validateFontIsLoaded, additionalStyles, }: Word) => Dimensions;
|
|
22
|
+
export declare const measureText: ({ text, fontFamily, fontSize, fontWeight, letterSpacing, fontVariantNumeric, validateFontIsLoaded, additionalStyles, textTransform, }: Word) => Dimensions;
|
|
23
23
|
export {};
|
|
@@ -47,8 +47,8 @@ const takeMeasurement = ({ text, fontFamily, fontSize, fontWeight, letterSpacing
|
|
|
47
47
|
* @description Calculates the width and height of specified text to be used for layout calculations. Only works in the browser, not in Node.js or Bun.
|
|
48
48
|
* @see [Documentation](https://remotion.dev/docs/layout-utils/measure-text)
|
|
49
49
|
*/
|
|
50
|
-
const measureText = ({ text, fontFamily, fontSize, fontWeight, letterSpacing, fontVariantNumeric, validateFontIsLoaded, additionalStyles, }) => {
|
|
51
|
-
const key = `${text}-${fontFamily}-${fontWeight}-${fontSize}-${letterSpacing}-${JSON.stringify(additionalStyles)}`;
|
|
50
|
+
const measureText = ({ text, fontFamily, fontSize, fontWeight, letterSpacing, fontVariantNumeric, validateFontIsLoaded, additionalStyles, textTransform, }) => {
|
|
51
|
+
const key = `${text}-${fontFamily}-${fontWeight}-${fontSize}-${letterSpacing}-${textTransform}-${JSON.stringify(additionalStyles)}`;
|
|
52
52
|
if (wordCache.has(key)) {
|
|
53
53
|
return wordCache.get(key);
|
|
54
54
|
}
|
|
@@ -60,6 +60,7 @@ const measureText = ({ text, fontFamily, fontSize, fontWeight, letterSpacing, fo
|
|
|
60
60
|
fontWeight,
|
|
61
61
|
letterSpacing,
|
|
62
62
|
additionalStyles,
|
|
63
|
+
textTransform,
|
|
63
64
|
});
|
|
64
65
|
if (validateFontIsLoaded && text.trim().length > 0) {
|
|
65
66
|
const { boundingBox: boundingBoxOfFallbackFont, computedFontFamily: computedFallback, } = takeMeasurement({
|
|
@@ -70,6 +71,7 @@ const measureText = ({ text, fontFamily, fontSize, fontWeight, letterSpacing, fo
|
|
|
70
71
|
fontWeight,
|
|
71
72
|
letterSpacing,
|
|
72
73
|
additionalStyles,
|
|
74
|
+
textTransform,
|
|
73
75
|
});
|
|
74
76
|
const sameAsFallbackFont = boundingBox.height === boundingBoxOfFallbackFont.height &&
|
|
75
77
|
boundingBox.width === boundingBoxOfFallbackFont.width;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -57,9 +57,10 @@ var measureText = ({
|
|
|
57
57
|
letterSpacing,
|
|
58
58
|
fontVariantNumeric,
|
|
59
59
|
validateFontIsLoaded,
|
|
60
|
-
additionalStyles
|
|
60
|
+
additionalStyles,
|
|
61
|
+
textTransform
|
|
61
62
|
}) => {
|
|
62
|
-
const key = `${text}-${fontFamily}-${fontWeight}-${fontSize}-${letterSpacing}-${JSON.stringify(additionalStyles)}`;
|
|
63
|
+
const key = `${text}-${fontFamily}-${fontWeight}-${fontSize}-${letterSpacing}-${textTransform}-${JSON.stringify(additionalStyles)}`;
|
|
63
64
|
if (wordCache.has(key)) {
|
|
64
65
|
return wordCache.get(key);
|
|
65
66
|
}
|
|
@@ -70,7 +71,8 @@ var measureText = ({
|
|
|
70
71
|
fontVariantNumeric,
|
|
71
72
|
fontWeight,
|
|
72
73
|
letterSpacing,
|
|
73
|
-
additionalStyles
|
|
74
|
+
additionalStyles,
|
|
75
|
+
textTransform
|
|
74
76
|
});
|
|
75
77
|
if (validateFontIsLoaded && text.trim().length > 0) {
|
|
76
78
|
const {
|
|
@@ -83,7 +85,8 @@ var measureText = ({
|
|
|
83
85
|
fontVariantNumeric,
|
|
84
86
|
fontWeight,
|
|
85
87
|
letterSpacing,
|
|
86
|
-
additionalStyles
|
|
88
|
+
additionalStyles,
|
|
89
|
+
textTransform
|
|
87
90
|
});
|
|
88
91
|
const sameAsFallbackFont = boundingBox.height === boundingBoxOfFallbackFont.height && boundingBox.width === boundingBoxOfFallbackFont.width;
|
|
89
92
|
if (sameAsFallbackFont && computedFallback !== computedFontFamily) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/layout-utils"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/layout-utils",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.291",
|
|
7
7
|
"description": "Utilities for working with layouts",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"eslint": "9.19.0",
|
|
23
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
23
|
+
"@remotion/eslint-config-internal": "4.0.291"
|
|
24
24
|
},
|
|
25
25
|
"author": "Yehor Misiats (https://github.com/satelllte)",
|
|
26
26
|
"maintainers": [
|