Description
When using the AI caption feature for Right-to-Left (RTL) languages like Persian, the text shaping works fine (letters are connected properly). However, the bounding box calculation or text alignment is incorrect. The RTL text shifts horizontally and renders outside/overflows the edges of the caption background container.
Steps to Reproduce
- Record a video speaking in Persian or Arabic.
- Generate AI captions using the local model.
- Observe the caption overlay.
Expected Behavior
The black background box should properly wrap the RTL text with correct padding, and the text should be perfectly centered/aligned inside the container.
Actual Behavior
The text aligns incorrectly and spills outside the right/left edge of the background box, getting cut off.
Please see the attached screenshots for reference:

Description
When using the AI caption feature for Right-to-Left (RTL) languages like Persian, the text shaping works fine (letters are connected properly). However, the bounding box calculation or text alignment is incorrect. The RTL text shifts horizontally and renders outside/overflows the edges of the caption background container.
Steps to Reproduce
Expected Behavior
The black background box should properly wrap the RTL text with correct padding, and the text should be perfectly centered/aligned inside the container.
Actual Behavior
The text aligns incorrectly and spills outside the right/left edge of the background box, getting cut off.
Please see the attached screenshots for reference: