Monday, June 15, 2015

Typewriterisms Part Deux

First, read typewriterisms.

So I sat down and decided to work on the second part of what I had written in that old post. For reference, here's a Courier-based (non-jitter) version:



At first, I tried to attack the problem by trying to figure out how to encode and embed a pan-unicode font, which in our case is GNU Unifont. Then I realised I had two problems: I had to vectorise the raster format of the GNU Unifont (no easy task considering the tricks used to mimic a higher resolution for the CJK ideographs via a careful play of negative spaces), and I had to somehow shove that into a dictionary in the PostScript file to be referred to by the page layout program. I spent some time looking at all that and it all seemed like too much work.

Then I discovered the image PostScript command and figured that I could just render the GNU Unifont as a monochrome bitmap instead.

I put together a database from the GNU Unifont source hex files (and the combining characters list for all the diacritics) and slowly put together an increasingly sophisticated sequence of line renderers. With that (and some numerical tweaking on the driver program to make it look like lpr-emu.py), I present the output of ulpr-emu.py, a Unicode aware monospaced font ``typewriter'' renderer. Here's the output with the same input as before:



Kind of boring, I know. Apart from the different looking glyphs, there isn't anything particularly Unicode about it. But here's a render of the lyrics to 粉雪 by レミオロメン:



That's almost pure Unicode (technically UTF-8 with CJK ideograms).

I don't think I'm going to add that jitter thing to the rendering process this time. This can be seen as the prelude towards my 简谱 rendering system. I'm still debating whether to release ulpr-emu.py, since it is using the GNU Unifont dataset. But we'll see how it all turns out.

Till the next update.

Edit: I've released the sources.

No comments: