{"id":87,"date":"2021-07-13T05:28:47","date_gmt":"2021-07-13T05:28:47","guid":{"rendered":"https:\/\/blogs.scummvm.org\/djsrv\/?p=87"},"modified":"2021-07-20T04:00:59","modified_gmt":"2021-07-20T04:00:59","slug":"director-in-japanese","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/djsrv\/2021\/07\/13\/director-in-japanese\/","title":{"rendered":"Director in Japanese!"},"content":{"rendered":"\n<p>As of this week, the Director engine now supports Japanese text:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"668\" height=\"536\" src=\"https:\/\/blogs.scummvm.org\/djsrv\/wp-content\/uploads\/sites\/4\/2021\/07\/Screenshot-from-2021-07-13-00-24-26.png\" alt=\"\" class=\"wp-image-88\" srcset=\"https:\/\/blogs.scummvm.org\/djsrv\/wp-content\/uploads\/sites\/4\/2021\/07\/Screenshot-from-2021-07-13-00-24-26.png 668w, https:\/\/blogs.scummvm.org\/djsrv\/wp-content\/uploads\/sites\/4\/2021\/07\/Screenshot-from-2021-07-13-00-24-26-300x241.png 300w, https:\/\/blogs.scummvm.org\/djsrv\/wp-content\/uploads\/sites\/4\/2021\/07\/Screenshot-from-2021-07-13-00-24-26-480x385.png 480w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/figure>\n\n\n\n<p>Trembyle found this cool demo about Alan Kay, and I&#8217;m a big fan of Smalltalk, so it&#8217;s nice to have this running!<\/p>\n\n\n\n<p>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 <a href=\"https:\/\/en.wikipedia.org\/wiki\/KanjiTalk\">KanjiTalk<\/a>). We have a <a href=\"https:\/\/github.com\/scummvm\/scummvm\/blob\/master\/devtools\/create_classicmacfonts.sh\">script<\/a> 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 <a href=\"https:\/\/web.archive.org\/web\/20011227220326\/http:\/\/download.info.apple.com\/Apple_Support_Area\/Apple_Software_Updates\/Japanese\/Macintosh\/System\/\">other versions of KanjiTalk<\/a>, checking if they contained any font data. Sadly, they don&#8217;t contain the fonts, at least as far as I can tell. The oldest version with fonts I could find was <a href=\"https:\/\/9to5mac.com\/2021\/06\/30\/mac-os-x-mountain-lion-free\/\">Mac OS X Lion<\/a>, which Apple released for free just a couple weeks ago. It&#8217;s more recent than I&#8217;d prefer, and it doesn&#8217;t contain all the fonts we need, but it&#8217;s close enough. I wrote a <a href=\"https:\/\/github.com\/scummvm\/scummvm\/blob\/master\/devtools\/create_japanesemacfonts.sh\">script<\/a> which extracts the fonts Osaka and OsakaMono from that installer.<\/p>\n\n\n\n<p>Next, I added all the Japanese font names to the MacFontManager, making any fonts we don&#8217;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!<\/p>\n\n\n\n<p>While we can <em>render<\/em> Japanese text, making the rest of the engine support Japanese is quite a bit of work, and it&#8217;s still a work in progress. Since Director would go on to support a huge number of different text encodings, for simplicity&#8217;s sake, I&#8217;m changing most internal text handling over to UTF-8. I&#8217;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&#8217;t support Unicode until version 11, and we&#8217;re currently working on Director 4, so we&#8217;re quite a bit ahead of the curve, and this will go a long way in future-proofing our code. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As of this week, the Director engine now supports Japanese text: Trembyle found this cool demo about Alan Kay, and I&#8217;m a big fan of Smalltalk, so it&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-87","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/87","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/comments?post=87"}],"version-history":[{"count":18,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":109,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/posts\/87\/revisions\/109"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/media?parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/categories?post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/djsrv\/wp-json\/wp\/v2\/tags?post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}