Skip to content

Commit 422ceb8

Browse files
committed
[css-inline] Add character-grid value to initial-letter-align, to show how it could be done.
1 parent d5abff0 commit 422ceb8

2 files changed

Lines changed: 69 additions & 24 deletions

File tree

css-inline/Overview.bs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ Initial Letter Wrapping</h3>
589589

590590
<pre class="propdef">
591591
Name: <dfn id="propdef-initial-letter-wrap">initial-letter-wrap</dfn>
592-
Value: none | all | first | auto
592+
Value: none | first | all | auto | grid
593593
Initial: auto
594594
Applies to: <code>::first-letter</code> pseudo-elements and inline-level first child of a block container
595595
Inherited: yes
@@ -607,12 +607,13 @@ or follow the contour of its end-edge glyph outline.
607607
<dd>No contour-fitting is performed:
608608
each impacted line is aligned flush to the end margin edge of the <a>initial letter</a>.</dd>
609609

610+
<dt><dfn>first</dfn>
611+
<dd>Behaves as for ''all'' on the first line of the block containing the initial letter and as ''none'' on the rest.</dd>
612+
610613
<dt><dfn>all</dfn></dt>
611614
<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>
612615

613-
614-
<dt><dfn>first</dfn>
615-
<dd>Behaves as for ''all'' on the first line of the block containing the initial letter and as ''none'' on the rest.</dd>
616+
This value is at-risk.
616617

