Skip to content

Commit c3dc681

Browse files
committed
[css-inline] add hanging value to initial letter align as cap height will not work
1 parent db74dd2 commit c3dc681

2 files changed

Lines changed: 37 additions & 17 deletions

File tree

css-inline/Overview.bs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ As mentioned earlier, the alignment of initial letters depends on the script use
426426

427427
<pre class="propdef" id="initial-letter-align">
428428
Name: <dfn id="propdef-initial-letter-align">initial-letter-align</dfn>
429-
Value: border-box? [ alphabetic | ideographic | hebrew ] | border-box
429+
Value: border-box? [ alphabetic | ideographic | hebrew | hanging ] | border-box
430430
Initial: alphabetic
431431
Applies to: <code>::first-letter</code> pseudo elements and inline level first child of a block container
432432
Inherited: yes
@@ -455,6 +455,10 @@ Values have the following meanings:
455455
<dd>Use the alphabetic and (as yet theoretical) hebrew hanging baseline of the surrounding text
456456
to align the <a>initial letter</a>.
457457

458+
<dt><dfn>hanging</dfn>
459+
<dd>Use the alphabetic and hanging baselines of the surrounding text
460+
to align the <a>initial letter</a>.
461+
458462
<dt><dfn>border-box</dfn>
459463
<dd>Uses the <a>initial letter box</a>’s <a>line-over</a> and <a>line-under</a> border edges
460464
as the <a>over</a> and <a>under</a> alignment points, respectively.
@@ -485,7 +489,7 @@ are automatically determined from its contents:
485489
</ol>
486490

487491
Note: The ordering of keywords in this property is fixed in case ''border-box''
488-
is expanded to ''[ border-box | alphabetic | ideographic | hebrew ]''
492+
is expanded to ''[ border-box | alphabetic | ideographic | hebrew | hanging ]''
489493
to allow explicitly specifying the <a>initial letter</a>’s alignment points.
490494

491495
<h4 id="initial-letter-align-defaults">
@@ -501,6 +505,9 @@ UAs must include in their default UA style sheet the following rules:
501505
[lang|=iw], [lang|=yi], [lang|=lad], [lang|=jrb] {
502506
initial-letter-align: hebrew;
503507
}
508+
[lang|=hi], [lang|=mr], [lang|=ne], , [lang|=pi], [lang|=kok], [lang|=brx], [lang|=mai], [lang|=sd], [lang|=sa] {
509+
initial-letter-align: hanging;
510+
}
504511
</pre>
505512

506513
Issue: We don't have a way to do subtag selection with attr selectors.

css-inline/Overview.html

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<h1 class="p-name no-ref" id="title">CSS Inline Layout Module Level 3</h1>
9191

9292
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft,
93-
<time class="dt-updated" datetime="2015-08-12">12 August 2015</time></span></h2>
93+
<time class="dt-updated" datetime="2015-08-27">27 August 2015</time></span></h2>
9494

9595
<div data-fill-with="spec-metadata">
9696
<dl>
@@ -613,12 +613,12 @@ <h4 class="heading settled" data-level="1.2.2" id="baseline-shift-property"><spa
613613

614614
<dl>
615615

616-
<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>
616+
<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>
617617

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

620620

621-
<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>
621+
<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>
622622

623623
<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>.
624624

@@ -685,7 +685,7 @@ <h4 class="heading settled" data-level="2.1.1" id="drop-initial"><span class="se
685685
</figure>
686686

687687

688-
<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>
688+
<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>
689689

690690

691691
<figure>
@@ -809,11 +809,11 @@ <h3 class="heading settled" data-level="2.3" id="sizing-drop-initials"><span cla
809809

810810
<dd>No special initial-letter effect. Text behaves as normal.
811811

812-
<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>
812+
<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>
813813

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

816-
<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>
816+
<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>
817817

818818
<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.
819819
</dl>
@@ -934,7 +934,7 @@ <h3 class="heading settled" data-level="2.4" id="aligning-initial-letter"><span
934934
<td><dfn class="css" data-dfn-type="property" data-export="" id="propdef-initial-letter-align">initial-letter-align<a class="self-link" href="#propdef-initial-letter-align"></a></dfn>
935935
<tr class="value">
936936
<th>Value:
937-
<td class="prod">border-box<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#mult-opt">?</a> [ alphabetic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> ideographic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hebrew ] <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> border-box
937+
<td class="prod">border-box<a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#mult-opt">?</a> [ alphabetic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> ideographic <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hebrew <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> hanging ] <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#comb-one">|</a> border-box
938938
<tr>
939939
<th>Initial:
940940
<td>alphabetic
@@ -987,9 +987,15 @@ <h3 class="heading settled" data-level="2.4" id="aligning-initial-letter"><span
987987
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
988988

989989

