Skip to content

Commit e5a277d

Browse files
shivamidowchromium-wpt-export-bot
authored andcommitted
Implement the ic-height metric of font-size-adjust
This change introduces support for the ic-height metric in font-size-adjust [1], allowing developers to adjust font size based on the height of the CJK water glyph. Notably, in cases where the chosen font lacks the CJK water glyph or vertical font information, there is no specified fallback behavior in the current specification. We adopt the approach of combining ascent and descent for fallback, similar to Gecko's method [2], until a standard fallback behavior is defined [3]. [1] https://www.w3.org/TR/css-fonts-5/#valdef-font-size-adjust-ic-height [2] w3c/csswg-drafts#8792 (comment) [3] w3c/csswg-drafts#6384 Test: animations/responsive/interpolation/font-size-adjust-responsive.html external/wpt/css/css-fonts/animations/font-size-adjust-composition.html external/wpt/css/css-fonts/font-size-adjust-ic-height.html (new) external/wpt/css/css-fonts/parsing/font-size-adjust-computed.html external/wpt/css/css-fonts/parsing/font-size-adjust-valid.html Bug: 1219875 Change-Id: Ie90a6241cb7e8a55fcaf65df5a4edc1058028ebe
1 parent a27e552 commit e5a277d

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
>
2+
<meta charset="UTF-8">
3+
<title>font-size-adjust with the ic-height metrictitle>
4+
<link rel="author" title="ChangSeok Oh" href="mailto:[email protected]" />
5+
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
6+
<style>
7+
@font-face {
8+
font-family: NotoSansCJK;
9+
src: url(/fonts/noto/cjk/NotoSansCJKjp-Regular-subset-chws.otf);
10+
}
11+
div {
12+
color: green;
13+
background: green;
14+
writing-mode: vertical-rl;
15+
text-orientation: upright;
16+
}
17+
.adjustedRef {
18+
font-family: NotoSansCJK;
19+
font-size: 200px;
20+
}
21+
.notAdjustedRef {
22+
font-family: Ahem;
23+
font-size: 100px;
24+
}
25+
style>
26+
<div class="adjustedRef">div>
27+
<div class="notAdjustedRef">div>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
>
2+
3+
<meta charset="UTF-8">
4+
<title>font-size-adjust with the ic-height metrictitle>
5+
<link rel="author" title="ChangSeok Oh" href="mailto:[email protected]" />
6+
<link rel="help" href="https://www.w3.org/TR/css-fonts-5/#valdef-font-size-adjust-ic-height" />
7+
<link rel="match" href="font-size-adjust-ic-height-ref.html" />
8+
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
9+
<meta name="assert" content="Test checks whether font-size-adjust with the ic-height metric adjusts font size.">
10+
<style>
11+
@font-face {
12+
font-family: NotoSansCJK;
13+
src: url(/fonts/noto/cjk/NotoSansCJKjp-Regular-subset-chws.otf);
14+
}
15+
div {
16+
font-size: 100px;
17+
background: green;
18+
color: green;
19+
writing-mode: vertical-rl;
20+
text-orientation: upright;
21+
}
22+
.adjusted {
23+
font-family: NotoSansCJK;
24+
/* The NotoSansCJK font has 1.0 as an aspect value for the CJK water glyph
25+
(i.e., the advance height of “水” / the font size).
26+
Therefore, an ic-height 2.0 means a 200% scaling up. */
27+
font-size-adjust: ic-height 2.0;
28+
}
29+
.notAdjusted {
30+
font-family: Ahem;
31+
/* The Ahem font lacks vertical metrics, so no adjustment is applied. */
32+
font-size-adjust: ic-height 0.5;
33+
}
34+
style>
35+
<div class="adjusted">div>
36+
<div class="notAdjusted">div>

0 commit comments

Comments
 (0)