-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
161 lines (149 loc) · 5.06 KB
/
index.html
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Text Size Calculator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.tailwindcss.com"></script>
<style type="text/tailwindcss">
@layer utilities {
.cell-border :is(td, th) {
@apply border;
}
.cell-px-2 :is(td, th) {
@apply px-2;
}
.cell-py-1 :is(td, th) {
@apply py-1;
}
.cell-border-slate-300 :is(td, th) {
@apply border-slate-300;
}
}
</style>
</head>
<body class="bg-slate-200 p-4 [--font-family:Arial] pb-[20vh]">
<div class="flex flex-col gap-4 items-start text-slate-700">
<div>
<span class="inline-block w-24">Font Family</span>
<div class="inline-flex gap-3 items-center">
<select id="local-fonts" class="p-2 rounded shadow" data-placeholder="Select a font">
<option class="text-gray-400">Select a font</option>
<option selected style="font-family: var(--font-family)">Arial</option>
</select>
<button
class="bg-slate-50 rounded px-3 py-1 shadow hover:bg-slate-100 active:bg-slate-100/70"
onclick="loadLocalFonts(this)"
>
Load Local Fonts
</button>
</div>
</div>
<div>
<span class="inline-block w-24">Uppercase</span>
<input
type="text"
class="px-2 py-1 border border-slate-300 w-96 rounded"
value="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
id="uppercase-letters"
>
</div>
<div>
<span class="inline-block w-24">Lowercase</span>
<input
type="text"
class="px-2 py-1 border border-slate-300 w-96 rounded"
value="abcdefghijklmnopqrstuvwxyz"
id="lowercase-letters"
>
</div>
<div>
<span class="inline-block w-24">Digits</span>
<input
type="text"
class="px-2 py-1 border border-slate-300 w-96 rounded"
value="0123456789"
id="digits"
>
</div>
<div>
<span class="inline-block w-24">Other</span>
<input
type="text"
class="px-2 py-1 border border-slate-300 w-96 rounded"
value=" ,;:.!?"'+-*/\<>=%()[]{}^`~_|@#&$€"
id="other-chars"
>
</div>
</div>
<hr class="my-4 border-slate-300">
<div
class="flex flex-col gap-4 text-[50px] leading-none"
style="font-family: var(--font-family)"
>
<div class="flex items-center gap-4" id="uppercase-container"></div>
<div class="flex items-center gap-4" id="lowercase-container"></div>
<div class="flex items-center gap-4" id="digits-container"></div>
<div class="flex items-center gap-4" id="other-container"></div>
</div>
<hr class="my-4 border-slate-300">
<div class="flex flex-col gap-4 items-start">
<div class="flex items-start">
<span class="inline-block mr-4">Enter text to test</span>
<div
class="bg-white shadow outline-dashed w-fit min-w-[2rem] max-w-[30rem] outline-1 outline-slate-400 leading-none mt-1"
style="font-family: var(--font-family)"
contenteditable
oninput="printTextSize()"
></div>
</div>
<table class="cell-border cell-border-slate-300 cell-px-2 cell-py-1 bg-white/50">
<thead>
<tr>
<th></th>
<th class="w-24">HTML</th>
<th
class="underline decoration-dotted decoration-1 w-24"
title="Width is from the longest line"
>Calculated</th>
<th
class="underline decoration-dotted decoration-1 w-24"
title="Width match is for single line texts"
>Match (%)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Width</td>
<td id="html-width"></td>
<td id="calc-width"></td>
<td id="match-width"></td>
</tr>
<tr>
<td>Height</td>
<td id="html-height"></td>
<td id="calc-height"></td>
<td id="match-height"></td>
</tr>
<tr>
<td>Lines</td>
<td id="html-lines"></td>
<td id="calc-lines"></td>
<td id="match-lines"></td>
</tr>
</tbody>
</table>
</div>
<hr class="my-4 border-slate-300">
<button
class="bg-slate-50 rounded px-3 py-1 shadow hover:bg-slate-100 active:bg-slate-100/70"
onclick="downloadCharWidthRatiosDict()"
title="Character width/height ratios in the specified font family"
>
Download Dictionary
</button>
<script src="utils.js"></script>
<script src="main.functions.js"></script>
<script src="main.js"></script>
</body>
</html>