Sizing type with Lucas Sequences

The relationship between text and the rest of a page is one of the key characteristics of any design.

Rhythm, emphasis and tone are all compromised without correctly scaled type. However, selecting text sizes is often both a painstaking and frustrating experience, with no standardized starting point to inform us.

As a result we frequently find web designers falling back on the default options presented by applications — 8pt, 10pt, 12pt, 14pt, 18pt — for want of a better solution.

That better solution is to set type sizes not by individual whim, but according to a predetermined system; a system that is simple to use, practical to implement on the web and most importantly, flexible enough to allow designers a full range of expression. Cue: the Lucas Sequence.

 

Lucas Sequences

The Fibonacci Sequence — first recorded in the West during the 13th century by Leonardo Fibonacci — is the following set of integers (whole numbers):

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987… ad infinitum

The sequence was named for Fibonacci by the eminent 19th century French mathematician François Édouard Lucas who produced a similar sequence of his own, that he referred to as Lucas Numbers:

2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843… ad infinitum

The Fibonacci Sequence and Lucas Numbers are both specific variations of the generic Lucas Sequence.

Lucas Sequences and integer sequences in general have been the subject of a lifetime of study for numerous accomplished mathematicians, so we’re going to summarize the concept as follows:

  1. Any given number in the sequence is the sum of the two preceding numbers as described in this formula: n = n-1 + n-2
  2. The first two numbers in the sequence — known as seed numbers — are selected arbitrarily.

Why use a Lucas Sequence to set type?

Lucas Sequences, particularly in the form of the Fibonacci Sequence bear a close relationship to the Golden Ratio, which is repeated throughout nature in shells, spider’s webs, cloud formations and numerous other natural wonders. There is strong evidence to suggest that anything we find visually appealing is due to that form’s relationship to the golden ratio.

More importantly, Lucas Sequences provide us with a scalable framework for setting type that is both graceful and rhythmic.

 

Determining our first seed number

There is much debate over the correct body text size for a website. 12px is still the most common, but it’s not unusual to see anything from 10px to 16px. This is substantially born from a lack of understanding of what font measurements actually mean. Strangely, for those of us accustomed to standardization — or at least aspirations of standardization — there is no standard measure in type design; two different type designers, drawing exactly the same design into font production software are likely to draw it at different sizes. The variation between different typefaces is, unsurprisingly, all too common.

different typefaces have different x-heights

The answer to where to begin is infuriatingly simple; our default text size will be 1em, meaning that our first seed number will be 1.

There are a number of key benefits to using 1em as our starting point: as a relative unit of measurement an em is well suited to responsive design; by using ems and multiples of ems we can resize our whole scheme by changing the base font size; finally it is a neat conceptual fit with our Lucas sequence and will serve to remind us of the precise integer sequence if we need to revisit the design later.

There’s nothing inherently wrong with using percentages instead of ems, or even pixels or points, but the em is more than likely the future of web design, so we may as well get used to it.

 

Determining our second seed number

There are numerous strategies open to us for determining our second seed number. Some designers have a specific preference and would pick 1.2em or the like. Other designers, who enjoy the mysticism of the Golden Ratio might like to use 1.618em.

A more practical solution is to determine the second seed number using the line-height of the body text. However because line-height is usually dictated by the length of the line and line length is determined by a grid it is more suited to print, or non-responsive web design. Because we’re looking to the future, and the future is responsive, it won’t work for us.

What we’re left with, partly by a process of elimination and partly due to its appropriateness, is the type’s x-height. Or more specifically, the relationship of the x-height to the rest of the glyph.

One characteristic of good design is the repetition of key elements, and carrying the proportions of the type through to the page as a whole is a great opportunity to both acknowledge the work of the type designer and imbue our design with some of the typeface’s character.

Finding our x-height

To find the x-height of your font, we need to open up something like Photoshop or Illustrator and add some text that includes an ascender (e.g. ‘d’) and the letter ‘x’. If you’re using a bitmap editor like Photoshop, set the text as large as possible to ensure you get an accurate result. In these examples I’ve set the font to 500pt in order to measure it.

Next, measure the height from the ascender line to the baseline and the height from the top of the x to the baseline.

Comparing ascender height and x-height

Of course, if you’re lucky enough to have access to good font design software you can simply open up the font file you’ll be using and read off the x-height and ascender height.

Now divide the x-height by the ascender height to find the x-height as a percentage of the whole:

x-height / ascender height * 100 = second seed number

In the case of the font in the example (which is Museo Slab) the result is:

253 / 353 = 0.71671388

or 0.716em

Why are we not measuring from the top of the ascender to the bottom of the descender? Because characters don’t tend to have both an ascender and descender (an occasional exception being the letter ‘f’) and consequently the relationships within the shapes that comprise typeface’s design are based on the relationship between the x-height and one longer stem. It is possible to measure the descender instead, but as the cap-height (the height of the capitals) is usually very close to the ascender that’s my preference. If you find yourself using a typeface with a more dominant quality — the contrast in the thickness of different strokes for example — you might want to use that value in place of the ascender to x-height ratio.

