{"id":226,"date":"2010-07-10T11:50:13","date_gmt":"2010-07-10T18:50:13","guid":{"rendered":"http:\/\/kai.mactane.org\/blog\/?p=226"},"modified":"2010-12-25T01:25:59","modified_gmt":"2010-12-25T08:25:59","slug":"typesetting-in-between-the-letters","status":"publish","type":"post","link":"https:\/\/kagan.mactane.org\/blog\/2010\/07\/10\/typesetting-in-between-the-letters\/","title":{"rendered":"Typesetting In Between the Letters"},"content":{"rendered":"<p>Long before I learned to program&nbsp;&mdash; and long before the World-Wide Web was even a gleam in Tim Berners-Lee&#8217;s eye&nbsp;&mdash; I was introduced to typography by Douglas R. Hofstadter&#8217;s <cite>Metamagical Themas<\/cite>. In his chapter &#8220;Variations on a Theme as the Crux of Creativity&#8221;, Hofstadter presents a full-page figure that shows 56 different versions of the letter &#8220;A&#8221;. The 56 fonts he uses show versions of &#8220;A&#8221; ranging from the spare to the ornate, with every other variation in between.<\/p>\n<p>I&#8217;d never realized there was so much variation just in one letter. I was converted into a fontaholic on the spot (though not so completely as my sister, who now designs typefaces professionally for <a href=\"http:\/\/www.fontbureau.com\/\">a prestigious font foundry<\/a>&nbsp;&mdash; way to go, sis!). But it&#8217;s easy to get too absorbed in the letters.<\/p>\n<p>Like Debussy, who noted that &#8220;music is the space between the notes&#8221;, I&#8217;ve become enamored with the kind of typography that happens <em>between<\/em> the letters. It&#8217;s more important than you think it is, because: It makes your text easier for people to&nbsp;read.<br \/>\n<!--more--><\/p>\n<h3>Non-Breaking Spaces<\/h3>\n<p>The humble non-breaking space has been a full-fledged HTML entity code since the late &#8217;90s. Entering <code>&amp;nbsp;<\/code> will produce one in any browser that&#8217;s still in use&#8230; and yet, nobody makes use of them. It&#8217;s a shame that this character&#8217;s being wasted; it&#8217;s very useful in places&nbsp;like:<\/p>\n<p><strong>Before dashes<\/strong><\/p>\n<p>I&#8217;ve got a couple of em dashes in my very first paragraph. Go ahead and try changing your browser window&#8217;s width so the text re-flows. No matter what you do, you can&#8217;t get those dashes to show up at the beginning of a line. Ah, but this dash &mdash; this one, you can get at the beginning of a line. Looks ugly, doesn&#8217;t it?<\/p>\n<p>If you look at a properly typeset book, magazine, or newspaper, you&#8217;ll see that dashes work nicely at the ends of lines, but if they wind up at the beginnings of lines, they look awkward. Almost orphaned. Putting a non-breaking space before your dashes will ensure that the awkward layout never happens. (I&#8217;ve got a pair of keystrokes in my editor bound to the sequences &#8220;<code>&amp;nbsp;&amp;mdash;&nbsp;<\/code>&#8221; and &#8220;<code>&amp;nbsp;&amp;ndash;&nbsp;<\/code>&rdquo;&nbsp;&mdash; note that each of those sequences includes a trailing space, to save me even more typing. And in laying out those particular quoted strings, I used non-breaking spaces at the ends, so that the closing quotes are always on the same line as the rest of the sequence.)<\/p>\n<p><strong>At paragraph endings, to avoid orphans<\/strong><\/p>\n<p>I mentioned things looking &#8220;almost orphaned&#8221; earlier. In typesetting, the word &#8220;orphan&#8221; can refer to either of two things: One is &#8220;A single line of text at the top of a (physical) page&#8221;&nbsp;&mdash; this is the meaning commonly used by word processing programs, which will apply &#8220;widow and orphan protection&#8221; to ensure that no fewer than two lines ever appear together at the top or bottom of a&nbsp;page.<\/p>\n<p>But the other meaning is &#8220;one or two short words of text forming a sole, final line of a paragraph&#8221;. For example, consider:<\/p>\n<blockquote><p>This is the sort of thing up with which I will not<br \/>put.<\/p><\/blockquote>\n<p>Once again, this looks horrible. And once again, it can be avoided by using a non-breaking space between the penultimate and final words of your sentences. (Okay, this takes a bit of mindfulness, I&#8217;ll admit. Honestly, it&#8217;s the sort of thing that works best when you&#8217;re editing, not when you&#8217;re writing the first time around. And you only need it with short final words; there&#8217;s no need to bother if the last word of your paragraph is &#8220;elephantine&#8221;.)<\/p>\n<p><strong>At beginnings and ends of inline titles<\/strong><\/p>\n<p>The history of literature and the arts is filled with titles that start or end with very short words. Titles like <cite>As You Like It<\/cite>, and <cite>The Importance of Being Earnest<\/cite>, and <cite>Of Mice and Men<\/cite>; titles that run the gamut from <cite>A River Runs Through It<\/cite> to <cite>The Wizard of Oz<\/cite>; from <cite>To Kill a Mockingbird<\/cite> to <cite>Mr. Smith Goes to Washington<\/cite>; from <cite>The Godfather, Part II<\/cite> to <cite>The King and I<\/cite>.<\/p>\n<p>Depending on just how wide your browser window is, and what your font size is, probably at least one of those titles has a lone, orphaned word at the beginning or the end of a line. But you can resize your browser window however you like, and the titles in <em>this<\/em> paragraph will never have that orphaned-word effect. I&#8217;m sure you can guess exactly why. And the titles are: <cite>As&nbsp;You Like&nbsp;It<\/cite>, and <cite>The&nbsp;Importance of Being Earnest<\/cite>, and <cite>Of&nbsp;Mice and&nbsp;Men<\/cite>; titles that run the gamut from <cite>A&nbsp;River Runs Through&nbsp;It<\/cite> to <cite>The&nbsp;Wizard of&nbsp;Oz<\/cite>; from <cite>To&nbsp;Kill a Mockingbird<\/cite> to <cite>Mr.&nbsp;Smith Goes to Washington<\/cite>; from <cite>The&nbsp;Godfather, Part&nbsp;II<\/cite> to <cite>The&nbsp;King and&nbsp;I<\/cite>.<\/p>\n<h3>If Only We Had Non-Breaking Hyphens!<\/h3>\n<p>All this talk about non-breaking spaces is pretty cool, but what do you do when you list a phone number, and you want to avoid having (415)&nbsp;555&#x2011;1212 get broken across a line-break? Or a book&#8217;s ISBN, such as 020530902&#x2011;X or 030010699&#x2011;8?<\/p>\n<p>For some reason, the W3C never bothered to provide a decent non-breaking hyphen code, like &amp;nbhy; or &amp;nbh; or some such. More&#8217;s the pity. But the Unicode code point U+2011 (or 8209 in decimal), found in the &#8220;General Punctuation&#8221; section, is defined as a non-breaking hyphen. (It occupies the next code point after U+2010, simply called &#8220;hyphen&#8221;.) So using either <code>&amp;#8209;<\/code> or <code>&amp;#x2011;<\/code> should get you a nice non-breaking hyphen in any modern browser.<\/p>\n<p>If that doesn&#8217;t do it for you, you could set up a <code class=\"nowrap\">.nowrap { white-space: nowrap; }<\/code> definition in your sitewide CSS file. Then just wrap any hyphenated text that you want to keep on one line in span tags with the class &#8220;nowrap&#8221;, like so: <code>&lt;span class=\"nowrap\"&gt;123&#x2011;456&#x2011;7890&lt;\/span&gt;<\/code><\/p>\n<p>You probably won&#8217;t be surprised to find examples of these basic principles in the source code to many of my previous posts. I&#8217;ve been doing this kind of thing for a long time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Long before I learned to program&nbsp;&mdash; and long before the World-Wide Web was even a gleam in Tim Berners-Lee&#8217;s eye&nbsp;&mdash; I was introduced to typography by Douglas R. Hofstadter&#8217;s Metamagical Themas. In his chapter &#8220;Variations on a Theme as the Crux of Creativity&#8221;, Hofstadter presents a full-page figure that shows 56 different versions of the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[100,31,99,10,9],"_links":{"self":[{"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/posts\/226"}],"collection":[{"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/comments?post=226"}],"version-history":[{"count":3,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/posts\/226\/revisions"}],"predecessor-version":[{"id":264,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/posts\/226\/revisions\/264"}],"wp:attachment":[{"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/media?parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/categories?post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kagan.mactane.org\/blog\/wp-json\/wp\/v2\/tags?post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}