Skip to content

qt: preserve rich formatting in Kdenlive titles - #1308

Merged
j-b-m merged 5 commits into
mltframework:masterfrom
klg90:kdenlivetitle-richtext
Oct 6, 2026
Merged

j-b-m merged 5 commits into
mltframework:masterfrom
klg90:kdenlivetitle-richtext

Conversation

@klg90

@klg90 klg90 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserve rich-text formatting from Kdenlive title clips in MLT's Qt title renderer.

This adds support for rich formatting stored by Kdenlive, including per-range formatting and metadata that Qt HTML does not preserve by itself.

The changes also make typewriter animation operate on the rich QTextDocument instead of flattening the title formatting.

Main changes

  • Load and render Kdenlive rich-text title content with QTextDocument.
  • Preserve per-range character formatting during rendering.
  • Restore letter-spacing metadata not preserved by Qt HTML.
  • Restore selective text-gradient metadata.
  • Preserve rich formatting through the typewriter filter.
  • Handle character/word/line typewriter animation without mutating the original title XML.
  • Keep backwards compatibility with existing Kdenlive title XML.

Testing

Tested together with the corresponding Kdenlive Titler changes.

  • Rich-text tests: 9 test cases / 136 assertions
  • Full Kdenlive Titler suite: 17 test cases / 1242 assertions
  • Fresh MLT build and install completed successfully.
  • Kdenlive was built from scratch against that fresh MLT install.
  • Verified that the test binary and installed Kdenlive resolved the fresh MLT libraries rather than previous development installs.
  • Manual testing included mixed formatting, selective gradients, custom fonts, save/reload, timeline rendering, typewriter animation, and Unicode/Arabic text.

A corresponding Kdenlive merge request will follow.

@ddennedy

ddennedy commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Please better explain the goal.

@ddennedy ddennedy closed this Sep 22, 2026
@klg90

klg90 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

The goal is to allow a single Kdenlive title text object to contain multiple independently formatted ranges. For example, different fonts, sizes, colors, spacing, or gradients within the same text object, while keeping the title editable in Kdenlive and rendering the same way in the timeline/export.

The Kdenlive side can store and edit that information, but kdenlivetitle in MLT is ultimately what renders the title for playback/export. I added support there so the per-range formatting would not get flattened back to one object-wide format during rendering.

I'm not attached to storing Kdenlive-specific metadata in MLT though. If you would prefer a different boundary, such as Kdenlive converting the formatting into a more generic representation before passing it to MLT, or extending the existing title representation differently, I'm happy to change the approach.

What would you prefer as the architecture for preserving per-range formatting through kdenlivetitle?

@ddennedy

Copy link
Copy Markdown
Member

I did not mean to close this. Sorry, something weird happened. I do not care about kdenlivetitle. @j-b-m manages it. I think you are saying you simply want to expand upon the rich formatting within kdenlivetitle.

@ddennedy ddennedy reopened this Sep 22, 2026
@ddennedy
ddennedy requested a review from j-b-m September 22, 2026 17:55
@j-b-m

j-b-m commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for your work on this. A few minor comments:
Please increase the kdenlivetitle producer version in the yaml file so that Kdenlive can detect if the rich text formatting is available
And also there seems to be some clang formatting required, see the failed test.

@j-b-m j-b-m left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, thanks a lot!
Will merge tomorrow morning if no objection.

@ddennedy

ddennedy commented Oct 1, 2026

Copy link
Copy Markdown
Member

I would rather not include it in tomorrow’s release with barely any testing! But up to you.

@j-b-m

j-b-m commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

I did some testing during last week and we added a regression tests on our side for this feature, but I agree that merging such change one day before release is not ideal, Will wait until next week then, thanks for the feedback.

@klg90

klg90 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

I would rather not include it in tomorrow’s release with barely any testing! But up to you.

Agreed, I think we should have some testers or a testing team test it first and use it in normal but slightly weird or advanced ways to try and catch some edge cases some users may naturally experience

Also, how exactly does it (as in the testing thing) work? is there a dedicated testing team or is it just people who download the betas and then submit reports if they wan tto?

kdesysadmin pushed a commit to KDE/kdenlive that referenced this pull request Oct 6, 2026
## Summary

Add native per-selection rich-text formatting support to the Kdenlive Titler.

Text inside a single title object can now keep independent formatting instead of formatting changes flattening the entire object.

## Main changes

- Apply font family, size, weight/bold, italic, underline, color and letter spacing to the selected text range.
- Preserve formatting when moving the text cursor and when refreshing the Titler controls.
- Save rich text alongside the existing title XML representation for backwards compatibility.
- Restore rich text when reopening title clips.
- Preserve letter spacing using explicit metadata where Qt HTML alone is insufficient.
- Support selective gradients on text ranges.
- Keep whole-object gradient behavior when the text object itself is selected rather than a character range.
- Make title shadow rendering use the rich text geometry.
- Improve Titler formatting-state updates for the active text run.
- Add regression tests for rich-text persistence, formatting and rendering.

## MLT dependency

Rendering support is implemented in:

mltframework/mlt#1308

The Kdenlive side saves and edits the richer title representation; the MLT change preserves it during timeline/export rendering and typewriter animation.

## Testing

- Rich-text tests: 9 test cases / 136 assertions
- Full Titler suite: 17 test cases / 1242 assertions
- Fresh Kdenlive build completed against a fresh build/install of the MLT changes.
- Verified no previous development MLT/Kdenlive prefixes leaked into the final build.
- Manual testing covered mixed formatting, custom fonts, font size/style/color, letter spacing, selective gradients, save/reopen persistence, timeline/export rendering, typewriter animation, and Unicode/Arabic text.

Existing plain title behavior is retained for older title XML.
@j-b-m

j-b-m commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

I will soon publish Kdenlive binaries and a call for testers. We don't have dedicated testing teams unfortunately, but we should be able to gather some feedback before Kdenlive's december release.

@j-b-m
j-b-m merged commit b86a303 into mltframework:master Oct 6, 2026
15 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.

3 participants