The determination of how to arrive at your second seed number is one of the key design decisions you’re going to have to make, however it’s not something to agonize over; pick a number out of a hat if you prefer, and move on, the good stuff is yet to come.

It’s worth noting that if you switch the equation around and divide the ascender height by the x-height you’ll end up with a number greater than one. In that case your sequence will be steeper and a little more dramatic.

 

Creating our sequence

So, we have our two seed numbers: 1em and 0.716em and we have the formula n = n-1 + n-2:

1 + 0.716 = 1.716
0.716 + 1.716 = 2.432
1.716 + 2.432 = 4.148
etc.

Which results in the following sequence:

1, 0.716, 1.716, 2.432, 4.148, 6.58, 10.728, 17.308, 28.036… ad infinitum

 

The design bit

So far, we’ve picked our way through some basic, but useful mathematics, and we’ve arrived at a sequence that gives us a range of sizes from 1em to 28.036em and beyond if necessary.

We’re now able to use these values as our type sizes sequentially to create a well proportioned type scheme:

Sequential Sizes

You’ll notice that we start with p set to 0.716 and h4 set to 1, despite the fact that that is not sequentially correct. The reason is that in terms of hierarchy h4 is more important than p. Our Lucas Sequence must not dictate hierarchy on the page, it dictates the scale relationships of different elements. Only your content can dictate hierarchy.

Because we’re not restricted to consecutive values in our sequence and are able to pick and choose which integers we use, we always achieve rhythm and structure with the same sequence. Even if we take a very dramatic approach:

Dramatic sizes

Exactly the same Lucas sequence can also be used to create a more reserved, business-like scheme:

Reserved sizing

The essence of this system is that the relationships of scale are maintained, the hierarchy is proportionate, but there is a huge amount of variety available to the designer. This is where you must earn your money: by selecting the sizes on the scale to create hierarchy and emphasis.

 

Flexibility

Frequently, type size is dictated by more than emphasis: issues of accessibility arise if we’re talking about an audience with visual difficulties; the sheer volume of content may throw up restrictions; we may need to be flexible — literally — when designing a fluid layout.

Fortunately, CSS handles this situation with ease. Because we’re using ems for our sizes we can set up our type using our Lucas Sequence and then scale the whole, by setting a default size on the body tag, retaining the rhythm of our design, but increasing or decreasing the actual values.

Flexible sizes

Notice in this image that the p, h2 and h1 sizes remain the same, all drawn from our sequence. It is the variation on the font-size of the body tag (0.8em on the left and 1.4em on the right) that cascades down, creating radically different results.

 

Finally

As dependent on underlying mathematics as this system is, it’s important to acknowledge that design cannot be reduced to a set of equations. This method of sizing type gives you a structure with which to work, and will help you create well proportioned type schemes, but it’s down to you as a designer to use the system as a tool, not as a crutch.

The notes and scales in music, even Jazz, can be reduced to a set of equations that describe their relationship, but it takes someone like John Coltrane to bring those relationships to life.

