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-text-decor-3] behavior of text-decoration + text-emphasis #160

Closed
momdo opened this issue Jun 1, 2016 · 16 comments
Closed

[css-text-decor-3] behavior of text-decoration + text-emphasis #160

momdo opened this issue Jun 1, 2016 · 16 comments
Assignees
Labels
Commenter Response Pending css-text-decor-3 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

Comments

@momdo
Copy link

momdo commented Jun 1, 2016

I think that the spec mentions behavior of text-emphasis + ruby (see below) but doesn't say behavior of combination of text-decoration and text-emphasis.

If emphasis marks are applied to characters for which ruby is drawn in the same position as the emphasis mark, the emphasis marks are placed outside the ruby.
https://drafts.csswg.org/css-text-decor-3/#text-emphasis-position-property

From an aesthetic point of view, text-decoration and text-emphasis should be separated from each other.

Furthermore, I feel that we have to think more complex pattern such as mixing text-decoration, text-emphasis and ruby.

See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1262792

@realskk
Copy link

realskk commented Jun 2, 2016

It's just FYI, but our EPUB viewer behaves like the attached file. We decided this after talking with Toppan printing people, so we believe this behavior might be sufficient for lots of printing situation.

capture

@upsuper
Copy link
Member

upsuper commented Jun 2, 2016

Interaction between decoration lines and emphasis marks could be complex (mostly because decoration line is complex). Text could be vertical aligned to some other place, which could be very far from the decoration line, and the relative position of the text and decoration line could even be reversed. There could also be multiple decoration lines, and they could be much further from the text as well.

Those kinds of cases may not be as important as the main usecases, but I think they should still be considered when specing the behavior, so that they would at least have a reasonable result.

@tabatkins tabatkins added the css-text-decor-3 Current Work label Jun 2, 2016
@r12a r12a added the i18n label Jun 7, 2016
@upsuper
Copy link
Member

upsuper commented Jun 7, 2016

@realskk Could you provide more information about what rule are you using to archive that result? What would the behavior be for the cases I mentioned in the comment above?

@upsuper
Copy link
Member

upsuper commented Jun 7, 2016

For example what behavior would be for this code?

<span style="text-emphasis: circle; text-decoration: overline">CO<sub>2</sub></span>

@realskk
Copy link

realskk commented Jun 7, 2016

@upsuper
In Blink, the underline is drawn in InlineTextBox. It means "CO" and "2" correspondingly in your example. We moved the drawing functionality to InlineFlowBox. Then the line is drawn over "CO2", as the attached file shows.

Did I answer what you asked??

pasted image at 2016_06_07 03_42 pm

@upsuper
Copy link
Member

upsuper commented Jun 7, 2016

My question was, where should the emphasis marks be?

@realskk
Copy link

realskk commented Jun 7, 2016

Sorry, I missed the mark. (I forgot prefixing.) At least our implementation, the mark is drawn on top of underline.

image

@realskk
Copy link

realskk commented Jun 7, 2016

I wonder that the current editor's draft of 'text-underline-position' says in note that the line can be drawn line-through (as attached).

image

But in case of the example below, where the emphasis mark can be drawn? If the line is drawn on top of the line as spec describes and emphasis mark is drawn on top of the line as shown by me, then the emphasis mark can be put on the character "2".

CO2

@fantasai fantasai removed the i18n label Jun 20, 2016
@r12a r12a added the i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. label Nov 29, 2016
@fantasai
Copy link
Collaborator

That example is showing a bad result. :) The UA should ideally not do that, is what it's saying. Maybe I should make the example clearer...

Underline/overline should be between the text and the ruby/emphasis marks. It's a bit complicated as you note in cases with varying font size or vertical alignment. I think maybe we need to add something like “The position of ruby and of text-emphasis dots may be adjusted in order to avoid text decoration lines.”

@upsuper
Copy link
Member

upsuper commented Dec 27, 2016

@realskk Another question, is the position of emphasis marks affected by presence of decoration lines? I mean, in the CO2 example, if there is no overline, should the emphasis marks be placed differently?

fantasai added a commit that referenced this issue Dec 28, 2016
>. Adjust wording in subsequent paragraph to help distinguish the two cases (baseline alignment vs. baseline shift). #160
fantasai added a commit that referenced this issue Dec 28, 2016
@fantasai
Copy link
Collaborator

OK, I checked in two sets of changes. First to clarify the note to address @realskk's confusion about the behavior in the note--you can see the new text and a new image in the editor's draft.

Second set of changes adds the following text to CSS Ruby and references it from the definition of text-emphasis-position:

The positions of ruby annotations may be adjusted to avoid conflicts with overline and underline decorations applied to the base text. In the basic case of consistent font size and baseline alignment, an underline or overline is to be positioned between the base level and any annotations on that side.

I'm open to additional suggestions/improvements, this is just a first pass. Let me know what you think.

Also, @realskk is it OK if I use your image in the spec?

Also, it seems to me that the variation in the emphasis marks' position and size in those examples is awkward, shall I open an issue on that for Text Decoration Level 4?

@realskk
Copy link

realskk commented Jan 12, 2017

(At F2F, I told to fantasai, that using image is OK, of course. Let me have more time for replying actually.)

@fantasai
Copy link
Collaborator

Filed #1892 on maintaining size and position, which is also relevant to @upsuper's question.

Still need some feedback on whether the changes in #160 (comment) are enough or if there are further clarifications we'd like to make!

birtles added a commit to birtles/csswg-drafts that referenced this issue Dec 4, 2017
As discussed in web-platform-tests/wpt#3318 (comment).

This behavior (or something similar) has already been implemented in Blink
and so there are not expected to be significant compatibility issues from
this change.

This closes w3c#160.
@fantasai
Copy link
Collaborator

fantasai commented Feb 10, 2018

Note: @upsuper filed #1918 for discussion of further details in css-ruby. If everyone's OK with the current allowances, I would like to close this issue. For reference again, the added text is

CSS Ruby Level 1:

The positions of ruby annotations may be adjusted to avoid potential conflicts with overline and underline decorations applied to the base text. In the basic case of consistent font size and baseline alignment, an underline or overline is positioned between the base level and any annotations on that side.

CSS Text Decoration Level 3:

Emphasis marks are drawn exactly as if each character was assigned the mark as its ruby annotation text with the ruby position given by 'text-emphasis-position' and the ruby alignment as centered. Note that this position may be adjusted if it would conflict with underline or overline decorations.

@upsuper
Copy link
Member

upsuper commented Feb 10, 2018

I don't really think #1918 covers some of the issues (specifically that what happens when font size changes in the piece of text). #1918 was merely for that ruby can conflict with decoration lines even if all text has the same size and position.

The interaction between them with changed font size and vertical position feels more complicated.

I think I have a question to @realskk not answered that: is the position of emphasis marks affected by presence of decoration lines? I mean, in the CO2 example, if there is no overline, should the emphasis marks be placed differently?

It is not clear to me what the answer should be, and I think that would affect how the spec should work.

@upsuper
Copy link
Member

upsuper commented Feb 10, 2018

This question can apply to ruby as well. Is the position of ruby annotation of text which has different size / vertical position affected by decoration lines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Commenter Response Pending css-text-decor-3 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.
Projects
None yet
Development

No branches or pull requests

7 participants