Skip to content

Commit 706fb9e

Browse files
[css-text-3] w3c#8649 Describe the extent of ink overflow from hanging glyphs
1 parent 1a415a2 commit 706fb9e

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

css-text-3/Overview.bs

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ WPT Path Prefix: /css/css-text/
2828
<pre class=link-defaults>
2929
spec:css2; type:dfn; text:document language
3030
spec:css-ruby-1; type:dfn; text:ruby
31+
spec:css-overflow-3; type:dfn; text:ink overflow
3132
</pre>
3233

3334
<style type="text/css">
@@ -6948,7 +6949,7 @@ Hanging Glyphs</h3>
69486949
when measuring the line’s contents for fit, alignment, or justification.
69496950
Depending on the line’s alignment/justification, this can
69506951
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
69526953
when computing [=intrinsic sizes=] ([=min-content size=] and [=max-content size=]),
69536954
and any sizes derived thereof.
69546955
(The interaction of this measurement and kerning is currently UA-defined;
@@ -6961,14 +6962,13 @@ Hanging Glyphs</h3>
69616962
overflow-wrap/overflow-wrap-min-content-size-009.html
69626963
</wpt>
69636964

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
69666966
and still participates in text justification:
69676967
its character advance is just not measured when determining
69686968
how much content fits on the line,
69696969
how much the line’s contents need to be expanded or compressed for justification,
69706970
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
69726972
is re-interpreted as an additional negative margin
69736973
on the affected edge of its parent [=inline box=];
69746974
the line is otherwise laid out as usual.
@@ -6979,6 +6979,8 @@ Hanging Glyphs</h3>
69796979
when the content is editable
69806980
or in other circumstances where treating it as [=scrollable overflow=]
69816981
would be useful to the user.
6982+
[[#text-ink-overflow]] contains additional information about
6983+
[=ink overflow=] from text rendering.
69826984
[[!CSS-OVERFLOW-3]]
69836985

69846986
<wpt>
@@ -7047,7 +7049,7 @@ Hanging Punctuation: the 'hanging-punctuation' property</h4>
70477049
* it is not considered when measuring the line’s contents for […] justification
70487050
* Non-zero inline-axis borders or padding between a hangable mark and the edge of the line prevent the mark from hanging
70497051
* 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>
70517053

70527054
<pre class="propdef">
70537055
Name: hanging-punctuation
@@ -8253,6 +8255,46 @@ Small Kana Mappings</h2>
82538255
text-transform/text-transform-full-size-kana-008.html
82548256
</wpt>
82558257

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+
82568298
<h2 id="priv" class="no-num">
82578299
Privacy Considerations</h2>
82588300

0 commit comments

Comments
 (0)