Skip to content

Commit b9117de

Browse files
shivamidowchromium-wpt-export-bot
authored andcommitted
Implement the ic-height metric of font-size-adjust
This CL adds the ic-height metric support to font-size-adjust [1]. The ic-height metric lets developers adjust font size relative to the height of the CJK water glyph. A note-worthy is the fallback case where the used font does not provide vertical font info. Such vertical font info is often missing, but the current specification does not describe the fallback behavior. As a temporary measure, we use the advance width of the CJK water glyph instead until the standard fallback behavior is established [2] if we cannot get its advance height from the font. That would be a sensible approximation since the CJK water glyph has the same width and height in most fonts. [1] https://www.w3.org/TR/css-fonts-5/#valdef-font-size-adjust-ic-height [2] w3c/csswg-drafts#8792 Test: 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 c878bec commit b9117de

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<style>
6+
@font-face {
7+
font-family: NotoSansCJK;
8+
src: url(/fonts/noto/cjk/NotoSansCJKjp-Regular-subset-chws.otf);
9+
}
10+
div {
11+
font-family: NotoSansCJK;
12+
color: green;
13+
background: green;
14+
writing-mode: vertical-rl;
15+
text-orientation: upright;
16+
}
17+
.valueRef {
18+
font-size: 200px;
19+
}
20+
.fromFontRef {
21+
font-size: 100px;
22+
}
23+
style>
24+
<div class="valueRef">div>
25+
<div class="fromFontRef">div>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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="help" href="https://www.w3.org/TR/css-fonts-5/#valdef-font-size-adjust-ic-height" />
6+
<link rel="match" href="font-size-adjust-ic-height-ref.html" />
7+
<meta name="assert" content="Test checks whether font-size-adjust with the ic-height metric adjusts font size.">
8+
<style>
9+
@font-face {
10+
font-family: NotoSansCJK;
11+
src: url(/fonts/noto/cjk/NotoSansCJKjp-Regular-subset-chws.otf);
12+
}
13+
div {
14+
font-family: NotoSansCJK;
15+
font-size: 100px;
16+
background: green;
17+
color: green;
18+
writing-mode: vertical-rl;
19+
text-orientation: upright;
20+
}
21+
.value {
22+
/* The NotoSansCJK font has 1.0 as an aspect value for the CJK water glyph
23+
(i.e., the advance height of “水” / the font size).
24+
Therefore, an ic-height 2.0 means a 200% scaling up. */
25+
font-size-adjust: ic-height 2.0;
26+
}
27+
.fromFont {
28+
/* Likewise, ic-height from-font means 100% of the specified font size. */
29+
font-size-adjust: ic-height from-font;
30+
}
31+
style>
32+
<div class="value">div>
33+
<div class="fromFont">div>

0 commit comments

Comments
 (0)