0 shares
  • http://www.blackbookoperations.com/ Black Book Operations

    A very nice article on some of those “magical” numbers. Though I do think every design needs some kind of “basic” approach, it just goes to show that there are many different “rules” that can be used. And even with those, sometimes the idea is just to “break the rules” and create the freedom to be “different”. Still, very nice method, makes your mind thinking and courage perhaps sinking. Forever learn, forever hunt down new ideas.

    • Anonymous

      Thanks. I agree, I’ve heard of lots of different approaches. In my opinion the only thing that counts is the end result. If you finish up with a great design you did your job, whatever techniques you choose in order to get there.

  • Anonymous

    Like the subject..i can finally understand the use of maths in such a scenario.Kudos

    • For_register

      Like it

      • Anonymous

         :)

    • Anonymous

       Thanks, and you’re welcome!

    • Anonymous

       Thanks, and you’re welcome!

  • Tim

    Thanks for a good article. :)

    • Anonymous

       You’re welcome :)

    • Anonymous

       You’re welcome :)

    • Anonymous

       You’re welcome :)

  • Anonymous

    The last things I need as a designer is to be a mathematician. Some designer’s love academic approach, I usually don’t get carried away this kind of stuff.

    • Anonymous

      I once knew a designer who could size things to the pixel by eye, he just knew how large something was and he knew how large he wanted it to be. I say: whatever works for *you* is the right approach for *you*.

  • http://xklaim.com XKLAIM ★ Creative Division

    Awesome article, especially for someone like me who has been out of a classroom environment for some time now. Thanks for the post!

    • Anonymous

       Glad you liked it! :)

  • Anonymous

     You’re welcome :)

  • Anonymous

     Great!

  • Anonymous

    You’re welcome, and we’ll be publishing some great CSS articles in the coming weeks and months to help you do just that!

  • http://twitter.com/Mppagano Marcos Paulo Pagano

    Golden Ratio.

  • Robiac2000

    Hi Ben,

    Great article. You lost me on the formula though. The example shows n = n-1 + n-2 for which 1 + 0.716 = 1.716. Shouldn’t the next line be 0.716 + (-0.284) = 0.432?

    • Anonymous

      It’s not written in programmer’s vernacular, so that doesn’t help. n-1 doesn’t mean subtract 1 from ‘n’ (which is logical to us) it means the value of the number one position back in the sequence from the number ‘n’.

      The formula is much easier to understand when you say it out loud: each number is the sum total of the two preceding numbers.

      So if we start with 1 and 1.716 the first sum is:

      1 + 0.716 = 1.716

      So then we have three numbers: 1, 0.716 and 1.716, which makes the next sum:

      0.716 + 1.716 = 2.432

      Leaving us with four numbers: 1, 0.716, 1.716 and 2.432. And so on.

      Does that make sense?

    • Anonymous

      It’s not written in programmer’s vernacular, so that doesn’t help. n-1 doesn’t mean subtract 1 from ‘n’ (which is logical to us) it means the value of the number one position back in the sequence from the number ‘n’.

      The formula is much easier to understand when you say it out loud: each number is the sum total of the two preceding numbers.

      So if we start with 1 and 1.716 the first sum is:

      1 + 0.716 = 1.716

      So then we have three numbers: 1, 0.716 and 1.716, which makes the next sum:

      0.716 + 1.716 = 2.432

      Leaving us with four numbers: 1, 0.716, 1.716 and 2.432. And so on.

      Does that make sense?

  • dj

    Nice, and informative background; however, not all that impressed with what you suggest as final implementation.  Just look at the type size you are displaying for the paragraph tags – miniscule.  If this page had been designed in that type size i wouldn’t have read it! [Perhaps there could be some sizing issue with your graphic]

    Another interesting observation. I’m told that nearly all browsers use 16pt fonts as default, ostensibly because that is what they have found is the MOST readable on desktop screens.  However, I notice that you didn’t even mention 16 – you skipped from 14 to 18.

    You are correct about font’s being widely varied and that without a clear understanding of typography issues most designers/developers merely “wing it.”  I don’t know whether I’m the only one who notices or not; but, overall, ever since “design for mobile first” became the mantra, type sizes on our desktop monitors have gotten progressively smaller. Even the type on good old CSS-tricks has gotten so small that it’s an effort to read these days. [And there sure is a lot of wasted space on my desktop monitor for “depots” pages as well] Yet another reason for a good, in-depth, definitive article on do responsive design for page type sizes and baselines. I wish some “opinion-leader” somewhere would come up with a table of recommended “best practices” for type-sizes at the various responsive break-points. [i.e. recommended max and min pt ranges at the various breakpoints for readability – even if it had to be specific to recommended basic fonts]  That would be a great place to start.

    • Anonymous

      Thanks for your comments dj!

      I agree with you 100% that the type at 0.716em is close to unreadable. For the vast majority of fonts — not all — you shouldn’t use type that small on the web. The reason I did in this article was to try and keep the maths simple. The final implementation is 0.716em of 1.4em, which as you can see in the screen shot is more than legible.

      You won’t find 16pt as a default in most design applications because their settings have been inherited from print design. (Fire up Photoshop and take a look.) The point I was alluding to was that designers often make the mistake of sticking to the defaults in their *design process* not the defaults in the viewer’s browser.

      The problem with defining a set of guidelines for type sizes is that no two fonts are the same, not just in size but in design. The variety means that two different fonts set at 16pt may not be equally legible: some common script fonts for example need to be set at at least 20pt whereas something common like Helvetica is huge at that size.

      The important thing to take away from the article is the relationship of scale between different elements, not necessarily the actual sizes in the screenshots.

  • http://noiselesschatter.com/ Philip J Reed

    Benjie:
    This is brilliant. Seriously.  I was going to email you some kudos on this one but you blew me away so much I wanted to make sure I did it in public.  Keep up the killer work.

  • http://www.webdesigncreare.co.uk/ Rachael

    For the first few paragraphs a big wooshing sound was passing over my head, I’m glad that I stuck with it though! I’m definitely going to take this into account in future designs and I have always been interested in trying to create my own typeface and I would use these principles you talk about here if I ever get round to it, I will try and take it into account.

  • Da

    Really interesting. I’d like to see the print version (despite your views :-)
    Here’s the Python if anyone wants it. Lucas, Fib and this …. screen?

    # lucas seedsseed1 =2
    seed2 = 1

    #fib seeds
    seed3 = 0
    seed4 = 1

    # Now using x-ht / asc-ht ~ .716em
    seed5 = 1
    seed6 = 0.716

    def lucas (nminus1, nminus2, limit):   
    if (limit==0):       
    return   
    print nminus1 + nminus2, ” “,   
    lucas(nminus1 + nminus2, nminus1, limit – 1)

    print “Lucas”
    print  seed1, seed2, 
    lucas (seed2, seed1, 10)

    print “nFibonacci”
    print seed3, seed4,
    lucas (seed4, seed3, 10)

    print “nFor print”
    print seed6, seed5, 
    lucas (seed6, seed5, 10)

  • http://www.pixxels.at/ Marion

    Thanks for this interesting and useful article. I love numbers. :)