Skip to content

[css-inline] need to define interaction of initial-letter and text-align other than start #884

Closed

Description

@dbaron

Per @frivoal in today's face-to-face discussion, we should make sure the spec produces sensible (?!?) results for the interaction of initial-letter with text-align values other than start

Activity

  1. frivoal commented on Jan 15, 2017

    @frivoal
    Collaborator
  2. upsuper commented on Jan 15, 2017

    @upsuper
    Member

    With text-align: justify and text-align: justify-all, clarifying that there is no justification opportunity between the initial letter and the adjacent text should be enough.

    Should there be justification opportunity between the initial letter and the rest if one or both of them are CJK characters?

    For end and center, this is much more confusing, and it isn't clear there is an actual use case, so we should probably pick the simplest thing to implement.

    Or explicitly leave it unspecified?

  3. frivoal commented on Jan 15, 2017

    @frivoal
    Collaborator
  4. upsuper commented on Jan 15, 2017

    @upsuper
    Member

    I don't think so. Especially if initial-letter-wrap is grid, I think it's pretty important that there isn't a justification opportunity. In the other cases, I am less sure, but I wouldn't want one either. You think there should be one?

    I have no idea. Probably you're right that it is better no justification opportunity presents there. I think we generally want a flush alignment for all lines beside initial letter in CJK. If we need space there, it should be aligned to grid, rather than having justification opportunity.

  5. frivoal commented on Jan 16, 2017

    @frivoal
    Collaborator

    If we need space there, it should be aligned to grid, rather than having justification opportunity.

    Agreed. That that can be done with initial-letter-wrap: grid.

  6. self-assigned this
    on May 24, 2018
  7. fantasai commented on May 25, 2018

    @fantasai
    Collaborator

    OK, so the proposal is

    • For raised initials (sink = 1), alignment is honored as usual, there are no special considerations.
    • For sunk initials, the initial letter box’s start margin edge is anchored to the start edge of the line (after first-line 'text-indent'), and alignment happens afterwards in the remaining space on the line.
    • We specify that initial letter suppresses any justification opportunity between the initial letter and subsequent text.
  8. css-meeting-bot commented on Jul 3, 2018

    @css-meeting-bot
    Member

    The Working Group just discussed initial letter and text-align, and agreed to the following:

    • RESOLVED: Raised initial is justified as normal.
    • RESOLVED: For sunk initials, the initial letter box’s start margin edge is anchored to the start edge of the line (after first-line 'text-indent'), and alignment happens afterwards in the remaining space on the line.
    • RESOLVED: sunken initial letters suppress justification between the initial letter and subsequent text.
    The full IRC log of that discussion <TabAtkins> Topic: initial letter and text-align
    <dbaron> github: https://github.com//issues/884#issuecomment-392114382
    <TabAtkins> fantasai: So how does initial-letter interact with text-align?
    <TabAtkins> fantasai: proposal is that for raised initials, no special behavior, it just aligns as specified.
    <TabAtkins> fantasai: sunk initials, suggestion is that initial-letter box's start margin edge is anchored to start edge of the line, then text-indent works on the rest of th etext on the line. It also suppresses justification between the initial-letter and subsequent text.
    <TabAtkins> fantasai: Say you have a bunch of chinese chars and inter-character spacing, you don't want spacing between initial-letter and first normal text letter on first line, but not on subsequent (because they're not "next" to the initial letter).
    <TabAtkins> fantasai: So instead they're flush on all lines.
    <TabAtkins> dbaron: I'm a little worried about the justification part.
    <TabAtkins> dbaron: Thinking about initial letters that are single-letter words, like english "A" or "I". Especially with wide justification, seems like it'll look weird.
    <TabAtkins> dbaron: The justification from word spaces seems different than inter-character.
    <TabAtkins> fantasai: justification opportunities *form the space* are different than justification arising from the letters. It'll still justify in that case.
    <TabAtkins> dbaron: Ah, that wasn't clear. Sounds good, but I want more clarity in that when it's written into the spec.
    <TabAtkins> fantasai: So three separate resolutions here.
    <florian> I looked into it, I like it. (all 3)
    <TabAtkins> fantasai: First, for raised initials, alignment is honored as usual.
    <TabAtkins> Rossen: Seems uncontroversial.
    <TabAtkins> dauwhe: It's just a big letter.
    <TabAtkins> RESOLVED: Raised initial is justified as normal.
    <TabAtkins> fantasai: Second is that sunk initials are attached to the start edge of the line, then alignment affects the rest of the line.
    <TabAtkins> [myles draws a picture]
    <TabAtkins> fantasai: We couldn't come up with anything better than that.
    <TabAtkins> florian: We couldn't find any use-cases, we just selected the simplest thing that wasn't horrible.
    <TabAtkins> dbaron: Do you ever actually see initial letters that aren't flush against the left edge?
    <dbaron> (where the left edge might be a shape rather than a straight edge)
    <TabAtkins> dauwhe: I've made some examples where you can set an explicit width on the ::first-letter and then right-align the initial-letter in that block, so the letters themselves aren't flush against the start edge.
    <TabAtkins> myles: What were the other options considered?
    <TabAtkins> dauwhe: Florian put some suggestions into the issue.
    <TabAtkins> florian: That was a long time ago...
    <tantek> the example dauwhe mentioned (I thought I heard) http://tantek.com/2015/224/b1/alphabet-indieweb
    <dauwhe> tantek: yes :)
    <TabAtkins> florian: One of my proposals was - do two steps. 1, do the "attached to start edge, then align rest of text", then 2 flush it with text as much as you can.
    <TabAtkins> florian: But that didn't seem good.
    <TabAtkins> myles: I could think of a few scenarios, but this is probably best.
    <TabAtkins> myles: A third is just lay out first line right-justified, place first letter, then try to place everything else. That sucks.
    <TabAtkins> myles: Fourth is make it not sunken, but it's probably more important to honor the sunken request.
    <TabAtkins> myles: Uncommon enough we can maybe consider it an error case. Probably not worth doing a two-pass for that.
    <TabAtkins> myles: So out of those four options, I think current proposal is best.
    <TabAtkins> fantasai: Another is lay out all the lines that are affected start-aligned, then apply alignment to all the lines at once.
    <TabAtkins> florian: I think that's what I suggested, the two-pass
    <TabAtkins> dbaron: I think it's slightly different.
    <TabAtkins> [fantasai draws out their suggestion]
    <TabAtkins> dbaron: That's different, but I think florian's is slightly better for right-alignment, while I think fantasai's is bad for right-alignment. Lines won't necessarily be flush.
    <TabAtkins> florian: Since we do consider this an error case, I agree we don't need to do either two-pass.
    <TabAtkins> myles: [question about diagram fantasai drew]
    <TabAtkins> myles: All of these suck.
    <TabAtkins> dbaron: You could constrain the later lines to be shorter than the first, but it's a lot of work...
    <TabAtkins> myles: I just think this is rare enough that it just won't really matter what we pick.
    <TabAtkins> fantasai: I also want to add a note to the spec that we don't expect this to be used, so if you actually need this to work a particular way, let us know.
    <TabAtkins> Rossen: This is the current behavior, too.
    <TabAtkins> Rossen: Objections?
    <fantasai> RESOLVED: For sunk initials, the initial letter box’s start margin edge is anchored to the start edge of the line (after first-line 'text-indent'), and alignment happens afterwards in the remaining space on the line.
    <TabAtkins> fantasai: Third part is initial-letter suppresses justification opportunities between the initial-letter and subsequent text. Specifically about between two characters, not about subsequent spacing, or stretchy characters.
    <TabAtkins> myles: Doesn't that fall out?
    <TabAtkins> fantasai: No, it's considered part of the first line's text.
    <TabAtkins> myles: So when you cneter the first line, that text will include the first letter, even tho we just resolved it won't be centered...
    <myles> So the first line's width is the full width, and justification/centering includes the width of the first letter, but the second line (when the first letter is sunken) has a shortened line-box, and the centering doesn't include the width of the first-letter inside the calculation
    <myles> ?
    <myles> fantasai: yes
    <TabAtkins> Rossen: Any objections?
    <tantek> really hoping to see someone try to implement such details
    <TabAtkins> RESOLVED: sunken initial letters suppress justification between the initial letter and subsequent text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions