[go: nahoru, domu]

Skip to content
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

[css-ruby][css-text-decor-4] Add over-most-under-last value to ruby-position & text-emphasis-position for captioning #2998

Closed
fantasai opened this issue Aug 8, 2018 · 12 comments
Labels
Closed Accepted by CSSWG Resolution css-ruby-1 Current Work css-text-decor-4 i18n-clreq Chinese language enablement i18n-jlreq Japanese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. TTML

Comments

@fantasai
Copy link
Collaborator
fantasai commented Aug 8, 2018

https://lists.w3.org/Archives/Public/www-style/2014Dec/0211.html
https://lists.w3.org/Archives/Public/www-style/2015Jan/0126.html

TTML has requested a value to ruby-position (and text-emphasis-position) that would place the annotation above on all lines except the last one in the block. Names proposed include outside and auto.

@upsuper
Copy link
Member
upsuper commented Aug 8, 2018

Neither outside nor auto feels like a good name for this in general... Maybe we can add a ruby-position-last for this usage just like text-align-last?

@fantasai
Copy link
Collaborator Author
fantasai commented Aug 8, 2018

@upsuper Seems like overkill. Not really something that needs to cascade independently afaik, doesn't have complex interactions with anything... Adding a value makes much more sense than adding a property.

@fantasai
Copy link
Collaborator Author
fantasai commented Aug 8, 2018

I think outside or outer is sufficiently clear, personally. The main concern I have is “What is the last line?”.

For justification we use the last line before any forced break. For text-indent we use the first line of a non-anonymous block. I have no idea what TTML’s markup model would require here...

@fantasai fantasai added i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. i18n-jlreq Japanese language enablement i18n-clreq Chinese language enablement Agenda+ labels Aug 8, 2018
@upsuper
Copy link
Member
upsuper commented Aug 8, 2018

I don't think they are clear, tbh. over and under are relative to the base text, but outer or outside in this context is relative to the whole paragraph. It would be great if there is some specific name for this behavior...

I also thought about the last line, and that feels non-trivial to implement and may add some complexity, because ruby-position is a inline-level property, and is handled in the progress of laying out a line. You cannot know whether a line is the last line until it is fully laid out, which means we may need to reprocess the line if we have such ruby position. This may not be that hard but does seem to be more complicated than its usefulness...

If we change it to only do different thing on first line, that would probably make it easier to implement.

@nigelmegitt
Copy link

“What is the last line?”

@skynavga @cconcolato @palemieux ping!

The TTML2 spec does answer the question:

<annotation-position> says:

outside

Equivalent to before for (1) the only line area of or (2) the first line area of the last block area generated by a p element which contains annotated text; otherwise, equivalent to after.

So I think the answer is it is based on the line areas generated by layout of the base text, with ruby and text emphasis then inserted in the appropriate position as a later step.

@css-meeting-bot
Copy link
Member

The Working Group just discussed Add over-most-under-last value to ruby-position & text-emphasis-position for captioning.

The full IRC log of that discussion <dael> Topic: Add over-most-under-last value to ruby-position & text-emphasis-position for captioning
<dael> github: https://github.com//issues/2998
<dael> astearns: fantasai added to agenda, updates by Nigel
<dael> fantasai: The overall question was to add new value to ruby position prop to handle ttml behavior. First line has ruby on top, second on bottom. 3+ lines they're all on bottom. Question from WG is do we add it. There's details on how to segment text, block, linebreaks, etc?
<dael> astearns: Is there a use case for changing behavior based on forced line break?
<dael> fantasai: Use case is for captions, don't know what markup looks like. Guessing not on forced line breaks.
<dael> dbaron: I can see why it's useful f or captions, but feels hard to impl for general case. What's previously local now needs bigger area
<dael> florian: Solve by special case first line and having first line be over and rest under?
<dael> florian: Since use case if for 2 line what we do for not 2 lines is error driven by use case so might as well do simple thing
<dael> s/use case if/use case is
<dael> florian: Then again why can't use first-line pseudo
<dael> astearns: First-line psuedo is interesting idea. Gets functionality for block. Do first-line deal with blocks?
<dael> fantasai: Only with firstline of not anon block
<dael> astearns: Then first-line gives us what ttml looking for
<dael> fantasai: I think so. Don't know nuances of what they're looking for
<dael> astearns: Leave it as a question in the issue? Ask if we can let them do this using first-line
<dael> fantasai: Alright
<dael> florian: Need to make it explicit that this applies in first-line pseudo.
<dael> fantasai: Have to check pseudo spec. And we can add example in ruby module to show this behavior
<dael> fantasai: I think we need to call it out, not really clear. Have to add it explicitly
<dael> astearns: Poss ttml people considered this and rejected so good to get their feedback on idea
<dael> fantasai: prop: add ruby position to properties applying to first-line, respond to ttml suggesting we use first-lien for this behavior and check if it's a problem
<dael> astearns: It jsut came up, could get shot down as soon as it's o n issue. not looking for resolution at this point.
<dael> fantasai: We have a proposed resolution and asking for feedback
<dael> astearns: We can come back next week.

@astearns
Copy link
Member

@nigelmegitt @palemieux would using ::first-line to set before work for this case?

@astearns astearns removed the Agenda+ label Aug 15, 2018
@fantasai
Copy link
Collaborator Author

Hi @nigelmegitt and @palemieux, CSSWG wanted to know if it would be acceptable to just use

p { ruby-position: under; }
p::first-line { ruby-position: over; }

and if not, why not. :)

@r12a
Copy link
Contributor
r12a commented Aug 16, 2018

@nigelmegitt @palemieux @skynavga @cconcolato Can i just check that the wording in the TTML spec is correctly?

Equivalent to before for (1) the only line area of or (2) the first line area of the last block area generated by a p element which contains annotated text; otherwise, equivalent to after.

The case for a single line is fine. The case for two lines (the most likely scenario) is fine too. I was under the (quite possibly mistaken) impression that in the case of 3+ horizontal lines, ruby would appear above the text except for the last line only, where the ruby would be shown below.

Btw, the Netflix requirements at https://medium.com/netflix-techblog/implementing-japanese-subtitles-on-netflix-c165fbe61989 say that there should never be more than two lines (because ruby should never appear between lines). So it doesn't help clarify.

@skynavga
Copy link
Contributor

@r12a for the 3+ case, we changed the spec to use after (below) for non-first lines; this was done to ensure we could map this to CSS using ::first-line;

also, regarding the NFLX requirements regarding no more than two lines, that is the NFLX style convention, but does not necessarily apply outside NFLX; one should read that document as one input providing guidance rather than universal requirements; in any case, we need the spec to handle the case where more than two lines are created during layout, which is something the author cannot predict due to variations in actual fonts on the client;

@nigelmegitt
Copy link

@fantasai @astearns yes, it looks like using ::first-line in the way suggested at #2998 (comment) and #2998 (comment) would work.

As @skynavga pointed out, the TTML2 spec was changed after this issue was raised in a way that enabled exactly this hypothetical solution. I've confirmed this offline with @palemieux.

The change needed is to allow ruby-position to apply to ::first-line.

Ruby Layout Module Level 1 explicitly excludes this currently, and the Pseudo-Elements Module Level 4 ::first-line specification is consistent with that because it does not list any ruby properties.

By the way, this is analogous to text-emphasis-position which does apply to ::first-line. It seems obvious to me that the same mechanism should be used for positioning ruby as for positioning text emphasis.

@fantasai
Copy link
Collaborator Author
fantasai commented Jan 1, 2020

OK, I've made the edits for this. There's a tangential follow-up for the CSSWG in #4642 but I think this issue itself is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted by CSSWG Resolution css-ruby-1 Current Work css-text-decor-4 i18n-clreq Chinese language enablement i18n-jlreq Japanese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. TTML
Projects
None yet
Development

No branches or pull requests

7 participants