🎥 Make videos programmatically with React
simplify nesting
JonnyBurgered0ecacbcd01
diff --git a/packages/web-renderer/src/drawing/text/handle-text-node.ts b/packages/web-renderer/src/drawing/text/handle-text-node.tsindex 2d78560c06..569f94e20e 100644--- a/packages/web-renderer/src/drawing/text/handle-text-node.ts+++ b/packages/web-renderer/src/drawing/text/handle-text-node.ts@@ -32,9 +32,6 @@ export const handleTextNode = async (context,element: span,draw(rect) {- // Save the canvas context state- context.save();-const style = getComputedStyle(span);const {fontFamily,@@ -45,11 +42,24 @@ export const handleTextNode = async (direction,writingMode,} = style;+ const isVertical = writingMode !== 'horizontal-tb';+ if (isVertical) {+ // TODO: Only warn once per render.+ Internals.Log.warn(+ {+ logLevel: 'warn',+ tag: '@remotion/web-renderer',+ },+ 'Detected "writing-mode" CSS property. Vertical text is not yet supported in @remotion/web-renderer',+ );+ return;+ }++ context.save();context.font = `${fontWeight} ${fontSize} ${fontFamily}`;context.fillStyle = color;- // Calculate the baseline position considering line heightconst fontSizePx = parseFloat(fontSize);// TODO: This is not necessarily correct, need to create text and measur to know for sureconst lineHeightPx =@@ -57,35 +67,19 @@ export const handleTextNode = async (const baselineOffset = (lineHeightPx - fontSizePx) / 2;- // Handle different writing modes- const isVertical = writingMode !== 'horizontal-tb';-- if (isVertical) {- // TODO: Only warn once per render.- Internals.Log.warn(- {- logLevel: 'warn',- tag: '@remotion/web-renderer',- },- 'Detected "writing-mode" CSS property. Vertical text is not yet supported in @remotion/web-renderer',- );- } else {- // Horizontal text (LTR or RTL)- const isRTL = direction === 'rtl';- context.textAlign = isRTL ? 'right' : 'left';- context.textBaseline = 'top';+ const isRTL = direction === 'rtl';+ context.textAlign = isRTL ? 'right' : 'left';+ context.textBaseline = 'top';- // For RTL text, fill from the right edge instead of left- const xPosition = isRTL ? rect.right : rect.left;+ // For RTL text, fill from the right edge instead of left+ const xPosition = isRTL ? rect.right : rect.left;- context.fillText(- getCollapsedText(span),- xPosition,- rect.top + baselineOffset,- );- }+ context.fillText(+ getCollapsedText(span),+ xPosition,+ rect.top + baselineOffset,+ );- // Restore the canvas context statecontext.restore();},});