Skip to content

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

Closed

Description

@momdo

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

Activity

  1. realskk commented on Jun 2, 2016

    @realskk

    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

  2. upsuper commented on Jun 2, 2016

    @upsuper
    Member

    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.

  3. upsuper commented on Jun 7, 2016

    @upsuper
    Member

    @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?

  4. upsuper commented on Jun 7, 2016

    @upsuper
    Member

    For example what behavior would be for this code?

    <span style="text-emphasis: circle; text-decoration: overline">CO<sub>2</sub></span>
  5. realskk commented on Jun 7, 2016

    @realskk

    @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

  6. upsuper commented on Jun 7, 2016

    @upsuper
    Member

    My question was, where should the emphasis marks be?

  7. realskk commented on Jun 7, 2016

    @realskk

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

    image

  8. realskk commented on Jun 7, 2016

    @realskk

    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

  9. added
    i18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.
    on Nov 29, 2016
  10. fantasai commented on Dec 27, 2016

    @fantasai
    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.”

  11. upsuper commented on Dec 27, 2016

    @upsuper
    Member

    @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?

  12. fantasai commented on Dec 28, 2016

    @fantasai
    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?

  13. realskk commented on Jan 12, 2017

    @realskk

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

  14. fantasai commented on Oct 19, 2017

    @fantasai
    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!

  15. added a commit that references this issue on Dec 4, 2017
    21de090
  16. fantasai commented on Feb 10, 2018

    @fantasai
    Collaborator

    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.

  17. upsuper commented on Feb 10, 2018

    @upsuper
    Member

    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.

  18. upsuper commented on Feb 10, 2018

    @upsuper
    Member

    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

Metadata

Metadata

Labels

Commenter Response Pendingcss-text-decor-3Current Worki18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions