summaryrefslogtreecommitdiffstats
path: root/layout/reftests/font-matching/illformed-lang-tags-1.html
blob: 31ae0914b7fb87d4dca0bf35e015c2505788f02c (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
50
51
52
53
54
55
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<style>
body {
  font: 32px sans-serif;
}
.description {
  font: 16px serif;
}
div {
  position: relative;
  height: 3em;
}
div p {
  position: absolute;
  color: red;
}
p + p {
  color: green;
}
.red {
  color: red;
}
.green {
  color: green;
}
</style>
<body>
<p class=description>In each line, the <span class=green>green</span> glyphs should exactly overlay the <span class=red>red</span> ones:</p>
</body>
<script>
// Some ideographs that should have lang-specific font variants (examples found in
// https://en.wikipedia.org/wiki/Han_unification).
const doingTest = (location.search != "?ref");
const testStr = "今令免入全关具刃化外情才抵次海直真示神空者草蔥角道雇骨";
["zh-CN", "zh-HK", "zh-TW", "ja-JP", "ko-KR", "ja-JP-alalc97"].forEach((lang) => {
  let div = document.createElement("div");
  document.body.appendChild(div);
  // Create two layers of text, red and then green. In the test rendering, one layer
  // has the "correct" lang tag, and the other has an ill-formed version with underscore;
  // nevertheless we want it to render identically.
  let p1 = document.createElement("p");
  p1.lang = lang;
  p1.textContent = testStr;
  div.appendChild(p1);
  if (doingTest) {
    lang = lang.replace("-", "_");
  }
  let p2 = document.createElement("p");
  p2.lang = lang;
  p2.textContent = testStr;
  div.appendChild(p2);
});
</script>