libass
libass copied to clipboard
[RFC] \box tag
This essentially sets the margins. But it allows you to set different margins for top and bottom (instead of only a "MarginV"), and takes a rectangle instead of right/bottom margin values. Rather similar to for example \clip.
Example: \box(500,50,700,100)
For now, either the top or bottom margin is ignored, depending on alignment. A future idea might be to cut off the text in a non-ugly way, such as ellipsization. (This would be controlled by other tags.)
This tag should be a nice addition in contexts where setting the the event or style margins is too bothersome.
CC @astiob @MrSmile @rcombs
Not sure if this has any value. It would for me because 1. possible text cut off thing, and 2. mpv's OSD code doesn't allow setting the event margins (lol).
To summarize our discussion on IRC:
- As it is, this currently does nothing (useful) that can’t already be done by setting the Margin fields on the Dialogue line.
- wm4 hopes to extend this to add automatic fade-out or ellipsization at the opposite-from-anchor vertical margin (which is currently ignored), as described in #375.
- wm4 also wants this because mpv’s internal OSD APIs currently have no mechanism to set the Margin fields, and this seems easier and potentially more useful than adding such mechanism.
- I’m wary of adding new override tags that can be used from actual ASS files/tracks to avoid breaking other renderers and further fragmenting the already fragile world of ASS rendering.
- I suggested, and wm4 agreed, that this new override tag could be available only in a special new rendering mode such as introduced in #382 or #372, which would be disabled for real ASS tracks but enabled for mpv’s OSD.
As mentioned over in #375, I'd prefer to call this \margin
(since that's what it'd do). Seems sensible to gate it behind #382 as well.
IIRC this was mentioned on IRC too but I forget what the conclusion was: if you call it \margin
, that sounds like the fade-out/ellipsization effect should be a separate tag, no? Mind, maybe it should. Could be a Boolean tag like \i
.
Yeah, I think that makes sense as a separate thing (in part because imo setting per-line margins is a useful feature independent of that).
IIRC this was mentioned on IRC too but I forget what the conclusion was: if you call it \margin, that sounds like the fade-out/ellipsization effect should be a separate tag, no? Mind, maybe it should. Could be a Boolean tag like \i.
Yes, making a separate flag was always the idea.
Another thing to keep in mind, although that’s not the focus of this PR, is that our line wrapping currently (and after #372, too) keeps long words that don’t contain any break opportunities unbroken and lets them overflow the margin box. With a fade-out/ellipsization thing on, this will probably be undesirable.
Good point about collisions. I think anything with \margin
should be treated as explicitly positioned; however, then it'd be significantly different from just setting margins in the event header.
since the event margins are right next to the event text in all source formats that we support
Wait, what? Aren't they on the style?
Both have them.