Skip to content

position, text_alignment issue #413

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

Closed
k2nagaraju opened this issue Nov 14, 2017 · 8 comments
Closed

position, text_alignment issue #413

k2nagaraju opened this issue Nov 14, 2017 · 8 comments

Comments

@k2nagaraju
Copy link

According to spec "https://w3c.github.io/webvtt/"

problem 1:

if cue contains "position:0% align:start"
https://w3c.github.io/webvtt/#webvtt-cue-position =>computed position is 0,
https://w3c.github.io/webvtt/#webvtt-cue-position-alignment =>computed position alignment is center

https://w3c.github.io/webvtt/#processing-model
If the computed position alignment is center, and the computed position is less than or equal to 50
maximum_size = computed position * 2; which is 0

cue_size is minimum of (cue_size or maxium_size). From this cue_size is 0.
In spec it is not specified what should be done if cue_size is zero.

Problem 2:

if cue contains "position:10% align:start"
https://w3c.github.io/webvtt/#webvtt-cue-position =>computed position is 10,
https://w3c.github.io/webvtt/#webvtt-cue-position-alignment =>computed position alignment is center

https://w3c.github.io/webvtt/#processing-model
If the computed position alignment is center, and the computed position is less than or equal to 50
maximum_size = computed position * 2; which is 20

cue_size is minimum of (cue_size or maxium_size). From this cue_size is 20.
Determine the value of x-position for horizontal writing direction
If the computed position alignment is center alignment
Let x-position be the computed position minus half of size. => 10-20/2 =0;

Here position whichever specified in cue is not considered.
Same problem is there for
position> 50 && align:end;
position< 50 && align:start; cases

@dwsinger
Copy link

@silviapfeiffer @foolip @zcorpan comments? can you help clarify here?

@foolip
Copy link
Member

foolip commented Dec 14, 2017

Dunno, I haven't thought about WebVTT in a while. @fsoder may have it more recently in cache.

@fsoder
Copy link

fsoder commented Dec 14, 2017

This came up when we implemented support for position (and line) alignment in Blink. (I'm not sure that "Problem 2" is an issue - x-position=0 seems fairly reasonable?)

I suspect it's kind of related to what's mentioned at the end of https://w3c.github.io/webvtt/#webvtt-cue-position :

For WebVTT cues that have a size other than 100%, and a text alignment of start or end, authors must not use the default auto position.

(there are some additional notes around that paragraph too)

So auto position alignment don't go too well together with the logical (text) alignment values. I think this was done intentionally when the spec was changed to not resolve alignment based on the content of the cue. I could have misunderstood or misremembered (that was a while ago now...)

Maybe the computed position alignment algorithm should have a paragraph similar to the one for position (above), or refer to it?

@silviapfeiffer
Copy link
Member

Your analysis is slightly mistaken, which is why this is a "works for me".

About problem 1:
if cue contains "position:0% align:start"
-> computed position alignment is line-left, because the alignment is left (see https://w3c.github.io/webvtt/#cue-computed-position-alignment)
-> maximum_size = 100

If instead you were to set align:center by hand, then yes, the computed position alignment would be center and the cue_size would indeed be 0. That's correct, because you're trying to center a cue at 0% position (the left edge of the video) with no possibility to extend the size to the left, therefore it ends up being 0.

About problem 2:
Again, you'd have to manually set align:center to result in the calculations that you made.

@fsoder
Copy link

fsoder commented Dec 20, 2017

Maybe a clarification that the 'start' and 'end' values should be resolved (using the paragraph direction of the cue text) would be in order then.

@silviapfeiffer
Copy link
Member

@fsoder you're right - I'll add something to that effect.

@silviapfeiffer
Copy link
Member

Please review patch

@silviapfeiffer
Copy link
Member

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants