Skip to content

[Feature Request] Proper text breaking by words in TextClip #2501#2530

Open
LasseSchmidt wants to merge 1 commit intoZulko:masterfrom
LasseSchmidt:master
Open

[Feature Request] Proper text breaking by words in TextClip #2501#2530
LasseSchmidt wants to merge 1 commit intoZulko:masterfrom
LasseSchmidt:master

Conversation

@LasseSchmidt
Copy link
Copy Markdown

@LasseSchmidt LasseSchmidt commented Nov 5, 2025

Fixed a bug where text breaking by words works for first line but not the lines after.

import moviepy as mp

text = 'MoviePy (online documentation here) is a Python library for video editing: cuts, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. MoviePy can read and write all the most common audio and video formats, including GIF, and runs on Windows/Mac/Linux, with Python 3.9+.'

text_lines = mp.TextClip(text=text, font_size=20)._TextClip__break_text(width=500, text=text, font=None, font_size=20, stroke_width=0, align="left", spacing=4)
print("\n".join(text_lines))
  • I have provided code that clearly demonstrates the bug and that only works correctly when applying this fix

Fixed a bug where text breaking by words works for first line but not the lines after.
@JacobRosey
Copy link
Copy Markdown

i applied your fix locally by overriding the break_text method and it works great, thanks!

@keikoro keikoro linked an issue Feb 12, 2026 that may be closed by this pull request
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.

Subtitles+TextClip wrap by word

2 participants