-
Notifications
You must be signed in to change notification settings - Fork 29
Margins should be shared between multiple subs in same alignment group #48
Comments
Yes, it applies the outer margin (bottom margin for \an2, etc.) to every dialogue, whereas VSFilter / libass only apply it to the outermost dialogue and use no margin for the others. Currently each dialogue is rendered in isolation, so making it aware of other dialogues will be tricky (especially taking into account that the diaogue is rendered from cache). Edit: One possibility is to set the margin as CSS padding on the layer div instead of the CSS margin on the individual sub divs. I think I investigated this long ago but I can't remember why I didn't do it. If doing this, it might still be necessary to put CSS margin for absolutely-positioned subs. |
Actually, the real behavior is more complex. The margin is always applied from the bottom of the viewport. If you have two subs in \an2 with vertical margin == 20px, then both will try to be 20px above the bottom of the viewport. Of course the second one cannot be there since it will overlap the first one, so it moves up till it's above the first one. (*) Instead suppose one sub was \an2 with 20px margin, and another was \an2 with 200px margin. Then the first one would appear 20px above the bottom of the viewport, and the second one would appear 200px above the bottom of the viewport. That is, it will not appear directly above the first one. In other words it's wrong to just set the margin to 0 for all subs except the lowest one in the \an2 div. A proper fix will be hard for this, since CSS doesn't have a way to specify a distance between child and parent while also not letting the children overlap. (*) And since the margin is only relative to the viewport and not to the individual subs, that's why the two subs won't have any margin between then. |
What about calc() function? May be use some algorithm co calculate heigh of stroke? (relative %, vh and fixed px, other) |
@XCanG Not sure I understand what you mean. |
I know what calc is. I'm asking how you propose to use it to solve this problem. |
Using negative order, for example: |
Sure, but that requires knowing that the first is 30px high. If libjass knew that then it wouldn't need to use calc at all since it could just absolutely position everything... |
In my idea this relative 100% calculating by one method, other fixed 30px calculated by another metod and both of them resolve problem. As the backup I know other method, but it require wrapper, see example http://jsfiddle.net/b9hg3kag/1/ So, this method call the only problem with adding a lot of strokes (3 or more), but it also possible to sorting this lines. |
For more 2 lines it will look like this: http://jsfiddle.net/b9hg3kag/2/ |
Again, my point is that libjass doesn't know the height of the subs to be able to position things with calc. If it did know the height of the subs, then it wouldn't even need to bother with calc because it could just position everything absolutely. |
Ok, but how about this example? If it can apply on subs lines. |
@Arnavion Thanks for quickly fielding issue #102 . I read through the thread, and it sounds like the tradeoffs at this point in time are to have the elements margins interact with one another or to have them overlap. So without fully resolving the issue, it seems that the lesser of the 2 evils (at least in my use-case) would be to let the 2 subs overlap if the dialog sets them as such, instead of having the margins of the two elements affect each others position. This will assume that the author of the subs had considered overlap, and did not position the margins in a way that would make them overlap if the libass rule of non-overlapping text were not in place. Would this be possible? Possibly as an option until the issue is fully resolved? |
Making subs overlap if they have the same margin is strictly worse than showing them with more margin that necessary. The latter allows you to atleast read them. |
It is absolutely not a common scenario. The behavior your subs are trying to achieve is more commonly done by positioning one of the lines with I'm not saying that the current behavior is good because it's obviously wrong, but it is the least worst outcome and there's no reason to make it worse for the common scenario. |
Thanks for the tips on how to achieve the desired positioning in the subfile. Unfortunately I have no control over the content in the files, and am looking to find a solution to deal with the current state of the files I need to render. The request is not to necessarily change the behavior outright, as I completely understand that there are others using the lib, and depend on it's current behavior. What I am looking for is more of an option that, if explicitly set, can augment this current rendering approach in favor of the alternative outcome I described. This would allow the library to accomodate both imperfect behaviors until the single proper behavior is achieved. |
If there is a PR with the option I will consider it. Alternatively you can look at https://github.com/Dador/JavascriptSubtitlesOctopus instead. With the direction browsers are moving in with respect to SVG rendering vs WASM, that library is the more likely future. |
Thanks for recommending JavascriptSubtitlesOctopus, I looked into it, and it seems a little too future for the browsers that I need to support. If now asm.js were supported more broadly. I supposed I will just have to look into modifications that I can make to the rendering approach to support absolute positioning with frame by frame collision detection on a local fork... |
BTW, what browsers you would like to support? |
@Dador Thanks for following up! I am looking to support the following: Desktop
Mobile web iOS
Mobile web Android
Native iOS
Native Android
|
Migrating this discussion to JavascriptSubtitleOctopus issue#14 |
In libjass:
In Aegisub (libass):
Test script:
P.S. Test almost the same as #49 but this issue about different thing so I decided to put it in separate issue.
The text was updated successfully, but these errors were encountered: