{"id":2296,"date":"2011-12-03T14:32:09","date_gmt":"2011-12-03T14:32:09","guid":{"rendered":"http:\/\/sunpig.com\/mt-entry-2296.html"},"modified":"2012-03-27T14:00:47","modified_gmt":"2012-03-27T14:00:47","slug":"styling-the-at-sign-in-din","status":"publish","type":"post","link":"https:\/\/sunpig.com\/martin\/2011\/12\/03\/styling-the-at-sign-in-din\/","title":{"rendered":"Styling the at sign in DIN"},"content":{"rendered":"<p><a href=\"http:\/\/dinfont.com\/\">FF DIN<\/a> is a fantastic font. It&#8217;s clear and authoritative, but with loads of personality. Once you get to know it (thanks <a href=\"http:\/\/twitter.com\/flightresponse\">Mark<\/a>!), you start seeing it everywhere. It&#8217;s particularly delicious for all-caps titling, but it works equally well as a body text font.<\/p>\n<p class=\"center\"><img decoding=\"async\" src=\"http:\/\/sunpig.com\/martin\/images\/2011\/arctic-weapon.png\" alt=\"The text ARCTIC WEAPON, set in DIN\" \/><\/p>\n<p>The only problem with DIN is the default at sign (@), which looks like ass.<\/p>\n<p class=\"center\"><img decoding=\"async\" src=\"http:\/\/sunpig.com\/martin\/images\/2011\/ass-at.png\" alt=\"email address with the default DIN at sign\" \/><\/p>\n<p>Fortunately, DIN comes with a set of alternate glyphs built in, which you can access through <a href=\"http:\/\/en.wikipedia.org\/wiki\/OpenType\">OpenType<\/a>&#8216;s <i>stylistic alternates<\/i> feature. One of those alternate glyphs is a version of the at sign that actually looks like an at sign rather than a half-melted &#8220;id&#8221; ligature.<\/p>\n<p class=\"center\"><img decoding=\"async\" src=\"http:\/\/sunpig.com\/martin\/images\/2011\/awesome-at.png\" alt=\"email address with the alternate DIN at sign\"\/><\/p>\n<p>You can usually select OpenType stylistic alternates from the advanced font options dialog of your graphics or word processing program. In Pixelmator for OS X, for example, you open up the fonts dialog, click on the tools button, select the &#8220;Typography&#8221; option, and then choose an alternative stylistic set in the Typography dialog. In Word 2011, you open up the fonts dialog by selecting &#8220;Font&#8230;&#8221; from Format menu; stylistic sets are shown in the &#8220;Advanced typography&#8221; section of the Advanced tab.<\/p>\n<p>Unfortunately, although CSS3 includes a <code><a href=\"http:\/\/www.w3.org\/TR\/css3-fonts\/#propdef-font-variant-alternates\">font-variant-alternates<\/a><\/code> property with which you can select alternate glyphs, there aren&#8217;t any browsers that support this yet. Bummer. So if you want to use DIN on the web, you&#8217;re either stuck with the ass-at, or you have to use a workaround.<\/p>\n<p>One way is to wrap at signs in a <code>&lt;span&gt;<\/code>, so you can set their style explicitly, as suggested by Dan Cedarholm in his article <a href=\"http:\/\/simplebits.com\/notebook\/2008\/08\/14\/ampersands-2\/\">Use the Best Available Ampersand<\/a>.<\/p>\n<pre class=\"code\"><code class=\"html\" data-language=\"html\">monkey&lt;span class=\"awesomat\"&gt;@&lt;\/span&gt;example.com<\/code><\/pre>\n<p>But <a href=\"http:\/\/allinthehead.com\/\">Drew McLellan&#8217;s<\/a> article <a href=\"http:\/\/24ways.org\/2011\/unicode-range\">Creating Custom Font Stacks with Unicode-Range<\/a> in this year&#8217;s <a href=\"http:\/\/24ways.org\/\">24 Ways<\/a> advent calendar suggests an intriguing potential alternative. The concept is that the <code>@font-face<\/code> rule allows you to select which unicode characters the webfont will be used for by setting the <code>unicode-range<\/code> property. Single out the ampersand (U+0026) or the at sign (U+0040) for special treatment, and Bob&#8217;s your uncle.<\/p>\n<p>The difference is that for awesompersands you are trying to <em>add<\/em> a font for a single character, whereas for DIN awesomats, I want to <em>remove<\/em> font styling for a single character. The <code>unicode-range<\/code> property obliges nicely here, because it accepts multiple ranges:<\/p>\n<pre class=\"code\"><code class=\"css\" data-language=\"css\">@font-face {\n  font-family: 'dinregular';\n  url('font\/DINWeb.woff') format('woff');\n  unicode-range:U+0-3F,U+41-10FFFF; \/* Everything but the @ *\/\n}<\/code><\/pre>\n<p>Browsers that don&#8217;t handle <code>unicode-range<\/code> will ignore it, and fall back to showing DIN for all characters, even the @. Which is fine.<\/p>\n<p>In terms of typography, however, the drawback of this technique is that the plain font to be used for the U+40 unicode character may have a different <a href=\"http:\/\/en.wikipedia.org\/wiki\/X-height\">x-height<\/a> than the DIN of the surrounding text, so the at sign may look out of place &mdash; too large or too small. And the <code>@font-face<\/code> rule doesn&#8217;t allow a <code>font-size<\/code> property inside it, so you can&#8217;t tweak the font sizes to match each other. Hmm.<\/p>\n<p>On balance, I think I&#8217;ll stick to wrapping my DIN at signs in a <code>&lt;span&gt;<\/code> until <code>font-variant-alternates<\/code> appears, but it&#8217;s a nifty technique to be aware of.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FF DIN is a fantastic font. It&#8217;s clear and authoritative, but with loads of personality. Once you get to know it (thanks Mark!), you start seeing it everywhere. It&#8217;s particularly delicious for all-caps titling, but it works equally well as a body text font. The only problem with DIN is the default at sign (@), &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/sunpig.com\/martin\/2011\/12\/03\/styling-the-at-sign-in-din\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Styling the at sign in DIN&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2296","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/posts\/2296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/comments?post=2296"}],"version-history":[{"count":0,"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/posts\/2296\/revisions"}],"wp:attachment":[{"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/media?parent=2296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/categories?post=2296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunpig.com\/martin\/wp-json\/wp\/v2\/tags?post=2296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}