Director in Japanese!

As of this week, the Director engine now supports Japanese text:

Trembyle found this cool demo about Alan Kay, and I’m a big fan of Smalltalk, so it’s nice to have this running!

The first thing I had to do was find a source for the fonts from the Japanese version of classic Mac OS (which, interestingly, was called KanjiTalk). We have a script that extracts the fonts from the English version of System 7.0.1, which is available as a free download from Apple, and I was hoping to do the same with the Japanese System 7.0.1. Unfortunately, Apple has not released that version for free, so I spent the better part of a day going through the update files for other versions of KanjiTalk, checking if they contained any font data. Sadly, they don’t contain the fonts, at least as far as I can tell. The oldest version with fonts I could find was Mac OS X Lion, which Apple released for free just a couple weeks ago. It’s more recent than I’d prefer, and it doesn’t contain all the fonts we need, but it’s close enough. I wrote a script which extracts the fonts Osaka and OsakaMono from that installer.

Next, I added all the Japanese font names to the MacFontManager, making any fonts we don’t have fall back to Osaka or OsakaMono. Then, after making the engine detect which text encoding is used, then converting that to UTF-32, we can now render Japanese text!

While we can render Japanese text, making the rest of the engine support Japanese is quite a bit of work, and it’s still a work in progress. Since Director would go on to support a huge number of different text encodings, for simplicity’s sake, I’m changing most internal text handling over to UTF-8. I’m hoping to get the engine fully Unicode-ified by the end of today so I can move onto something more exciting than text encoding. Director itself didn’t support Unicode until version 11, and we’re currently working on Director 4, so we’re quite a bit ahead of the curve, and this will go a long way in future-proofing our code. 🙂

Leave a Reply

Your email address will not be published.