Skip to content

Commit 94295dc

Browse files
committed
[css-inline] add section on wrapping around initial letters
1 parent 39df811 commit 94295dc

1 file changed

Lines changed: 111 additions & 0 deletions

File tree

css-inline/Overview.bs

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,14 @@ If 'initial-letter' is applied to an image or other atomic element that does not
457457

458458
Note: For 'vertical-align', the alignment points of an atomic inline are synthesized from the margin edges. [[CSS3-WRITING-MODES]]
459459

460+
461+
462+
463+
464+
465+
466+
467+
460468
<h3 id="initial-letter-box">
461469
Margins, Borders, and Padding</h3>
462470

@@ -564,6 +572,109 @@ In the <a>inline axis</a>, the position of the inline letter is given by alignin
564572

565573
However, if the <a>initial letter</a> is a non-atomic inline with zero padding and borders, the UA must apply an additional negative offset on the start side of the amount necessary to optically align the first glyph to the containing block edge as it would be in normal text.
566574

575+
576+
<h4 id="initial-letter-wrapping">
577+
Initial Letter Wrapping</h4>
578+
579+
<pre class="propdef">
580+
Name: <dfn id="propdef-initial-letter-wrap">initial-letter-wrap</dfn>
581+
Value: none | auto | first-line
582+
Initial: none
583+
Applies to: <code>::first-letter</code> pseudo-elements and inline-level first child of a block container
584+
Inherited: no
585+
Percentages: N/A
586+
Media: visual
587+
Computed value: as specified
588+
</pre>
589+
590+
<dl dfn-for=initial-letter-wrap dfn-type=value>
591+
<dt><dfn>none</dfn>
592+
<dd>No wrapping is performed.</dd>
593+
<dt><dfn>auto</dfn></dt>
594+
<dd>For each line of text impacted by the initial letter, the line box adjacent to the intial letter starts at the left-most point that touches the ink of the initial letter, plus a fixed amount of offset.</dd>
595+
596+
Issue: How much offset? Based on the right side-bearing of the initial letter? That could be a problem as it's sometimes negative (see Zapfino).
597+
598+
<dt><dfn>first-line</dfn>
599+
<dd>As auto, but wrapping only performed on the first line of the block containing the initial letter.</dd>
600+
</dl>
601+
602+
Issue: Rewrite for logical directions.
603+
604+
Issue: Bikeshed value names.
605+
606+
607+
Issue: Do we need anything else for scripts where this behavior is undesirable? Or is default "none" sufficient?
608+
609+
610+
Note: If the next character after the initial letter is a whitespace character, auto and first-line compute to none, in order to avoid the initial letter appearing to be part of the subsequent word.
611+
612+
613+
<div class="example">
614+
<pre>
615+
p::first-letter {
616+
initial-letter: 3;
617+
initial-letter-wrap: none;
618+
}
619+
</pre>
620+
621+
<img alt="regular dropcap A" src="images/A-wraparound-none.png" width="600">
622+
623+
Ordinary initial letter with no wrapping.
624+
</figure>
625+
</div>
626+
627+
628+
<div class="example">
629+
<pre>
630+
p::first-letter {
631+
initial-letter: 3;
632+
initial-letter-wrap: auto;
633+
}
634+
</pre>
635+
<img alt="text wrapping around dropcap A" src="images/A-wraparound.png" width="600">
636+
637+
Text follows shape of initial letter. Each line box should just touch the ink of the letter, with some offset (represented by the shaded box).
638+
639+
</div>
640+
641+
642+
<div class="example">
643+
<pre>
644+
p::first-letter {
645+
initial-letter: 3;
646+
initial-letter-wrap: first-line;
647+
}
648+
</pre>
649+
650+
<img alt="text wrapping around dropcap A but only on first line" src="images/A-wraparound-first.png" width="600">
651+
652+
Only first line is moved up against the ink of the initial letter.
653+
654+
</div>
655+
656+
657+
<div class="example">
658+
659+
<img alt="text wrapping around dropcap V" src="images/V-wraparound.png" width="600">
660+
661+
</div>
662+
663+
<div class="example">
664+
665+
<img alt="text wrapping around dropcap P" src="images/P-wraparound.png" width="600">
666+
667+
</div>
668+
669+
<div class="example">
670+
671+
<img alt="text wrapping around dropcap W" src="images/W-wraparound.png" width="600">
672+
673+
</div>
674+
675+
Issue: What should happen with initial letters that are concave on the (right) side? Wrapping the middle line in a three-line initial "K" can look very strange.
676+
677+
567678
Additionally, when borders and padding are zero
568679
and the next <a>typographic character unit</a> after the <a>initial letter</a>
569680
is not a space (<a>Unicode general category</a> <code>Zs</code>),

0 commit comments

Comments
 (0)