New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: libass' {,}-escapes and VSFilter-compatability #194
Comments
|
Commit a6fe61a introduced an escape mechanism to make it possible to print the characters '}' and '{'. This clearly interferes with what you are doing here, and I believe we had some discussion about this problem a long time ago. I'm not sure what the outcome was. |
|
Hmm.. would it make sense then to add another escape case (to the changes of a6fe61a) like this? since |
|
The commit is actually wrong. It breaks things that work in VSFilter (there was at least 1 real life case). |
|
Is it wrong because it breaks compatibility? or because it should/could have been solved more compliantly, e.g. maybe using In general though, the fact that IMO either confine all escaping to within |
Yes. |
|
How would VSFilter be used to output a literal |
|
It can't. |
|
In that case, would these work without breaking compatibility for stuff which does work (assuming VSFilter would break on those)? And possibly for other literals that are unprintable with VSFilter, maybe even also for unicode sequences such as |
|
Is the goal of libass to maintain 100% compatibility with VSFilter, including limitations such as no way to output e.g. Or to support everything which works in VSFilter, but allow some extensions to overcome limitations of VSFilter? (such that some stuff which libass supports would not work in VSFilter). |
|
I think the consensus is that we want to be as compatible to VSFilter as needed. If there is a real-life case that breaks with the escape feature, we should probably consider removing or changing it. |
|
Your reply implies that the existing (5 years old) patch to support Therefore, I think a more relevant question is whether or not libass wants to extend on VSFilter where VSFilter has limitations (e.g. to allow backslash literals):
My suggestion is to add new escape format which doesn't conflict with existing tags, something similar to:
Which would not break VSFilter as far as I can tell, but also which wouldn't work in VSFilter. |
|
Going back to your original question, you can break the Sadly, there’s literally no way to display a backslash (before
Personally, in my eyes the goal of libass is to maintain 100% compatibility with all scripts designed for VSFilter. Additional features are acceptable as long as they don’t affect scripts that aren’t knowingly targeting them. Of course, technically we can never be entirely sure because anyone could activate a libass feature by accident while designing for VSFilter, but the rule of thumb is that if we’ve never heard of anyone doing this and it’s incredibly unlikely (e. g. we have a whole new ASS header with a name dissimilar to any other, so a simple typo isn’t enough to activate it), then it’s OK. Sometimes we happen to accept features that aren’t that hard to activate by accident, such as these escapes or BorderStyle=4 (#105), and then we may end up having to back out and remove or change them later when someone discovers a script that they do break. @wm4 Could you perhaps dig out that real-life case? |
|
See also this old related discussion over at xy-VSFilter: https://code.google.com/p/xy-vsfilter/issues/detail?id=149. (Do note that the discussion originator is none other than our own @wm4.) Everyone seemed to agree that it would be nice to have some portable way of outputting literal backslashes and braces, but no consensus was reached on the specifics, and then the discussion (and later xy-VSFilter development) died out. Maybe we should try to restart the discussion with more/other people: first of all, the developers of MPC-HC’s VSFilter (@Underground78, @kasper93) and Aegisub (@tgoyne), but I think we should also invite fansubbers (@line0, @torque, @Daiz?). Of course, backslashes and braces don’t occur often in fansubs, but they will still be stuck with having to use whatever syntax we come up with if the need does arise, and it would be nice and potentially interesting to hear what they have to say about it. The ideal solution:
We may also want to similarly allow new scripts explicitly say they want literal angular brackets displayed to ensure VSFilter doesn’t parse them as HTML tags. (But this is already achievable by inserting a Then again, judging by the recent commits of mpc-hc/mpc-hc@11bb014 and mpc-hc/mpc-hc@b20e86f, MPC-HC may not be interested in preserving compatibility with existing scripts all that much. Currently, I see the following ways of achieving this, including those originally proposed by @wm4:
Of these, a new header is by far the easiest to use as a script writer. For automatic conversion from other subtitle formats where human-readable output is not a goal, any option is as good as any other. Finally, in terms of graceful degradation, individual override tags for the affected characters or a single-character Unicode escape tag is probably best, as they let all unaffected characters show up in old renderers and handle all affected characters consistently. Of course, a dedicated script writer can use some of the other options with varying levels of graceful degradation too: for example, |
|
Something that doesn't break the normal parsing rules would be nice. There's a lot of code out there which merely scans for '{' and '}' to distinguish text and tags. |
|
PS: currently, my favorite choice would be |
|
For what it's worth, I believe the classic workaround for vsfilter involved a fullwidth { and some negative I think having a generic unicode character escape syntax is a good thing, but I think I personally think a new header is the cleanest solution to pretty much all problems with ASS and versions, and there's already been precedent set for introducing new headers ( |
How about |
Very good point. This is why I used |
I think I also like this the most due to the consistency. |
|
I also like this, seems to be a good and clean approach. Only nitpick, while ASS overrides are case sensitive, the similarity with \u for underline may confuse some users. Not really a problem, though. |
Indeed, not only would this completely destroy ASS semantics, it would also raise interesting questions as far as state is concerned. Consider this hypothetical line: This kind of example might appear contrived, given how nobody would voluntarily mix markup with not-quite-markup but this is where compatibility comes in: My scripts will happily simplify I can see how this solution appeals to some of you from an aesthetics standpoint (incompatible renderers would simply omit the characters inserted with
I'm also in favor of this and while it is just as incompatible as the override tag solution, it will break scripts and renderers in very obvious ways while an override tag would often mask the issue.
Indeed. Drop That said, if you were really set on implementing this as an override tag, there's a way to do it while keeping ASS semantics intact: Instead of having |
I think this is my favourite option too.
Out of curiosity, what might those be? |
|
|
Ooh, neat! (Not that this should significantly influence our decision.) |
|
I don't understand your concerns. Drawing mode already influences how text outside of the override tags is treated. |
|
PS: and if you want total backwards compatibility, this might be the only way. |
|
I’m confused by your latest comments, @wm4. @line0’s concerns are about the syntax where an override tag itself produces output, rather than affects the interpretation of text outside of override tags. It’s unintuitive to humans, and it can break automatic processing of ASS, or rather cause existing automatic processing tools to break new scripts. Admittedly, ASS tags can’t be freely reordered even now (think Everyone speaks of a new header and I find it most attractive myself, but there is also the option of adding an override tag that enables new escapes in the rest of the line—escapes that are themselves written outside of override tag blocks. @line0’s expressed concerns do not apply to such a solution. |
Well yes, but it's not like it's been terribly elegant and orthogonal before either.
But why does it matter if old tools misinterprets our shiny new escapes? They won't do anything reasonable with them, because they, duh, don't support them. If you don't want anything to break, then you can't have your feature. |
|
There’s nothing for them to do with them. We’re talking about batch processing tools that don’t care about the text, just the tags. Aegisub plugins probably, and standalone tools too. Definitely not renderers. Just as you said such there’s plenty of code that takes All he is saying is that if our shiny new escapes break this assumption, this will break much more existing code than if they don’t, for no apparent benefit. If we use a header or a tag that changes how non-tag text is parsed, we’ll still have our shiny new escapes but we’ll also uphold this assumption and thus keep anything that doesn’t care about the actual text (i. e. pretty much everything but renderers) in perfect working order with no updates required. |
|
So there are 2 basic choices, a mechanism inside the tags, and one outside of the tags. It seems the latter has two advantages:
So the (Maybe this was all already said and discussed.) |
Here's the executive summary for anyone reading this and looking for a way to escape literal text:
So, to escape text literally for use with libass, you just need to follow the above rules. To put it all into a JavaScript example to illustrate it, it would look as follows: str.replace(/\\/g, '\\\u2060').replace(/\{/g, '\\{');The order matters. Escape literal backslashes first. Then add the backslash-bracket escape sequences. Have fun! |
|
↑ Just one thing to add: If you’re converting something to ASS to immediately play it in libass, that’s fine. But if you intend to distribute a subtitle file to the general public, don’t use this, because it works very different in VSFilter. Instead, use the full-width brace |
|
@astiob Thanks for that extra info! It's sad that the spec never took into account simply adding |

Not sure if it's a bug, but I expected this to work:
x{\u1}\\{\u0}x- it didn't, and I also tried the following:x{\u1}\{\u0}x,x{\u1}\u2764{\u0}x, which also didn't work (tested with libass 0.12.3, and also with the fonts branch from 2015-09-03)I'd appreciate help on how to do that, or otherwise please treat it as a bug report.
The text was updated successfully, but these errors were encountered: