A font you can use in your web apps when you want tiny state shapes as a design element.
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.
At ProPublica we're using it in our super PAC tracker.
Download: ZIP | tar.gz | Source Repo | Bower
The easiest way to use StateFace on the web is to use FontSquirrel's technique to serve StateFace in a reliably cross-platform way:
In the font/webfont
directory, find the following files and upload them to your webserver.
stateface-regular-webfont.eot
stateface-regular-webfont.woff
stateface-regular-webfont.ttf
stateface-regular-webfont.svg
Note: Firefox gets a bit testy about cross-domain-origin assets so it's really best to serve them from your actual webserver.
Include this chunk of CSS in a stylesheet that's called from your web page. Use the correct paths, of course.
@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;
}
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 download the handy json file for programmatic access.
As an alternative to the StateFace code, you can use the stylesheet put together by Paul Smith to add CSS classes that correspond to a stateface's two-letter USPS abbreviation.
If you just want the OpenType font to use in a print layout you can download it here.
Paul Smith put together a stylesheet that allows for css-based replacement (or prepending) of text. For example, for replacement you'd use:
<span class="stateface stateface-replace stateface-{abbrev}">{statename}</span>
Which could produce Maryland
If you only want to prepend the state shape to the span you can do:
<span class="stateface stateface-{abbrev}">{statename}</span>
So you can write sentences like: I was born in Colorado and then moved to Florida, and graduated from high school in California.
There is a full demo here.
Angela Murrell wrote a Sass file you can use in your Sass projects. It compiles to this CSS stylesheet, but you could rewrite the Sass to generate custom CSS easily.
Note: Support for Guam is in this Sass file, but it's not yet an icon. We'll get to it soon.
To use it to replace,
<span class="sf-new-mexico sf-replace">Words, and you must have them!</span>
Many argue that california is the best state.
To use it to prepend,
<span class="sf-new-mexico">Words, prepended by a state icon.</span>
Let's borrow that sentence again: I was born in Colorado and then moved to Florida, and graduated from high school in California.
Here's the full range of what you can do with that great primary battleground state, New Hampshire:
<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>
B | Ala. | B |
A | Alaska | A |
D | Ariz. | D |
C | Ark. | C |
E | Calif. | E |
F | Colo. | F |
G | Conn. | G |
H | Del. | H |
y | D.C. | y |
I | Fla. | I |
J | Ga. | J |
K | Hawaii | K |
M | Idaho | M |
N | Ill. | N |
O | Ind. | O |
L | Iowa | L |
P | Kan. | P |
Q | Ky. | Q |
R | La. | R |
U | Maine | U |
T | Md. | T |
S | Mass. | S |
V | Mich. | V |
W | Minn. | W |
Y | Miss. | Y |
X | Mo. | X |
Z | Mont. | Z |
c | Neb. | c |
g | Nev. | g |
d | N.H. | d |
e | N.J. | e |
f | N.M. | f |
h | N.Y. | h |
a | N.C. | a |
b | N.D. | b |
i | Ohio | i |
j | Okla. | j |
k | Ore. | k |
l | Pa. | l |
m | R.I. | m |
n | S.C. | n |
o | S.D. | o |
p | Tenn. | p |
q | Texas | q |
z | U.S. | z |
r | Utah | r |
t | Vt. | t |
s | Va. | s |
u | Wash. | u |
w | W.Va. | w |
v | Wis. | v |
x | Wyo. | x |
Each state is projected using a relevant state plane projection, and the U.S. (lowercase z) is projected using Texas Centric Albers Equal Area. The source shapefiles are adapted from Natural Earth data. See Natural Earth's terms of use for details.
You can install and manage StateFace using Bower:
> bower install stateface
Or, add to your bower.json
:
{
"name": "my bower-powered project",
"dependencies": {
"stateface": "1.0.0"
}
}
The Glyphs Mini .glyphs
file is included in the repo if any type (especially hinting) experts want to try their hand at tuning it.
FontSquirrel's FontFace Generator generated the files in font/webfont
.
If you want to re-make the .eps
files the tools
directory includes a program to do so. You'll need to have GDAL installed.
Running make state-plane
or make albers
will make a fresh copy.
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.
StateFace is a project of ProPublica.