617618
<dt><dfn>auto</dfn>
618619
<dd>Behaves as ''none'' if
@@ -621,7 +622,7 @@ the first <a>typographic character unit</a> after the <a>initial letter</a> belo
621622
the last <a>typographic character unit</a> of the <a>initial letter</a>
622623
<ul>
623624
<li>belongs to the Symbols <a>Unicode General Category</a> (<code>S</code>)
624-
<li>has an <a>East Asian Width</a> property of <code>Wide</code> or <code>Fullwidth</code>
625+
<li>has an East Asian Width property of <code>Wide</code> or <code>Fullwidth</code>
625626
<li>belongs to a script that is commonly used without spaces between words.
626627
(Such scripts include:
627628
Cham,
@@ -634,8 +635,23 @@ the last <a>typographic character unit</a> of the <a>initial letter</a>
634635
</ul>
635636
Behaves as ''first'' otherwise.
636637

637-
Issue: Do we want to make this script-dependent?
638+
Issue: Do we want to make this script-dependent?
639+
640+
<dt><dfn>grid</dfn>
641+
<dd>This value is the same as ''none'',
642+
except that the exclusion area of the impacted lines
643+
is increased as necessary for its end-edge to land on the character grid.
644+
The 'justify-self' property can then be used to align the initial letter box
645+
within the exclusion area.
646+
647+
The heuristic for matching the character grid is
648+
1em &times; <var>n</var> + 'letter-spacing' &times; (<var>n</var> - 1),
649+
where <var>n</var> is the size of the initial letter
650+
as specified by the 'initial-letter' property,
651+
and 1em represents the typical character advance width for ideographic characters
652+
(and may be replaced by a more accurate value if known).
638653

654+
This value is also at-risk.
639655
</dl>
640656

641657

css-inline/Overview.html

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,12 @@ <h4 class="heading settled" data-level="1.2.2" id="baseline-shift-property"><spa
606606

607607
<dl>
608608

609-
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-length"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value" title="Expands to: ">&lt;length></a><a class="self-link" href="#valdef-baseline-shift-length"></a></dfn>
609+
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-length"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#length-value">&lt;length></a><a class="self-link" href="#valdef-baseline-shift-length"></a></dfn>
610610

611611
<dd>Raise (positive value) or lower (negative value) by the specified length.
612612

613613

614-
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-percentage"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value" title="Expands to: ">&lt;percentage></a><a class="self-link" href="#valdef-baseline-shift-percentage"></a></dfn>
614+
<dt><dfn class="css" data-dfn-for="baseline-shift" data-dfn-type="value" data-export="" id="valdef-baseline-shift-percentage"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#percentage-value">&lt;percentage></a><a class="self-link" href="#valdef-baseline-shift-percentage"></a></dfn>
615615

616616
<dd>Raise (positive value) or lower (negative value) by the specified percentage of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height">line-height</a>.
617617

@@ -678,7 +678,7 @@ <h4 class="heading settled" data-level="2.1.1" id="drop-initial"><span class="se
678678
</figure>
679679

680680

681-
<p>The alignment constraints for drop initials depend on the writing system. In ideographic scripts, the initial letter extends from the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block-start">block-start</a> edge of the first line to the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block-end">block-end</a> edge of the Nth line.</p>
681+
<p>The alignment constraints for drop initials depend on the writing system. In ideographic scripts, the initial letter extends from the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block_start">block-start</a> edge of the first line to the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#block_end">block-end</a> edge of the Nth line.</p>
682682

683683

684684
<figure>
@@ -812,11 +812,11 @@ <h3 class="heading settled" data-level="2.3" id="sizing-drop-initials"><span cla
812812

813813
<dd>No special initial-letter effect. Text behaves as normal.
814814

815-
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-number"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#number-value" title="Expands to: ">&lt;number></a><a class="self-link" href="#valdef-initial-letter-number"></a></dfn>
815+
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-number"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#number-value">&lt;number></a><a class="self-link" href="#valdef-initial-letter-number"></a></dfn>
816816

817817
<dd>This first argument defines the size of the initial letter, in terms of how many lines it occupies. Negative values are not allowed.
818818

819-
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-integer"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#integer-value" title="Expands to: ">&lt;integer></a><a class="self-link" href="#valdef-initial-letter-integer"></a></dfn>
819+
<dt><dfn class="css" data-dfn-for="initial-letter" data-dfn-type="value" data-export="" id="valdef-initial-letter-integer"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-values-3/#integer-value">&lt;integer></a><a class="self-link" href="#valdef-initial-letter-integer"></a></dfn>
820820

821821
<dd>This optional second argument argument defines the number of lines the initial letter should sink. Values must be greater than zero. If omitted, it duplicates the first argument, floored to the nearest positive whole number.
822822
</dl>
@@ -946,13 +946,13 @@ <h3 class="heading settled" data-level="2.4" id="aligning-initial-letter"><span
946946

947947
<dt>margin-box
948948

949-
<dd>Uses the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line-over">line-over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line-under">line-under</a> margin edges
949+
<dd>Uses the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line_over">line-over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line_under">line-under</a> margin edges
950950
as the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> alignment points, respectively.
951951

952952

953953
<dt>content-box
954954

955-
<dd>Uses the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line-over">line-over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line-under">line-under</a> content edges
955+
<dd>Uses the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line_over">line-over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#line_under">line-under</a> content edges
956956
as the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> alignment points, respectively.
957957
(In most cases, these will correspond to
958958
the <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a> and <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-3/#under">under</a> edges of the glyph bounding box.)
@@ -1130,7 +1130,7 @@ <h3 class="heading settled" data-level="2.10" id="initial-letter-wrapping"><span
11301130
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-initial-letter-wrap">initial-letter-wrap<a class="self-link" href="#propdef-initial-letter-wrap"></a></dfn>
11311131
<tr class="value">
11321132
<th>Value:
1133-
<td class="prod">none <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> all <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> first <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> auto
1133+
<td class="prod">none <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> first <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> all <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> auto <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> grid
11341134
<tr>
11351135
<th>Initial:
11361136
<td>auto
@@ -1167,15 +1167,17 @@ <h3 class="heading settled" data-level="2.10" id="initial-letter-wrapping"><span
11671167
each impacted line is aligned flush to the end margin edge of the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
11681168

11691169

1170-
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-all">all<a class="self-link" href="#valdef-initial-letter-wrap-all"></a></dfn>
1170+
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-first">first<a class="self-link" href="#valdef-initial-letter-wrap-first"></a></dfn>
11711171

1172-
<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 data-link-type="dfn" href="#initial-letter">initial letter</a>’s end-side border+padding+margin.
1172+
<dd>Behaves as for <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-all">all</a> on the first line of the block containing the initial letter and as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a> on the rest.
11731173

11741174

1175+
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-all">all<a class="self-link" href="#valdef-initial-letter-wrap-all"></a></dfn>
11751176

1176-
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-first">first<a class="self-link" href="#valdef-initial-letter-wrap-first"></a></dfn>
1177+
<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 data-link-type="dfn" href="#initial-letter">initial letter</a>’s end-side border+padding+margin.
11771178

1178-
<dd>Behaves as for <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-all">all</a> on the first line of the block containing the initial letter and as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a> on the rest.
1179+
1180+
<p>This value is at-risk.</p>
11791181

11801182

11811183
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-auto">auto<a class="self-link" href="#valdef-initial-letter-wrap-auto"></a></dfn>
@@ -1189,7 +1191,7 @@ <h3 class="heading settled" data-level="2.10" id="initial-letter-wrapping"><span
11891191

11901192
<li>belongs to the Symbols <a data-link-type="dfn" href="https://drafts.csswg.org/css-text-3/#unicode-general-category">Unicode General Category</a> (<code>S</code>)
11911193

1192-
<li>has an <a data-link-type="dfn">East Asian Width</a> property of <code>Wide</code> or <code>Fullwidth</code>
1194+
<li>has an East Asian Width property of <code>Wide</code> or <code>Fullwidth</code>
11931195

11941196
<li>belongs to a script that is commonly used without spaces between words.
11951197
(Such scripts include:
@@ -1206,6 +1208,25 @@ <h3 class="heading settled" data-level="2.10" id="initial-letter-wrapping"><span
12061208

12071209
<p class="issue" id="issue-36a8e5f0"><a class="self-link" href="#issue-36a8e5f0"></a> Do we want to make this script-dependent?</p>
12081210

1211+
1212+
<dt><dfn class="css" data-dfn-for="initial-letter-wrap" data-dfn-type="value" data-export="" id="valdef-initial-letter-wrap-grid">grid<a class="self-link" href="#valdef-initial-letter-wrap-grid"></a></dfn>
1213+
1214+
<dd>This value is the same as <a class="css" data-link-type="maybe" href="#valdef-initial-letter-wrap-none">none</a>,
1215+
except that the exclusion area of the impacted lines
1216+
is increased as necessary for its end-edge to land on the character grid.
1217+
The <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-align-3/#propdef-justify-self">justify-self</a> property can then be used to align the initial letter box
1218+
within the exclusion area.
1219+
1220+
1221+
<p>The heuristic for matching the character grid is
1222+
1em × <var>n</var> + <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-letter-spacing">letter-spacing</a> × (<var>n</var> - 1),
1223+
where <var>n</var> is the size of the initial letter
1224+
as specified by the <a class="property" data-link-type="propdesc" href="#propdef-initial-letter">initial-letter</a> property,
1225+
and 1em represents the typical character advance width for ideographic characters
1226+
(and may be replaced by a more accurate value if known).</p>
1227+
1228+
1229+
<p>This value is also at-risk.</p>
12091230
</dl>
12101231

12111232

@@ -1584,6 +1605,7 @@ <h3 class="no-num heading settled" id="index-defined-here"><span class="content"
15841605
<li><a href="#propdef-dominant-baseline">dominant-baseline</a><span>, in §1.1</span>
15851606
<li><a href="#dropped-initial">dropped initial</a><span>, in §2.1.1</span>
15861607
<li><a href="#valdef-initial-letter-wrap-first">first</a><span>, in §2.10</span>
1608+
<li><a href="#valdef-initial-letter-wrap-grid">grid</a><span>, in §2.10</span>
15871609
<li><a href="#valdef-dominant-baseline-hanging">hanging</a><span>, in §1.1</span>
15881610
<li><a href="#propdef-initial-letter">initial-letter</a><span>, in §2.3</span>
15891611
<li><a href="#initial-letter">initial letter</a><span>, in §2.3</span>
@@ -1622,9 +1644,14 @@ <h3 class="no-num heading settled" id="index-defined-here"><span class="content"
16221644
</ul>
16231645
<h3 class="no-num heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
16241646
<ul class="indexlist">
1647+
<li><a data-link-type="biblio" href="#biblio-css-align-3">[css-align-3]</a> defines the following terms:
1648+
<ul>
1649+
<li><a href="https://drafts.csswg.org/css-align-3/#propdef-justify-self">justify-self</a>
1650+
</ul>
16251651
<li><a data-link-type="biblio" href="#biblio-css-text-3">[css-text-3]</a> defines the following terms:
16261652
<ul>
16271653
<li><a href="https://drafts.csswg.org/css-text-3/#propdef-hanging-punctuation">hanging-punctuation</a>
1654+
<li><a href="https://drafts.csswg.org/css-text-3/#propdef-letter-spacing">letter-spacing</a>
16281655
<li><a href="https://drafts.csswg.org/css-text-3/#propdef-text-indent">text-indent</a>
16291656
<li><a href="https://drafts.csswg.org/css-text-3/#typographic-character-unit">typographic character unit</a>
16301657
<li><a href="https://drafts.csswg.org/css-text-3/#unicode-general-category">unicode general category</a>
@@ -1642,11 +1669,11 @@ <h3 class="no-num heading settled" id="index-defined-elsewhere"><span class="con
16421669
<li><a data-link-type="biblio" href="#biblio-css-writing-modes-3">[css-writing-modes-3]</a> defines the following terms:
16431670
<ul>
16441671
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block-axis">block axis</a>
1645-
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block-end">block-end</a>
1646-
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block-start">block-start</a>
1672+
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block_end">block-end</a>
1673+
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block_start">block-start</a>
16471674
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#inline-axis">inline axis</a>
1648-
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#line-over">line-over</a>
1649-
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#line-under">line-under</a>
1675+
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#line_over">line-over</a>
1676+
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#line_under">line-under</a>
16501677
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-mixed">mixed</a>
16511678
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a>
16521679
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-sideways">sideways</a>
@@ -1667,6 +1694,8 @@ <h3 class="no-num heading settled" id="normative"><span class="content">Normativ
16671694
<dl>
16681695
<dt id="biblio-css21"><a class="self-link" href="#biblio-css21"></a>[CSS21]
16691696
<dd>Bert Bos; et al. <a href="http://www.w3.org/TR/CSS2">Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. REC. URL: <a href="http://www.w3.org/TR/CSS2">http://www.w3.org/TR/CSS2</a>
1697+
<dt id="biblio-css-align-3"><a class="self-link" href="#biblio-css-align-3"></a>[CSS-ALIGN-3]
1698+
<dd>Elika Etemad; Tab Atkins Jr.. <a href="http://www.w3.org/TR/css-align-3/">CSS Box Alignment Module Level 3</a>. 18 December 2014. WD. URL: <a href="http://www.w3.org/TR/css-align-3/">http://www.w3.org/TR/css-align-3/</a>
16701699
<dt id="biblio-css-text-3"><a class="self-link" href="#biblio-css-text-3"></a>[CSS-TEXT-3]
16711700
<dd>Elika Etemad; Koji Ishii. <a href="http://www.w3.org/TR/css-text-3/">CSS Text Module Level 3</a>. 10 October 2013. LCWD. URL: <a href="http://www.w3.org/TR/css-text-3/">http://www.w3.org/TR/css-text-3/</a>
16721701
<dt id="biblio-css-values"><a class="self-link" href="#biblio-css-values"></a>[CSS-VALUES]
@@ -1765,7 +1794,7 @@ <h2 class="no-num heading settled" id="property-index"><span class="content">Pro
17651794
<td>specified value
17661795
<tr>
17671796
<th scope="row"><a class="css" data-link-type="property" href="#propdef-initial-letter-wrap">initial-letter-wrap</a>
1768-
<td>none | all | first | auto
1797+
<td>none | first | all | auto | grid
17691798
<td>auto
17701799
<td>::first-letter pseudo-elements and inline-level first child of a block container
17711800
<td>yes

0 commit comments

Comments
 (0)