-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.html
517 lines (398 loc) · 15.7 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<!doctype html>
<html>
<head>
<title>StateFace</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="reference/styles.css" type="text/css">
<link rel="stylesheet" href="reference/stateface.css" type="text/css">
<link rel="stylesheet" href="reference/stateface-generated.css" type="text/css">
</head>
<body>
<h1><div id="us">z<div id="ak">A</div><div id="hi">K</div></div> <strong>StateFace</strong></h1>
<p>A font you can use in your web apps when you want tiny state shapes as a design element.</p>
<p>It's designed to be used at small sizes, and the shapes have been highly simplified to make for a really small font. All 50 states plus D.C. and a wee continental U.S. map fit in about 22k, and they look great on Retina displays.</p>
<p>At ProPublica we're using it in our <a href="http://projects.propublica.org/pactrack">super PAC tracker</a>.</p>
<p>Download: <a href="pkg/stateface.zip">ZIP</a> | <a href="pkg/stateface.tar.gz">tar.gz</a> | <a href="http://github.com/propublica/stateface">Source Repo</a> | <a href="#bower">Bower</a></p>
<h2>How to Use</h2>
<p>The easiest way to use StateFace on the web is to use FontSquirrel's technique to serve StateFace in a reliably cross-platform way:</p>
<ol>
<li><p>In the <code>font/webfont</code> directory, find the following files and upload them to your webserver.</p>
<pre><code> stateface-regular-webfont.eot
stateface-regular-webfont.woff
stateface-regular-webfont.ttf
stateface-regular-webfont.svg
</code></pre>
<p> Note: Firefox gets a bit testy about cross-domain-origin assets so it's really best to serve them from your actual webserver.</p></li>
<li><p>Include this chunk of CSS in a stylesheet that's called from your web page. Use the correct paths, of course.</p>
<pre><code> @font-face {
font-family: 'StateFaceRegular';
src: url('stateface-regular-webfont.eot');
src: url('stateface-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('stateface-regular-webfont.woff') format('woff'),
url('stateface-regular-webfont.ttf') format('truetype'),
url('stateface-regular-webfont.svg#StateFaceRegular') format('svg');
font-weight: normal;
font-style: normal;
}
</code></pre></li>
<li><p>Now, any text that has or inherits the font-family 'StateFaceRegular' style will appear as a state shape. See the character reference below to know which letter will draw which state, or <a href="reference/stateface.json">download the handy json file</a> for programmatic access.</p></li>
<li><p>As an alternative to the StateFace code, you can use the <a href="reference/stateface.css">stylesheet</a> put together by <a href="https://github.com/paulsmith">Paul Smith</a> to add CSS classes that correspond to a stateface's two-letter USPS abbreviation.</p></li>
</ol>
<p>If you just want the OpenType font to use in a print layout you can <a href="font/StateFace-Regular.otf">download it here</a>.</p>
<h2>CSS Replacement</h2>
<p><a href="https://github.com/paulsmith">Paul Smith</a> put together a <a href="reference/stateface.css">stylesheet</a> that allows for css-based replacement (or prepending) of text. For example, for replacement you'd use:</p>
<pre><code> <span class="stateface stateface-replace stateface-{abbrev}">{statename}</span>
</code></pre>
<p>Which could produce <span class="stateface stateface-replace stateface-md">Maryland</span></p>
<p>If you only want to prepend the state shape to the span you can do:</p>
<pre><code> <span class="stateface stateface-{abbrev}">{statename}</span>
</code></pre>
<p>So you can write sentences like: I was born in <span class="stateface stateface-co">Colorado</span> and then moved to <span class="stateface stateface-fl">Florida</span>, and graduated from high school in
<span class="stateface stateface-ca">California</span>.</p>
<p>There is a full demo <a href="reference/cssclass.html">here</a>.</p>
<p><a href="https://github.com/amurrell">Angela Murrell</a> wrote a <a href="reference/stateface.scss">Sass</a> file you can use in your Sass projects. It compiles to this CSS <a href="reference/stateface-generated.css">stylesheet</a>, but you could rewrite the Sass to generate custom CSS easily.</p>
<p><strong>Note:</strong> Support for Guam is in this Sass file, but it's not yet an icon. We'll get to it soon.</p>
<p>To use it to replace,</p>
<pre><code> <span class="sf-new-mexico sf-replace">Words, and you must have them!</span>
</code></pre>
<p>Many argue that <span class="sf-california sf-replace">california</span> is the best state.</p>
<p>To use it to prepend,</p>
<pre><code> <span class="sf-new-mexico">Words, prepended by a state icon.</span>
</code></pre>
<p>Let's borrow that sentence again: I was born in <span class="sf-colorado">Colorado</span> and then moved to <span class="sf-fl">Florida</span>, and graduated from high school in
<span class="sf-06">California</span>.</p>
<p>Here's the full range of what you can do with that great primary battleground state, <span class="sf-nh">New Hampshire:</span></p>
<pre><code> <span class="sf-new-hampshire">Words, prepended by a state icon.</span>
<span class="sf-nh">Words, prepended by a state icon.</span>
<span class="sf-33">Words, prepended by a state icon.</span>
<span class="sf-new-hampshire sf-replace">Words, and you must have them!</span>
<span class="sf-nh sf-replace">Words, and you must have them!</span>
<span class="sf-33 sf-replace">Words, and you must have them!</span>
</code></pre>
<h2>StateFace Keyboard Map</h2>
<div id="font-map">
<table class="StateFace">
<tr>
<td class="minimap">B</td>
<td>Ala.</td>
<td>B</td>
</tr>
<tr>
<td class="minimap">A</td>
<td>Alaska</td>
<td>A</td>
</tr>
<tr>
<td class="minimap">D</td>
<td>Ariz.</td>
<td>D</td>
</tr>
<tr>
<td class="minimap">C</td>
<td>Ark.</td>
<td>C</td>
</tr>
<tr>
<td class="minimap">E</td>
<td>Calif.</td>
<td>E</td>
</tr>
<tr>
<td class="minimap">F</td>
<td>Colo.</td>
<td>F</td>
</tr>
<tr>
<td class="minimap">G</td>
<td>Conn.</td>
<td>G</td>
</tr>
<tr>
<td class="minimap">H</td>
<td>Del.</td>
<td>H</td>
</tr>
<tr>
<td class="minimap">y</td>
<td>D.C.</td>
<td>y</td>
</tr>
<tr>
<td class="minimap">I</td>
<td>Fla.</td>
<td>I</td>
</tr>
<tr>
<td class="minimap">J</td>
<td>Ga.</td>
<td>J</td>
</tr>
<tr>
<td class="minimap">K</td>
<td>Hawaii</td>
<td>K</td>
</tr>
<tr>
<td class="minimap">M</td>
<td>Idaho</td>
<td>M</td>
</tr>
<tr>
<td class="minimap">N</td>
<td>Ill.</td>
<td>N</td>
</tr>
<tr>
<td class="minimap">O</td>
<td>Ind.</td>
<td>O</td>
</tr>
<tr>
<td class="minimap">L</td>
<td>Iowa</td>
<td>L</td>
</tr>
<tr>
<td class="minimap">P</td>
<td>Kan.</td>
<td>P</td>
</tr>
<tr>
<td class="minimap">Q</td>
<td>Ky.</td>
<td>Q</td>
</tr>
</table>
<table class="StateFace">
<tr>
<td class="minimap">R</td>
<td>La.</td>
<td>R</td>
</tr>
<tr>
<td class="minimap">U</td>
<td>Maine</td>
<td>U</td>
</tr>
<tr>
<td class="minimap">T</td>
<td>Md.</td>
<td>T</td>
</tr>
<tr>
<td class="minimap">S</td>
<td>Mass.</td>
<td>S</td>
</tr>
<tr>
<td class="minimap">V</td>
<td>Mich.</td>
<td>V</td>
</tr>
<tr>
<td class="minimap">W</td>
<td>Minn.</td>
<td>W</td>
</tr>
<tr>
<td class="minimap">Y</td>
<td>Miss.</td>
<td>Y</td>
</tr>
<tr>
<td class="minimap">X</td>
<td>Mo.</td>
<td>X</td>
</tr>
<tr>
<td class="minimap">Z</td>
<td>Mont.</td>
<td>Z</td>
</tr>
<tr>
<td class="minimap">c</td>
<td>Neb.</td>
<td>c</td>
</tr>
<tr>
<td class="minimap">g</td>
<td>Nev.</td>
<td>g</td>
</tr>
<tr>
<td class="minimap">d</td>
<td>N.H.</td>
<td>d</td>
</tr>
<tr>
<td class="minimap">e</td>
<td>N.J.</td>
<td>e</td>
</tr>
<tr>
<td class="minimap">f</td>
<td>N.M.</td>
<td>f</td>
</tr>
<tr>
<td class="minimap">h</td>
<td>N.Y.</td>
<td>h</td>
</tr>
<tr>
<td class="minimap">a</td>
<td>N.C.</td>
<td>a</td>
</tr>
<tr>
<td class="minimap">b</td>
<td>N.D.</td>
<td>b</td>
</tr>
<tr>
<td class="minimap">i</td>
<td>Ohio</td>
<td>i</td>
</tr>
</table>
<table class="StateFace">
<tr>
<td class="minimap">j</td>
<td>Okla.</td>
<td>j</td>
</tr>
<tr>
<td class="minimap">k</td>
<td>Ore.</td>
<td>k</td>
</tr>
<tr>
<td class="minimap">l</td>
<td>Pa.</td>
<td>l</td>
</tr>
<tr>
<td class="minimap">m</td>
<td>R.I.</td>
<td>m</td>
</tr>
<tr>
<td class="minimap">n</td>
<td>S.C.</td>
<td>n</td>
</tr>
<tr>
<td class="minimap">o</td>
<td>S.D.</td>
<td>o</td>
</tr>
<tr>
<td class="minimap">p</td>
<td>Tenn.</td>
<td>p</td>
</tr>
<tr>
<td class="minimap">q</td>
<td>Texas</td>
<td>q</td>
</tr>
<tr>
<td class="minimap">z</td>
<td>U.S.</td>
<td>z</td>
</tr>
<tr>
<td class="minimap">r</td>
<td>Utah</td>
<td>r</td>
</tr>
<tr>
<td class="minimap">t</td>
<td>Vt.</td>
<td>t</td>
</tr>
<tr>
<td class="minimap">s</td>
<td>Va.</td>
<td>s</td>
</tr>
<tr>
<td class="minimap">u</td>
<td>Wash.</td>
<td>u</td>
</tr>
<tr>
<td class="minimap">w</td>
<td>W.Va.</td>
<td>w</td>
</tr>
<tr>
<td class="minimap">v</td>
<td>Wis.</td>
<td>v</td>
</tr>
<tr>
<td class="minimap">x</td>
<td>Wyo.</td>
<td>x</td>
</tr>
</table>
</div>
<h2>Projection Info</h2>
<p>Each state is projected using a relevant state plane projection, and the U.S. (lowercase z) is projected using <a href="http://spatialreference.org/ref/epsg/3083/">Texas Centric Albers Equal Area</a>. The source <a href="https://github.com/propublica/stateface/tree/master/tools/us-states">shapefiles</a> are adapted from <a href="http://www.naturalearthdata.com/">Natural Earth data</a>. See Natural Earth's <a href="http://www.naturalearthdata.com/about/terms-of-use/">terms of use</a> for details.</p>
<p><a name="bower"></a></p>
<h2>Installing via Bower</h2>
<p>You can install and manage StateFace using <a href="https://bower.io">Bower</a>:</p>
<pre><code>> bower install stateface
</code></pre>
<p>Or, add to your <code>bower.json</code>:</p>
<pre><code>{
"name": "my bower-powered project",
"dependencies": {
"stateface": "1.0.0"
}
}
</code></pre>
<h2>Forking and Contributing</h2>
<p>The <a href="https://glyphsapp.com/glyphs-mini">Glyphs Mini</a> <code>.glyphs</code> file is <a href="font/stateface.glyphs">included in the repo</a> if any type (especially hinting) experts want to try their hand at tuning it.</p>
<p>FontSquirrel's <a href="http://www.fontsquirrel.com/fontface/generator">FontFace Generator</a> generated the files in <code>font/webfont</code>.</p>
<p>If you want to re-make the <code>.eps</code> files the <code>tools</code> directory includes a program to do so. You'll need to have <a href="http://www.gdal.org/">GDAL</a> installed.
Running <code>make state-plane</code> or <code>make albers</code> will make a fresh copy.</p>
<h2>Packages and Modules Including StateFace</h2>
<ul>
<li><a href="https://github.com/farski/stateface-rails">stateface-rails</a></li>
<li><a href="https://github.com/ryanpitts/django-stateface">django-stateface</a></li>
<li><a href="https://github.com/datadesk/latimes-statestyle">latimes-statestyle</a></li>
<li><a href="https://gist.github.com/2045456">AP Style in Ruby, with StateFace</a></li>
</ul>
<h2>In The Wild</h2>
<ul>
<li><a href="http://elections.huffingtonpost.com/2012/general">Huffington Post Elections Dashboard</a></li>
<li><a href="http://www.washingtonpost.com/wp-srv/special/politics/election-map-2012/house/">Washington Post: The Race for House Control</a></li>
<li><a href="http://www.isbarackobamathepresident.com/">The Guardian: Is Barack Obama the President?</a></li>
<li><a href="http://polltracker.talkingpointsmemo.com/">Talking Points Memo: PollTracker</a></li>
<li><a href="https://www.shifticons.com/icons/propublica/stateface/">ShiftIcons</a></li>
<li><a href="http://www.spokesman.com/elections/">Spokesman-Review Election Center</a></li>
</ul>
<h2>License</h2>
<pre><code>Copyright (c) 2012, ProPublica
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
</code></pre>
<p><em>StateFace is a project of ProPublica.</em></p>
</body>
</html>