Arnavion / libjass

Renders ASS subs in the browser.
Apache License 2.0
174 stars 29 forks source link

implement smart line wrapping #97

Open Yay295 opened 7 years ago

Yay295 commented 7 years ago

Implement the smart line wrapping styles (WrapStyle 0 and 3).

Per spec, wrap style 0 tries the make the lines equal length, but ensures lines are never longer than the line above it. Wrap style 3 does the same, but shorter lines are on top. Note that libass seems to treat style 3 as if it were style 0, and uses style 1 if the line is too long (though I don't know what the limit is).

It may be possible to implement this using balance-text. Though balance-text only makes the lines similar length; it doesn't ensure lower lines are shorter.