summaryrefslogtreecommitdiff
path: root/www/wiki/docs/uidesign/monospace.html
blob: cdaf580aa5477cd1341c5774463f986b1c6319d5 (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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
	<style>
		pre,
		textarea {
			border: 1px dashed #AAA;
			background-color: #E0E0E0;
			color: #000000;
			padding: 0.5em;
			height: 1em;
			width: 90%;
		}
		blockquote {
			font-style: italic;
		}
		table {
			width: 100%;
			table-layout: fixed;
		}
		td {
			padding: 0.5em;
		}
	</style>
</head>
<body>
<p>
This page let you test the rendering font-family declaration for monospaced fonts. TODO: add some references here :-)
</p>
<p>
Erwin Dokter had the following explanation on <a href="https://bugzilla.wikimedia.org/33496">Bugzilla #33496</a>:
</p>
<blockquote>
By default, a (Windows) browser has it's default font-sizes set at 16px for
serif and sans-serif, and 13px for monospace. Except in IE, where you cannot
set any font-sizes... it uses 16px for all fonts.
<br/>
Vector has a base font-size of 0.8em, and most browsers *correctly* scale down
all fonts, including the monospace font, accordingly. So monospace is shown at
0.8 x 13px = 10px (which is perceived as 'too small'). But when you assign any
font besides just "monospace", those browsers will no longer treat it as
monospace and use 0.8 x 16px = 13px instead.
</blockquote>
<p>
Additionally, it seems that textareas have their own font-size set in Chrome
(but not Firefox and other browsers), making them unaffected by this behavior.
</p>
<p>
Below are various rendering:
</p>

<table>

<tr>
<th>&lt;pre&gt;</th>
<th>&lt;textarea&gt;</th>
</tr>

<tr>
<td>
<pre style='
font-family: monospace;'>
font-family: monospace;
</pre>
</td>
<td>
<textarea style='
font-family: monospace;'>
font-family: monospace;
</textarea>
</td>
</tr>

<tr>
<td>
<pre style='
font-family: "Courier New";'>
font-family: "Courier New";
</pre>
</td>
<td>
<textarea style='
font-family: "Courier New";'>
font-family: "Courier New";
</textarea>
</td>
</tr>

<tr>
<td>
<pre style='
font-family: Courier;'>
font-family: Courier;
</pre>
</td>
<td>
<textarea style='
font-family: Courier;'>
font-family: Courier;
</textarea>
</td>
</tr>

<tr>
<td>
<pre style='
font-family: monospace, monospace;'>
font-family: monospace, monospace;
</pre>
</td>
<td>
<textarea style='
font-family: monospace, monospace;'>
font-family: monospace, monospace;
</textarea>
</td>
</tr>

<tr>
<td>
<pre style='
font-family: monospace, "Courier New";'>
font-family: monospace, "Courier New";
</pre>
</td>
<td>
<textarea style='
font-family: monospace, "Courier New";'>
font-family: monospace, "Courier New";
</textarea>
</td>
</tr>

<tr>
<td>
<pre style='
font-family: monospace, Courier;'>
font-family: monospace, Courier;
</pre>
</td>
<td>
<textarea style='
font-family: monospace, Courier;'>
font-family: monospace, Courier;
</textarea>
</td>
</tr>

<tr>
<td>
<pre style='
font-family: monospace, Verdana;'>
font-family: monospace, Verdana;
</pre>
</td>
<td>
<textarea style='
font-family: monospace, Verdana;'>
font-family: monospace, Verdana;
</textarea>
</td>
</tr>

<tr>
<td>
<pre style='
font-family: monospace, DOESNOTEXISTREALLY;'>
font-family: monospace, DOESNOTEXISTREALLY;
</pre>
</td>
<td>
<textarea style='
font-family: monospace, DOESNOTEXISTREALLY;'>
font-family: monospace, DOESNOTEXISTREALLY;
</textarea>
</td>
</tr>

</table>