Skip to content

Add RTL support for titles#25

Merged
ronak-create merged 3 commits into
ronak-create:mainfrom
PlkMarudny:RTL
Jul 16, 2026
Merged

Add RTL support for titles#25
ronak-create merged 3 commits into
ronak-create:mainfrom
PlkMarudny:RTL

Conversation

@PlkMarudny

@PlkMarudny PlkMarudny commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds support for RTL scripts in titles. Before, only LRT scripts were supported. Now the direction is auto-discovered (best-effort) and the directional effects (such as clip-reveal) are applied according to the direction discovered. For letter-level effects, like letter-pop word level effects are applied as a fallback. This is especially important for Arabic, Urdu and Indic scripts (or others with contextual shaping if such exist), where splitting words into letters would be difficult without a dedicated text shaper, so it is a reasonable compromise.

Type of change

  • Bug fix
  • New feature (transition / preset / text anim / effect / API)
  • Docs
  • Refactor / internal

How was it verified?

  • node --check server.js && node --check app.js && node --check mcp-server.js passes
  • Opened the editor and confirmed the change in preview
  • Confirmed the change in an export (fast or realtime), if it affects rendering
  • Updated CLAUDE.md / README.md if the schema, props, or API changed

Checklist

  • No new runtime dependencies added
  • Preview and export render identically (single compositor)
  • Commits are focused and messages are descriptive

Summary by CodeRabbit

  • New Features
    • Added text direction controls with Auto, Left-to-Right, and Right-to-Left options.
    • Improved rendering and animation behavior for Arabic, Indic, and other joined-letter scripts.
    • Updated text effects to respect reading direction, with word-based animation where needed to preserve shaping.
  • Documentation
    • Added guidance and examples for configuring RTL captions, selecting fonts, and understanding direction-aware animation behavior.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@PlkMarudny, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 89831bd5-dc72-4ef8-8713-32a02ed3f255

📥 Commits

Reviewing files that changed from the base of the PR and between 2c2ff6b and 6276d92.

📒 Files selected for processing (1)
  • app.js
📝 Walkthrough

Walkthrough

Text clips now expose direction as auto, ltr, or rtl. Rendering detects per-line direction, applies canvas direction state, and updates text animations for RTL geometry and progression. Documentation adds RTL caption guidance and script-aware animation behavior.

Changes

RTL Text Rendering

Layer / File(s) Summary
Direction prop and documentation
app.js, CLAUDE.md
Text clips default to direction: "auto", the inspector exposes a Direction selector, and documentation describes RTL captions and Arabic/Indic animation behavior.
Per-line direction rendering
app.js
Direction utilities determine RTL or LTR per line, and paint() applies the corresponding canvas direction while restoring prior state.
Direction-aware animation progression
app.js
Reveal, zoom, mask, typewriter, letter, wave, and word animations adjust geometry, origins, stepping, and painting for RTL lines.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Inspector
  participant drawText
  participant lineDirections
  participant Canvas2D
  Inspector->>drawText: provide direction prop
  drawText->>lineDirections: compute per-line directions
  lineDirections-->>drawText: return RTL or LTR flags
  drawText->>Canvas2D: paint direction-aware text
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding RTL support for titles.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app.js (1)

2647-2662: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Cache automatic direction detection outside the render loop.

getComputedStyle currently runs for every line on every frame, forcing repeated style resolution during preview and export. Cache directions by text/direction, invalidating them only when those props change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app.js` around lines 2647 - 2662, Update the text-direction flow around
detectTextDirection and lineDirections to cache automatically detected
directions by text and the relevant direction setting, so repeated lines avoid
calling getComputedStyle on every render frame. Reuse cached values during
lineDirections, and invalidate or refresh the cache only when the text or
direction properties change; preserve forced ltr/rtl behavior without probing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app.js`:
- Around line 2852-2863: The typewriter animation in the anim === "typewriter"
branch currently budgets and slices UTF-16 code units, allowing grapheme
clusters to be split. Update this loop to reuse graphemeSegments() for each
line’s visible prefix and length accounting, so budget advances and displayed
text operate on complete grapheme clusters.

---

Nitpick comments:
In `@app.js`:
- Around line 2647-2662: Update the text-direction flow around
detectTextDirection and lineDirections to cache automatically detected
directions by text and the relevant direction setting, so repeated lines avoid
calling getComputedStyle on every render frame. Reuse cached values during
lineDirections, and invalidate or refresh the cache only when the text or
direction properties change; preserve forced ltr/rtl behavior without probing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c00abd5f-0044-4d8e-ba18-0de3d1ec0fe6

📥 Commits

Reviewing files that changed from the base of the PR and between 658ae58 and 2c2ff6b.

📒 Files selected for processing (2)
  • CLAUDE.md
  • app.js

Comment thread app.js
@ronak-create
ronak-create merged commit ae49981 into ronak-create:main Jul 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants