Skip to content

Commit bc3d229

Browse files
author
dauwhe
committed
[css-inline] Add section on indentation and multi-line effect
1 parent 0b9e19c commit bc3d229

2 files changed

Lines changed: 78 additions & 14 deletions

File tree

css-inline/Overview.bs

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ This property specifies styling for dropped, raised, and sunken initial letters.
169169

170170

171171

172+
<!--
173+
<h4 id="processing-model">Processing Model</h4>
174+
175+
<ol>
176+
<li>Find font size based on alignment points and font metrics. No layout information is required.</li>
177+
178+
<li>Size content box to fit glyph with no overflow. The content box of a non-atomic inline initial letter is the smallest rectangle required to include the entirety of its glyphs and the margin boxes of any atomic inlines it contains.</li>
179+
180+
<li>The initial letter's margin box is placed at the edge of the line. If it has no padding or borders, it is negatively offset by the distance from the start edge of its content box to the point in the content that would have been placed at the start edge of the containing block if it had ''initial-letter: none''.</li>
181+
182+
<li>Exclude content within margin box.</li>
183+
</ol>
184+
-->
172185

173186

174187
<h3 id="aligning-initial-letter">Alignment of Initial Letters</h3>
@@ -220,6 +233,25 @@ If 'initial-letter' is applied to an image or other atomic element that does not
220233
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.
221234

222235

236+
<h3 id="initial-letter-box">
237+
Margins, Borders, and Padding</h3>
238+
239+
Initial letters can be styled with margins, padding, and borders just like any other box. Their vertical alignment and sizing is not affected; however the effective exclusion area is (and corresponds to the margin area).
240+
241+
The inline-axis position of the inline letter is given by aligning its margin edge to the edge of the content box. However, for a non-atomic initial letter with zero padding and borders, there is an additional negative offset so that the first glyph is positioned to the containing block edge as normal. (Note: This requirement is because the start-edge of the glyph's ink area does not always correspond to the start-edge alignment point, which is often chosen for better optical alignment.)
242+
243+
<h3 id="initial-letter-indentation">
244+
Indentation and Multi-line Effects</h3>
245+
246+
'text-indent' and 'hanging-punctuation' apply to the first line of text as normal in the presence of initial letters. Lines affected by the exclusion are shortened, as in the presence of floats, and are affected the same way.
247+
248+
If an initial letter is too long to fit on one line, it wraps (according to the usual text-wrapping rules), each line filled and formatted exactly as if it were the first line and the initial letter too long to fit any subsequent normal text. Any normal text after the initial letter starts on its last line, affected exactly as if that line were the first line.
249+
250+
<!--
251+
]]]]]]]]]]]]
252+
]]]]]=======
253+
============
254+
-->
223255
<h3 id="sizing-initial-letters">Sizing Initial Letters</h3>
224256

225257
<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>
@@ -255,23 +287,30 @@ The line height used in this calculation is the 'line-height' of the containing
255287

256288
<h3 id="initial-letter-exclusions">Space Around Initial Letters</h3>
257289

258-
If an initial letter has a descender, it could crash into the (n+1)th line of text. This is not desirable.
290+
The glyph(s) of an initial letter do not always fit within the specified sink. For example, if an initial letter has a descender, it could crash into the (n+1)th line of text. This is not desirable.
259291

260292
<figure>
261293
<img alt="3-line drop cap with J, with descender crashing into fourth line of text" src="Dropcap-J-3line-crash.png" width="480">
262294
<p class="caption">Incorrect: three-line initial letter with descender</p>
263295
</figure>
264296

265-
Text is excluded around the glyph bounding boxes of the initial letters:
297+
Text is therefore excluded around the glyph bounding boxes of the initial letters.
298+
299+
Specifically, for non-atomic initial letters, the content box of the element is sized to fit:
266300

301+
<ul>
302+
<li>The specified amount of sink (i.e the distance from the top alignment point to the bottom alignment point).
303+
<li>The actual ascent and descent and side bearings of all the glyphs it contains that are part of its inline formatting context, even if they leak outside their em boxes.
304+
<li>The margin boxes of all the atomic inlines it contains that are part of its inline formatting context, even if they leak outside its own line-height.
305+
</ul>
267306

307+
The margin box of the initial letter is then made an exclusion area for subsequent text.
268308

269309
<figure>
270310
<img alt="3-line drop cap with J, but four-line exclusion" src="Dropcap-J-3line-exclude.png" width="480">
271311
<p class="caption">Correct: text excluded around glyph bounding box</p>
272312
</figure>
273313

274-
275314
<h3 id="initial-letter-paragraphs">Clearing Initial Letters</h3>
276315

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

0 commit comments

Comments
 (0)