@@ -28,6 +28,7 @@ WPT Path Prefix: /css/css-text/
28
28
<pre class=link-defaults>
29
29
spec:css2; type:dfn; text:document language
30
30
spec:css-ruby-1; type:dfn; text:ruby
31
+ spec:css-overflow-3; type:dfn; text:ink overflow
31
32
</pre>
32
33
33
34
<style type="text/css">
@@ -6948,7 +6949,7 @@ Hanging Glyphs</h3>
6948
6949
when measuring the line’s contents for fit, alignment, or justification.
6949
6950
Depending on the line’s alignment/justification, this can
6950
6951
result in the mark being placed outside the line box.
6951
- The [= hanging=] glyph is also not taken into account
6952
+ The <dfn> hanging glyph</dfn> is also not taken into account
6952
6953
when computing [=intrinsic sizes=] ([=min-content size=] and [=max-content size=] ),
6953
6954
and any sizes derived thereof.
6954
6955
(The interaction of this measurement and kerning is currently UA-defined;
@@ -6961,14 +6962,13 @@ Hanging Glyphs</h3>
6961
6962
overflow-wrap/overflow-wrap-min-content-size-009.html
6962
6963
</wpt>
6963
6964
6964
- A <dfn><a lt=hang>hanging</a> glyph</dfn>
6965
- is still enclosed inside its parent inline box
6965
+ A [=hanging glyph=] is still enclosed inside its parent inline box
6966
6966
and still participates in text justification:
6967
6967
its character advance is just not measured when determining
6968
6968
how much content fits on the line,
6969
6969
how much the line’s contents need to be expanded or compressed for justification,
6970
6970
or how to position the content within the line box for text alignment.
6971
- Effectively, the [=hanging=] glyph character advance
6971
+ Effectively, the [=hanging glyph=] character advance
6972
6972
is re-interpreted as an additional negative margin
6973
6973
on the affected edge of its parent [=inline box=] ;
6974
6974
the line is otherwise laid out as usual.
@@ -6979,6 +6979,8 @@ Hanging Glyphs</h3>
6979
6979
when the content is editable
6980
6980
or in other circumstances where treating it as [=scrollable overflow=]
6981
6981
would be useful to the user.
6982
+ [[#text-ink-overflow]] contains additional information about
6983
+ [=ink overflow=] from text rendering.
6982
6984
[[!CSS-OVERFLOW-3]]
6983
6985
6984
6986
<wpt>
@@ -7047,7 +7049,7 @@ Hanging Punctuation: the 'hanging-punctuation' property</h4>
7047
7049
* it is not considered when measuring the line’s contents for […] justification
7048
7050
* Non-zero inline-axis borders or padding between a hangable mark and the edge of the line prevent the mark from hanging
7049
7051
* At most one punctuation character may hang at each edge of the line.
7050
- * should be treated as ink overflow"></wpt>
7052
+ * should be treated as [= ink overflow=] "></wpt>
7051
7053
7052
7054
<pre class="propdef">
7053
7055
Name : hanging-punctuation
@@ -8253,6 +8255,46 @@ Small Kana Mappings</h2>
8253
8255
text-transform/text-transform-full-size-kana-008.html
8254
8256
</wpt>
8255
8257
8258
+ <h2 id="text-ink-overflow" class="no-num">
8259
+ Appendix H:
8260
+ Ink Overflow from Text</h2>
8261
+
8262
+ <p><em> This appendix is non-normative.</em></p>
8263
+
8264
+ <div class="example">
8265
+ <p> The example below demonstrates a [=hanging glyph=] .</p>
8266
+ <div class="figure" style="margin:0; font-size:10rem; font-family:garamond; font-style:italic">
8267
+ <span style="display:inline-block; width:1ch; height:1lh; background:green; opacity:0.5"></span><span style="vertical-align: top;"> f</span><span style="display:inline-block; width:1ch; height:1lh; background:green; opacity:0.5"></span>
8268
+ </div>
8269
+ </div>
8270
+
8271
+ Because [=hanging glyphs=] are considered [=ink overflow=] ,
8272
+ and hence are not included in [=inline box=] geometry,
8273
+ there is no straightforward way to measure their extent,
8274
+ or to pre-compute padding or margin lengths that will
8275
+ prevent [=hanging glyphs=] from overlapping adjacent content.
8276
+ The extent of [=ink overflow=] from [=hanging glyphs=]
8277
+ is determined by the font rendering system,
8278
+ and beyond the scope of this specification.
8279
+
8280
+ However, any two conforming browser implementations,
8281
+ when rendering a given piece of text content
8282
+ using a given font in a supported format
8283
+ (see [[css-fonts-4#font-format-definitions]] ),
8284
+ will produce identically-sized [=ink overflow rectangles=] ,
8285
+ within a 2-pixel margin of error.
8286
+
8287
+ A practical way to prevent [=hanging glyphs=] from
8288
+ overlapping adjacent content is to load the target
8289
+ content in any conforming web browser, gauge the extent
8290
+ of [=ink overflow=] from [=hanging glyphs=] via visual inspection,
8291
+ and adjust padding/margin lengths to avoid overlap, plus
8292
+ an extra two pixels to allow for variations between implementations.
8293
+ This should be sufficient to prevent unwanted overlap in all
8294
+ conforming implementations without the necessity of testing
8295
+ each implementation individually.
8296
+
8297
+
8256
8298
<h2 id="priv" class="no-num">
8257
8299
Privacy Considerations</h2>
8258
8300
0 commit comments