You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-inline/Overview.bs
+42-3Lines changed: 42 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -169,6 +169,19 @@ This property specifies styling for dropped, raised, and sunken initial letters.
169
169
170
170
171
171
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
+
-->
172
185
173
186
174
187
<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
220
233
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.
221
234
222
235
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.
<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
255
287
256
288
<h3 id="initial-letter-exclusions">Space Around Initial Letters</h3>
257
289
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.
259
291
260
292
<figure>
261
293
<img alt="3-line drop cap with J, with descender crashing into fourth line of text" src="Dropcap-J-3line-crash.png" width="480">
262
294
<p class="caption">Incorrect: three-line initial letter with descender</p>
263
295
</figure>
264
296
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:
266
300
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>
267
306
307
+
The margin box of the initial letter is then made an exclusion area for subsequent text.
268
308
269
309
<figure>
270
310
<img alt="3-line drop cap with J, but four-line exclusion" src="Dropcap-J-3line-exclude.png" width="480">
271
311
<p class="caption">Correct: text excluded around glyph bounding box</p>
0 commit comments