Automatic spacing/kerning: an attention-based approach (collaborators wanted!)

Hello typophiles,

I've been hacking on a new approach to letterfitting and thought perhaps some of you might be interested (seeing as Simon got some good discussion out of his Atokern thread). It's inspired by a deep learning concept (attention masking) but doesn't actually use a neural net, because I don't think neural nets are the right solution – we need an understandable model with fully adjustable parameters, not an inscrutable black box.

I have some preliminary results, and what's needed now is a solid tool to evaluate how different implementations for the various parts of the model would affect the quality of the output depending on font type (e.g. display-size hairline italic sans vs. caption-size blackletter). Since I don't think I'll find enough time to finish this by myself in the near future and didn't want this to languish on my hard drive forever, I wrote up what I have so far as a blog post. I'm happy to answer any questions here if my explanations are unclear.

Perhaps one of you is intrigued enough and willing to help me tinker with this as a team?


  • Simon CozensSimon Cozens Posts: 328
    This is fascinating! And I think you are on to something here. After I realised I wasn't getting anywhere with the neural network approach, I thought about a few other different possibilities, before ending up with the "equal area" approach borrowed from HT_LetterSpacer. But one of those possibilities was, in essence, a much cruder version of what you describe here:
    • Arrange a set of key letters like "nnnn"
    • Gradually apply a Gaussian blur until there's no whitespace between the stems.
    • Use the same blur radius on your target pair.
    • Adjust the spacing of the target pair until the midline has an even grey.
    I never actually tried implementing it, but it intuitively models how we see "color" in letterfitting.

    I'll take some time to digest this and then have a play with your code. Exciting!
  • Thanks Simon! Looks like we're thinking along the same lines here. The crux is in the "until the midline has an even gray" – can you express that more rigorously?

    Oh, and be forewarned, the code looks like this:

  • edited March 30
    I'm very much intrigued. As for whether or not I have anything useful to add to the project myself? Probably not. Nice to see a new post on your site, though.
Sign In or Register to comment.