Skip to content

Commit a1e74b7

Browse files
author
dauwhe
committed
[css-inline] Drop cap size calculation depends only on line height (or baseline grid) of containing block
1 parent fb8d9b0 commit a1e74b7

File tree

2 files changed

+80
-76
lines changed

2 files changed

+80
-76
lines changed

css-inline/Overview.bs

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ A <dfn>drop initial</dfn> is a larger-than-usual letter at the start of a paragr
5656

5757
</div>
5858

59-
Drop initials are all about alignment. Reference points on the drop cap must align precisely with reference points in the text. In Western scripts, the top reference points are the cap height of the initial letter and of the first line of text. The bottom reference points are the baseline of the initial letter and the baseline of the Nth line of text. <a href="#f2">Figure 2</a> shows a simple two-line drop cap, with the relevant reference lines marked.
59+
The exact size and position of a drop cap depends on the alignment of its glyph. [TK] Reference points on the drop cap must align precisely with reference points in the text. In Western scripts, the top reference points are the cap height of the initial letter and of the first line of text. The bottom reference points are the alphabetic baseline of the initial letter and the baseline of the Nth line of text. <a href="#f2">Figure 2</a> shows a simple two-line drop cap, with the relevant reference lines marked.
6060

6161

6262

@@ -69,55 +69,22 @@ Drop initials are all about alignment. Reference points on the drop cap must ali
6969

7070

7171

72-
<div class="note">
73-
<p>The size of a drop initial is determined by the need to satisfy the required alignment. For an N-line drop initial in a Western script, the cap-height of the letter needs to be (N – 1) times the line-height, plus the cap-height of the surrounding text. Note this height is <b>not</b> the font size of the drop initial.</p>
7472

7573

76-
<p>Actually calculating this font size is tricky. For an N-line drop initial, we find the drop initial font size to be:</p>
74+
The alignment constraints for drop initials depend on the writing system. In Japanese, the initial letter extends from the <a>block-start</a> edge of the first line to the <a>block-end</a> edge of the Nth line.
7775

7876

7977
<figure>
80-
<img src="InitialCapEquation.png" width="604" alt="Equation to calcuate drop initial font size"/>
78+
<img src="Initial-2line-JapaneseVertical六.png" width="480" alt="Japanese Vertical Initial"/>
79+
<p class="caption">Two-line drop initial in vertical writing mode</p>
8180
</figure>
8281

83-
<!--
84-
<pre>
85-
Font size of drop cap = ((N-1) * line-height + [cap-height of para] * [font size of paragraph])/[cap-height ratio of drop initial font]
86-
</pre>
87-
-->
88-
89-
<!--
90-
91-
<div>
92-
93-
<math display="block"><mrow><mi>Font size of drop initial</mi><mo>=</mo></mrow><mfrac><mrow><mo>(</mo><mi>N</mi><mo>-</mo><mn>1</mn><mo>)</mo><mo>&#x00D7;</mo><mi>line-height</mi><mo>+</mo><mo>(</mo><mi>cap-height ratio of para font</mi><mo>&#x00D7;</mo><mi>font size of para</mi><mo>)</mo></mrow><mrow><mi>cap-height ratio of drop initial font</mi></mrow></mfrac></math>
94-
</div>
95-
96-
-->
97-
98-
99-
A three-line drop initial in Adobe Minion Pro would have a font size of 61.2pt, given 12pt text, 16pt line-height and a cap-height of 651/1000 (from the font’s OS/2 table).
100-
</div>
101-
102-
103-
The alignment constraints depend on the script used. In Japanese vertical writing mode, it appears that the initial letter extends from the start edge of the first line to the end edge of the Nth line.
104-
10582
<figure>
106-
<img src="CJK-Initial.001.png" width="480" alt="Diagram of Japanese initial letter in vertical writing mode"/>
107-
<p class="caption">Diagram of Japanese initial letter in vertical writing mode</p>
83+
<img src="CJK-Initial.001.png" width="480" alt="Diagram of Japanese initial letter in vertical writing mode"/>
84+
<p class="caption">Diagram of Japanese initial letter in vertical writing mode</p>
10885
</figure>
10986

