This is based upon an ideal line length between 50 and 75 characters. I measured these using the opening lines of Kafka's The Metamorphosis:
"One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed ..."
|Font||Line width (em)|
|Freight Sans Pro||22-32em|
|FF Tisa Web Pro||24-36em|
|FF Meta Web Pro||23-34em|
|FF Meta Serif Web Pro||24-35em|
As you can see, it's possible to just default to a value of 30em for pretty much all fonts, however the effect you get will be quite variable and in some cases, fairly ugly.
Exact line length whether it be 50 or 75 characters is subject to personal taste; I personally prefer a line length of 67 characters or so and a line height of 1.5em.
The formula for generating the line width with a different letter spacing is essentially:
Here are some examples of appropriate font stacks:
This code is available on GitHub
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked.
"What's happened to me?" he thought. It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls. A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer.
Gregor then turned to look out the window at the dull weather. Drops of rain could be heard hitting the pane, which made him feel quite sad. "How about if I sleep a little bit longer and forget all this nonsense", he thought, but that was something he was unable to do because he was used to sleeping on his right, and in his present state couldn't get into that position. However hard he threw himself onto his right, he always rolled back to where he was. He must have tried it a hundred times, shut his eyes so that he wouldn't have to look at the floundering legs, and only stopped when he began to feel a mild, dull pain there that he had never felt before.
"Oh, God", he thought, "what a strenuous career it is that I've chosen! Travelling day in and day out. Doing business like this takes much more effort than doing your own business at home, and on top of that there's the curse of travelling, worries about making train connections, bad and irregular food, contact with different people all the time so that you can never get to know anyone or become friendly with them. It can all go to Hell!" He felt a slight itch up on his belly; pushed himself slowly up on his back towards the headboard so that he could lift his head better; found where the itch was, and saw that it was covered with lots of little white spots which he didn't know what to make of; and when he tried to feel the place with one of his legs he drew it quickly back because as soon as he touched it he was overcome by a cold shudder.