Autospacing: the CounterSpace library

Those who know me will know I have become somewhat obsessed with the problem of automated letterfitting: not just spacing (determining sidebearings) but also full fitting (adjustments for uneven pairs, i.e. kerning). My latest attempt at this can be found here. It consists of a Python library, a Jupyter notebook, and a Glyphs script.

This document explains the concept and shows some sample outputs. Here are some more examples of automatically fitted strings (red) compared with the designer's spacing (blue).



For the sake of full disclosure, here are some heroic failures.


Here's a summary of what I've learnt through the process:
  • Using an "'influence" approach to spacing seems to work pretty well in general.
  • Having the designer declare key pairs as correctly spaced and inferring the parameters from there seems to be the best kind of user interface to this job.
  • The hardest part of automated letterfitting is managing and correcting half-open counters.
I hope this is interesting to others!

Comments

  • John HudsonJohn Hudson Posts: 2,955
    Having the designer declare key pairs as correctly spaced and inferring the parameters from there seems to be the best kind of user interface to this job.
    Amen.

  • Alex KaczunAlex Kaczun Posts: 163
    edited November 2019
    Font spacing and kerning is very subjective. No two people will ever see it exactly the same. That being said, there are many general guidelines to follow for standard text, display and for point sizes based on screen or for print. Many well designed fonts currently exist and can be utilized for this purpose. The more experience you have the better your results will be. That's true for most things.

    I agree completely with Nick and often find myself trying to improve on many of my older font releases. It's human nature to strive for that elusive perfection. But, we cannot help ourselves. It's the way most creative people are. And we should be commended for that.

    Now, I'm off to finish the spacing and kerning on my upcoming new font family release. It's my second pass on my original established spacing and kerning and I'm still tweaking. Maybe third time will be the charm.

    And, I'm sure that when I look back years from now, I'll want to make additional changes.

    Back to work!
  • Thomas PhinneyThomas Phinney Posts: 2,730
    edited November 2019
    @Simon Cozens The one thing that surprises me is the significant sidebearing addition to the left side of the upright (not italic) /A in the auto-spacing, when it starts the line.

    It seems to me that perhaps your algorithm is treating the beginning of the line as equivalent to being next to a solid square with zero sidebearing and adjusting the position accordingly? But whatever the cause, the result is not ideal, IMO.
  • @Nick Shinn and @Alex Kaczun: I agree with what you’re saying but want to push back on a subtle distinction. The overall approach to spacing a font, the way it’s going to look, is a subjective judgement. But once that judgement has been made, the spacing of most individual pairs from then on is a matter of fitting in with that style, in the same way that once you have designed a testword well then you have pointers that should carry you through the rest of the design. If I’m right about that, then automated spacing is a possibility if there is a mechanism for the designer to declare a set of prototypical pairs.

    @Thomas Phinney: What you’re seeing is just the word being centred. I’ll fiddle it to be left-aligned in the comparison; that might be clearer.
  • Left-aligning the output shows that it wants to cut a bit deeper into overhangs like "TA" and "AV" than the designer did.

    Also, the Tinos Italic version actually seems to work a lot better with the serif smoothing turned off:

  • Instead of left-aligning the output, you could (if you wish) instead adjust the bottom ruler position so that its zero is at the origin for the first glyph. (I assumed it was.)
  • This is awesome, Simon! I've had some fun with a similar project and am getting really pretty good results. Having the different colored words overlayed on each other makes it difficult for me to really understand the visual effect of the two different spacings since the white white space has color intrusion. I wonder if it would help to have them vertically stacked instead so you can see each one as a whole word in order to judge the given spacing of one and easily compare it to the other without visual interference? Just a thought.
  • Nick ShinnNick Shinn Posts: 2,131
    edited November 2019
    Simon said:
    if there is a mechanism for the designer to declare a set of prototypical pairs.
    I don’t believe that to be so.

    When kerning through the alphabet in the Metrics window, I often go back and readjust earlier sidebearings, or glyph details (e.g. the relative width of the horizontals in E, F, L and T), as the overall picture falls into place. Feedback loops, not linear progression.
  • @Simon Cozens
    If interested, contact me directly at akaczun@verizon.net
    I have a few ideas that might help you with your project.
    I've been thinking about this sort of thing for some time.
    Maybe I can be of some help in a slightly different direction.
    Best—Alex K.
  • Yes, that helps a lot more to see the difference between the two cases.
Sign In or Register to comment.