110-
111-
112-
<figure>
113-
<img src="Initial-2line-JapaneseVertical六.png" width="480" alt="Japanese Vertical Initial"/>
114-
<p class="caption">Two-line drop initial in vertical writing mode</p>
115-
</figure>
116-
<p class="issue">This figure is probably incorrect.</p>
117-
118-
119-
120-
<p class="issue">Add content describing constraint that the block container have a baseline grid (or fixed line-height?).</p>
87+
Note: In some cases, the exclusion area for the drop initial is larger than its glyph in order to preserve inline-axis alignment. This effect is out-of-scope for this level. However, extra spacing can still be given using margins.
12188

12289

12390
<h3 id="selecting-drop-initials">Selecting Initial Letters</h3>
@@ -222,6 +189,8 @@ p::first-letter {
222189

223190

224191

192+
193+
225194
<h3 id="aligning-initial-letter">Alignment of Initial Letters</h3>
226195

227196
As mentioned earlier, the alignment of initial letters depends on the script used. The 'initial-letter-align' property can be used to specify the proper alignment.
@@ -271,7 +240,38 @@ If 'initial-letter' is applied to an image or other atomic element that does not
271240
Issue: Need to decide whether using margin edges or content edges for alignment. Writing Modes uses the margin edges for baseline alignment of replaced elements. There are cases for both content-alignment and margin-alignment for text. In both cases the margin box needs to be excluded.
272241

273242

243+
<h3>Sizing Initial Letters</h3>
244+
245+
<p>The size of a drop initial is determined by the need to satisfy the required alignment. For an N-line drop initial in a Western script, the cap-height of the letter needs to be (N – 1) times the line-height, plus the cap-height of the surrounding text. Note this height is <b>not</b> the font size of the drop initial.</p>
246+
247+
248+
<p>Actually calculating this font size is tricky. For an N-line drop initial, we find the drop initial font size to be:</p>
249+
250+
251+
<figure>
252+
<img src="InitialCapEquation.png" width="604" alt="Equation to calcuate drop initial font size"/>
253+
</figure>
254+
255+
<!--
256+
<pre>
257+
Font size of drop cap = ((N-1) * line-height + [cap-height of para] * [font size of paragraph])/[cap-height ratio of drop initial font]
258+
</pre>
259+
-->
260+
261+
<!--
262+
263+
<div>
274264

265+
<math display="block"><mrow><mi>Font size of drop initial</mi><mo>=</mo></mrow><mfrac><mrow><mo>(</mo><mi>N</mi><mo>-</mo><mn>1</mn><mo>)</mo><mo>&#x00D7;</mo><mi>line-height</mi><mo>+</mo><mo>(</mo><mi>cap-height ratio of para font</mi><mo>&#x00D7;</mo><mi>font size of para</mi><mo>)</mo></mrow><mrow><mi>cap-height ratio of drop initial font</mi></mrow></mfrac></math>
266+
</div>
267+
268+
-->
269+
270+
<div class="example">
271+
A three-line drop initial in Adobe Minion Pro would have a font size of 61.2pt, given 12pt text, 16pt line-height and a cap-height of 651/1000 (from the font’s OS/2 table).
272+
</div>
273+
274+
The line height used in this calculation is the 'line-height' of the containing block (or, in the case where a baseline grid is in use, the baseline-to-baseline spacing required by the baseline grid [[CSS3-LINE-GRID]]). The contents of the lines spanned, and therefore any variation in their heights and positions, is not accounted for.
275275

276276
<h3 id="initial-letter-exclusions">Space Around Initial Letters</h3>
277277

@@ -292,7 +292,7 @@ Text should be excluded around the glyph bounding boxes of the initial letters:
292292
</figure>
293293

294294

295-
<h3 id="initial-letter-paragraphs">Interactions of initial letters with surrounding paragraphs</h3>
295+
<h3 id="initial-letter-paragraphs">Clearing Initial Letters</h3>
296296

297297
<h4 id="raised-sunken-caps">Raised and sunken caps</h4>
298298

@@ -304,6 +304,8 @@ An initial letter does not affect the position of its containing element. For
304304
<p class="caption">Raised cap (<code>initial-letter: 3 1</code>) on right; note that the position of the “C” is the same in both cases, but on the right all text is moved down relative to the initial letter.</p>
305305
</figure>
306306

307+
Issue: Handle glyph ink above cap height of font.
308+
307309

308310
<h4 id="short-para-initial-letter">Short paragraphs with initial letters</h4>
309311

0 commit comments

Comments
 (0)