990+
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-hanging">hanging<a class="self-link" href="#valdef-initial-letter-align-hanging"></a></dfn>
991+
992+
<dd>Use the alphabetic and hanging baselines of the surrounding text
993+
to align the <a data-link-type="dfn" href="#initial-letter">initial letter</a>.
994+
995+
990996
<dt><dfn class="css" data-dfn-for="initial-letter-align" data-dfn-type="value" data-export="" id="valdef-initial-letter-align-border-box">border-box<a class="self-link" href="#valdef-initial-letter-align-border-box"></a></dfn>
991997

992-
<dd>Uses the <a data-link-type="dfn" href="#initial-letter">initial letter box</a>’s <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> border edges
998+
<dd>Uses the <a data-link-type="dfn" href="#initial-letter">initial letter box</a>’s <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> border edges
993999
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.
9941000
</dl>
9951001

@@ -1027,7 +1033,7 @@ <h3 class="heading settled" data-level="2.4" id="aligning-initial-letter"><span
10271033

10281034

10291035
<p class="note" role="note">Note: The ordering of keywords in this property is fixed in case <a class="css" data-link-type="maybe" href="#valdef-initial-letter-align-border-box">border-box</a>
1030-
is expanded to <span class="css">[ border-box | alphabetic | ideographic | hebrew ]</span>
1036+
is expanded to <span class="css">[ border-box | alphabetic | ideographic | hebrew | hanging ]</span>
10311037
to allow explicitly specifying the <a data-link-type="dfn" href="#initial-letter">initial letter</a>’s alignment points.</p>
10321038

10331039

@@ -1045,6 +1051,9 @@ <h4 class="heading settled" data-level="2.4.1" id="initial-letter-align-defaults
10451051
[lang|=iw], [lang|=yi], [lang|=lad], [lang|=jrb] {
10461052
initial-letter-align: hebrew;
10471053
}
1054+
[lang|=hi], [lang|=mr], [lang|=ne], , [lang|=pi], [lang|=kok], [lang|=brx], [lang|=mai], [lang|=sd], [lang|=sa] {
1055+
initial-letter-align: hanging;
1056+
}
10481057
</pre>
10491058

10501059

@@ -1649,7 +1658,11 @@ <h3 class="no-num heading settled" id="index-defined-here"><span class="content"
16491658
<li><a href="#dropped-initial">dropped initial</a><span>, in §2.1.1</span>
16501659
<li><a href="#valdef-initial-letter-wrap-first">first</a><span>, in §2.8</span>
16511660
<li><a href="#valdef-initial-letter-wrap-grid">grid</a><span>, in §2.8</span>
1652-
<li><a href="#valdef-dominant-baseline-hanging">hanging</a><span>, in §1.1</span>
1661+
<li>hanging
1662+
<ul>
1663+
<li><a href="#valdef-dominant-baseline-hanging">value for dominant-baseline</a><span>, in §1.1</span>
1664+
<li><a href="#valdef-initial-letter-align-hanging">value for initial-letter-align</a><span>, in §2.4</span>
1665+
</ul>
16531666
<li><a href="#valdef-initial-letter-align-hebrew">hebrew</a><span>, in §2.4</span>
16541667
<li><a href="#valdef-initial-letter-align-ideographic">ideographic</a><span>, in §2.4</span>
16551668
<li><a href="#propdef-initial-letter">initial-letter</a><span>, in §2.3</span>
@@ -1719,11 +1732,11 @@ <h3 class="no-num heading settled" id="index-defined-elsewhere"><span class="con
17191732
<li><a data-link-type="biblio" href="#biblio-css-writing-modes-3">[css-writing-modes-3]</a> defines the following terms:
17201733
<ul>
17211734
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block-axis">block axis</a>
1722-
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block_end">block-end</a>
1723-
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block_start">block-start</a>
1735+
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block-end">block-end</a>
1736+
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#block-start">block-start</a>
17241737
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#inline-axis">inline axis</a>
1725-
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#line_over">line-over</a>
1726-
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#line_under">line-under</a>
1738+
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#line-over">line-over</a>
1739+
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#line-under">line-under</a>
17271740
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-mixed">mixed</a>
17281741
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#over">over</a>
17291742
<li><a href="https://drafts.csswg.org/css-writing-modes-3/#valdef-text-orientation-sideways">sideways</a>
@@ -1842,7 +1855,7 @@ <h2 class="no-num heading settled" id="property-index"><span class="content">Pro
18421855
<td>as specified
18431856
<tr>
18441857
<th scope="row"><a class="css" data-link-type="property" href="#propdef-initial-letter-align">initial-letter-align</a>
1845-
<td>border-box? [ alphabetic | ideographic | hebrew ] | border-box
1858+
<td>border-box? [ alphabetic | ideographic | hebrew | hanging ] | border-box
18461859
<td>alphabetic
18471860
<td>::first-letter pseudo elements and inline level first child of a block container
18481861
<td>yes

0 commit comments

Comments
 (0)