Skip to content

Commit 0cb8202

Browse files
committed
[css-inline-3] Define em-over and em-under baselines for Canvas API. #5312
1 parent 19c0eb5 commit 0cb8202

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

css-inline-3/Overview.bs

+46-5
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,18 @@ Baselines and Metrics</h3>
428428
<dd>
429429
Corresponds to the metric used as the [=line-under=] edge
430430
of an [=inline box|inline=]’s [=content box=] per [[CSS2]].
431+
432+
<dt><dfn lt="em-over baseline" local-lt="em-over">em-over</dfn>
433+
<dd>
434+
Corresponds to a conceptual [=ascent=] normalized
435+
to ensure 1em between [=em-over=] and [=em-under=].
436+
See [[#baseline-synthesis-em]].
437+
438+
<dt><dfn lt="em-under baseline" local-lt="em-under">em-under</dfn>
439+
<dd>
440+
Corresponds to a conceptual [=descent=] normalized
441+
to ensure 1em between [=em-over=] and [=em-under=].
442+
See [[#baseline-synthesis-em]].
431443
</dl>
432444

433445
Note: These metrics are optical design metrics,
@@ -2655,8 +2667,37 @@ Interaction with Fragmentation (Pagination)</h4>
26552667
<h2 class="no-num" id="baseline-synthesis">
26562668
Appendix A: Synthesizing Alignment Metrics</h2>
26572669

2658-
<h3 class="no-num" id="baseline-synthesis-fonts">
2659-
A.1: Synthesizing Baselines (and Other Font Metrics) for Text</h3>
2670+
<h3 class="no-num" id="baseline-synthesis-em">
2671+
A.1: Calculating [=Em-over=] and [=Em-under=]</h3>
2672+
2673+
Note: The [=em-over=] and [=em-under=] baselines are not used by CSS.
2674+
Their definitions are included in this module
2675+
for consistency with the other metrics used by
2676+
<a href="https://html.spec.whatwg.org/multipage/canvas.html#2dcontext">Canvas 2D API</a>.
2677+
2678+
The [=em-over=] and [=em-under=] metrics are calculated as follows:
2679+
2680+
* If any one of
2681+
[=central=], [=ideographic-over=], or [=ideographic-under=]
2682+
is defined by the font,
2683+
then [=em-over=] is 0.5em over the [=central=] baseline,
2684+
and [=em-under=] is 0.5em under it,
2685+
with the [=central=] baseline derived from the others
2686+
if missing or undefined
2687+
(see below).
2688+
2689+
* Otherwise, the [=ascent=] and [=descent=]
2690+
are both proportionally augmented or reduced
2691+
to add up to exactly 1em,
2692+
and these normalized metrics are taken
2693+
as the [=em-over=] and [=em-under=] metrics, respectively.
2694+
2695+
Note: This calculation ensures that [=em-over=] and [=em-under=]
2696+
are always exactly 1em apart
2697+
while trying to center the glyph outlines’ “center of gravity” between them.
2698+
2699+
<h3 class="no-num" id="baseline-synthesis-fonts">
2700+
A.2: Synthesizing Baselines (and Other Font Metrics) for Text</h3>
26602701

26612702
Some fonts might not contain the metrics information necessary
26622703
to align text properly as described in this module.
@@ -2681,7 +2722,7 @@ Appendix A: Synthesizing Alignment Metrics</h2>
26812722
The [=ideographic-over=] and [=ideographic-under=] baselines
26822723
are typically ''1em'' apart,
26832724
so if only one of the
2684-
[=ideographic-over=]/[=ideographic-under=]/[=ideograph-central=]
2725+
[=ideographic-over=]/[=ideographic-under=]/[=central=]
26852726
baselines are provided,
26862727
this relation can be used to calculate the other two.
26872728
<li>
@@ -2781,10 +2822,10 @@ Appendix A: Synthesizing Alignment Metrics</h2>
27812822
<li>cap-height: .66em;
27822823
<li>hanging baseline: .6em;
27832824
</ul>
2784-
</ol>
2825+
</dl>
27852826

27862827
<h3 class="no-num" id="baseline-synthesis-box">
2787-
A.2: Synthesizing Baselines for Atomic Inlines</h3>
2828+
A.3: Synthesizing Baselines for Atomic Inlines</h3>
27882829

27892830
If an [=atomic inline=]
27902831
(such as an inline-block, inline-table, or [=replaced element=])

0 commit comments

Comments
 (0)