Simon Cozens technical blog

What did I do this week? (w/b 2020-07-20)

I’ve been working as a freelance font engineer for nearly two months now, and have been keeping sporadic notes on what I’ve been doing, but inspired by Dan Reynolds’ “Freelance Diary” I thought I’d try making them public. I don’t know if I have the discipline to make this a regular feature - I don’t really have the discipline to write my work log each day. There may also be some stuff I can’t talk about due to client confidentiality. But here goes:

  • Was on holiday until Monday, but while on holiday I had a idea and got distracted by it - how about if we can automatically compare shaping output between different shaping engines by generating random strings according to a pattern? I’ve been hit in the past by difference between Harfbuzz shaping and CoreText shaping, so I wanted to “fuzz” fonts to find these kinds of difference. So first I made the pattern generator, which is called StringBrewer. It’s neat, you give it a pattern file like this:
Base ConsModAbv? (Halant Base ConsModAbv?) VowelAbove? VowelBelow? VowelPost? VowelModifierAbove? VowelModifierPost? ConsFinalAbv?

Base = 1B17 1B26 1B27 1B33
ConsModAbv = 1B34
Halant = 1B44
VowelAbove = 1B36
VowelBelow = 1B38 1B39
VowelPost = 1B35
VowelModifierAbove = 1B00 1B01
VowelModifierPost = 1B04
ConsFinalAbv = 1B03

and it emits random sequences which fit the pattern.

  • Tuesday. This fuzzing engine is going to be driven by uharfbuzz, so that needed the ability to select between different subshapers. So I added that. Had a look at some of Google Fonts’ toolchain, including fontdiffenator, and made it substantially faster. Also looked at Röntgen.

  • Wrote the shaping comparison fuzzer, hbuzzfuzz. Found a load of differences in Telugu handling, and I’m guessing that they’re because of differences between old Indic shapers and the USE. But visually they look the same, so who cares if the shaping is handled differently? So to be useful, hbuzzfuzz will also need to do a visual check if the shaping check shows a difference. This will necessitate…

  • Wednesday: Added code to uharfbuzz to wrap the SVG drawing routines, and added code to vharfbuzz to turn a shaped buffer into an SVG file, meaning that you can go from a Python string to a SVG shaped with Harfbuzz, and from there to PNG or whatever you like. A little bit of numpy magic and hbuzzfuzz can check for visual differences.

  • Thursday: Fixed some SILE issues. Then I had another new idea and got distracted by that. (This could be the content of most of my work log entries.) Building a variable font outside of apps that do that for you (and cost money) is difficult, and the upshot is that there’s no open source way to create opentype variable fonts yet. So I’ve set to work writing a React/Electron cross-platform app called “Pilcrow” (continuing the Corvel theme) to do that - help you set up your axes, sources and instances, create a designspace file, and then run fontmake on it. Lots of time fighting React. I make front-end stuff, but I really don’t like it. Had a meeting about a conference I’m organising in October.

  • Friday: More Pilcrow; it lets you set up axes and sources - not instances yet - and it should be able to export a designspace file. Doesn’t call fontmake yet, obviously, not does it parse an existing designspace file although that’s not too hard. Lots of time dealing with fiddling UI things - what if the user makes the minimum axis value less than the current default, and so on. Urgh. Then a work meeting, after which I started playing with someone else’s font that they sent me. Ended up using my Auto Cursive Attachment script, which is awesome and saved huge amounts of time.

Ongoing work

  • fontTools documentation: Worked on documentation for mtiLib, and started work on documenting the pens; no PR yet.

  • fontTools hacking: I’m still trying to get fontTools to generate different format GSUB5/6 lookups (format 1 and format 2) - it only does format 3 right now, which is not terribly efficient. Two weeks ago I made a PR for format 1, but got some good feedback about how lookup rules should be expressed internally; I implemented that as #2026. We also keep getting into fights about formatting the codebase, so I added a PR to reformat the stuff I was working on.

Next week

  • It’s going to be mainly more Pilcrow. This is how I work - decide something is going to be Life Changing And Awesome and work on it until it more-or-less works, release it, and move on to the next shiny object.
  • Basic engineering of a historic font which might have some useful lessons for the main day-job project.
  • Unusual number of interesting meetings - shaping working group, UFO spec meet-up, etc.
Written on July 5, 2020