blob: d6b1b2695ff28c4e6e214ab74f89fe5739632441 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS-fonts: first available font and the strut</title>
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
<link rel="help" href="https://drafts.csswg.org/css-fonts-3/#first-available-font">
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#first-available-font">
<link rel="match" href="first-available-font-003-ref.html">
<meta name="assert" content="The strut, which impacts the line height, is taken from the primary font, which is the first font to include the U+0020 character.">
<style>
/* Two arbitrary fonts with different metrics */
@font-face {
font-family: 'A';
font-style: normal;
font-weight: 400;
src: url(/fonts/Revalia.woff) format('woff');
}
@font-face {
font-family: 'B-no-space';
font-style: normal;
font-weight: 400;
src: url(/fonts/AD.woff) format('woff');
unicode-range: U+0062;
}
div {
position: absolute;
line-height: normal;
font-size: 100px;
color: transparent;
border: solid black 1px;
width: 100px;
}
.a { font-family: A; }
.ba { font-family: B-no-space, A; margin-left: 100px; }
</style>
<p>There should be <strong>two identically sized rectangles</strong> below.
<!-- Both divs show the same content with the same font,
but the first div has an unused font earlier in the list,
while the second one does not.
However, that font does not include the U+0020 character,
and can therefore not be the first available font.
If it had been, it would affect the height of the strut,
making the height different.
Since it is not, both boxes are expected to be the same height. -->
<div class="ba">a</div>
<div class="a">a</div>
|