@remotion/layout-utils 4.0.358 → 4.0.362

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.
@@ -26,7 +26,7 @@ const fitTextOnNLines = ({ text, maxLines, maxBoxWidth, fontFamily, fontWeight,
26
26
  const lines = [''];
27
27
  for (const word of words) {
28
28
  const result = textBox.add({
29
- text: word + ' ',
29
+ text: lines[currentLine].length === 0 ? word : ' ' + word,
30
30
  fontFamily,
31
31
  fontWeight,
32
32
  fontSize,
@@ -56,6 +56,9 @@ const fitTextOnNLines = ({ text, maxLines, maxBoxWidth, fontFamily, fontWeight,
56
56
  right = mid - 1;
57
57
  }
58
58
  }
59
+ for (let i = 0; i < optimalLines.length; i++) {
60
+ optimalLines[i] = optimalLines[i].trimEnd();
61
+ }
59
62
  return {
60
63
  fontSize: optimalFontSize,
61
64
  lines: optimalLines,
@@ -235,7 +235,7 @@ var fitTextOnNLines = ({
235
235
  const lines = [""];
236
236
  for (const word of words) {
237
237
  const result = textBox.add({
238
- text: word + " ",
238
+ text: lines[currentLine].length === 0 ? word : " " + word,
239
239
  fontFamily,
240
240
  fontWeight,
241
241
  fontSize,
@@ -263,6 +263,9 @@ var fitTextOnNLines = ({
263
263
  right = mid - 1;
264
264
  }
265
265
  }
266
+ for (let i = 0;i < optimalLines.length; i++) {
267
+ optimalLines[i] = optimalLines[i].trimEnd();
268
+ }
266
269
  return {
267
270
  fontSize: optimalFontSize,
268
271
  lines: optimalLines
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.358",
6
+ "version": "4.0.362",
7
7
  "description": "Utilities for working with layouts",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "devDependencies": {
27
- "@remotion/eslint-config-internal": "4.0.357",
27
+ "@remotion/eslint-config-internal": "4.0.362",
28
28
  "eslint": "9.19.0"
29
29
  },
30
30
  "author": "Yehor Misiats (https://github.com/satelllte)",