Skip to content

Commit 133da4a

Browse files
committed
[css-inline] improve definitions of initial letter wrapping
1 parent 94295dc commit 133da4a

8 files changed

Lines changed: 350 additions & 133 deletions

File tree

css-inline/Overview.bs

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -573,41 +573,73 @@ In the <a>inline axis</a>, the position of the inline letter is given by alignin
573573
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.
574574

575575

576-
<h4 id="initial-letter-wrapping">
577-
Initial Letter Wrapping</h4>
576+
<h3 id="initial-letter-wrapping">
577+
Initial Letter Wrapping</h3>
578578

579579
<pre class="propdef">
580580
Name: <dfn id="propdef-initial-letter-wrap">initial-letter-wrap</dfn>
581-
Value: none | auto | first-line
582-
Initial: none
581+
Value: none | all | first | auto
582+
Initial: auto
583583
Applies to: <code>::first-letter</code> pseudo-elements and inline-level first child of a block container
584-
Inherited: no
584+
Inherited: yes
585585
Percentages: N/A
586586
Media: visual
587587
Computed value: as specified
588588
</pre>
589589

590+
This property specifies whether lines impacted by an <a>initial letter</a>
591+
are shortened to fit the rectangular shape of the <a>initial letter</a> box
592+
or follow the contour of its end-edge glyph outline.
593+
590594
<dl dfn-for=initial-letter-wrap dfn-type=value>
591595
<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>
596+
<dd>No contour-fitting is performed:
597+
each impacted line is aligned flush to the end margin edge of the <a>initial letter</a>.</dd>
595598

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).
599+
<dt><dfn>all</dfn></dt>
600+
<dd>For each line of text impacted by the initial letter, the line box adjacent to the intial letter starts at the start-most point that touches the ink of the initial letter, plus the amount of the <a>initial letter</a>’s end-side border+padding+margin.</dd>
597601

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>
601602

602-
Issue: Rewrite for logical directions.
603+
<dt><dfn>first</dfn>
604+
<dd>Behaves as for ''all'' on the first line of the block containing the initial letter and as ''none'' on the rest.</dd>
605+
606+
<dt><dfn>auto</dfn>
607+
<dd>Behaves as ''none'' if
608+
the <a>initial letter</a>’s end-side padding or margin is nonzero <em>or</em>
609+
the first <a>typographic character unit</a> after the <a>initial letter</a> belongs to Unicode General Category Zs <em>or</em>
610+
the last <a>typographic character unit</a> of the <a>initial letter</a>
611+
<ul>
612+
<li>belongs to the Symbols <a>Unicode General Category</a> (<code>S</code>)
613+
<li>has an <a>East Asian Width</a> property of <code>Wide</code> or <code>Fullwidth</code>
614+
<li>belongs to a script that is commonly used without spaces between words.
615+
(Such scripts include:
616+
Cham,
617+
Han,
618+
Khmer,
619+
Lao,
620+
Thai,
621+
Yi
622+
)
623+
</ul>
624+
Behaves as ''first'' otherwise.
603625

604-
Issue: Bikeshed value names.
626+
Issue: Do we want to make this script-dependent?
627+
628+
</dl>
605629

606630

607631
Issue: Do we need anything else for scripts where this behavior is undesirable? Or is default "none" sufficient?
608632

609633

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.
634+
Note: If the next character after the initial letter is a whitespace character, auto and first compute to none, in order to avoid the initial letter appearing to be part of the subsequent word.
635+
636+
637+
<figure>
638+
<img src="images/OpticalKerning.png" alt="optical kerning in the presence or absence of a space after the initial letter" width="200"/>
639+
<p class="caption">In the top paragraph, the initial letter "A" has a word space after it. In the middle paragraph, the initial letter "A" is part of a word. In this case, the first line of text should be kerned into the initial letter's area as shown in the bottom paragraph.</p>
640+
</figure>
641+
642+
Issue: Edit figure to show how auto behaves in varying contexts
611643

612644

613645
<div class="example">
@@ -643,13 +675,13 @@ Text follows shape of initial letter. Each line box should just touch the ink of
643675
<pre>
644676
p::first-letter {
645677
initial-letter: 3;
646-
initial-letter-wrap: first-line;
678+
initial-letter-wrap: first;
647679
}
648680
</pre>
649681

650682
<img alt="text wrapping around dropcap A but only on first line" src="images/A-wraparound-first.png" width="600">
651683

652-
Only first line is moved up against the ink of the initial letter.
684+
Only the first line is moved up against the ink of the initial letter.
653685

654686
</div>
655687

@@ -672,19 +704,9 @@ Only first line is moved up against the ink of the initial letter.
672704

673705
</div>
674706

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.
676707

677708

678-
Additionally, when borders and padding are zero
679-
and the next <a>typographic character unit</a> after the <a>initial letter</a>
680-
is not a space (<a>Unicode general category</a> <code>Zs</code>),
681-
the UA should optically kern the first line of text into the <a>initial letter</a>’s area
682-
as necessary to maintain perceptual continuity of the text.
683709

684-
<figure>
685-
<img src="images/OpticalKerning.png" alt="optical kerning in the presence or absence of a space after the initial letter" width="200"/>
686-
<p class="caption">In the top paragraph, the initial letter "A" has a word space after it. In the middle paragraph, the initial letter "A" is part of a word. In this case, the first line of text should be kerned into the initial letter's area as shown in the bottom paragraph.</p>
687-
</figure>
688710

689711
<h3 id="initial-letter-paragraphs">
690712
Clearing Initial Letters</h3>

0 commit comments

Comments
 (0)