I’ve just about finished working on a new Chinese font (actually, an extension of WenQuanYi Micro Hei) that includes something I like to think of as “Pinyin characters”.
UPDATE: you can now download the font, and code, from my github repository. Just click the button that says “ZIP”.
Basically, each Pinyin syllable in the chinese text is converted into a character-sized block containing the Pinyin. The tone mark is also moved and enlarged to make it more visible. At the moment, the Pinyin must be entered using numbers for tones, and colons for umlauts, with a space after each syllable, as in “nu:3 ren2 ” (if you’re wondering, the space forms part of the “ligature”). The conversion happens automatically if your browser or application is set up with proper ligature support, and with the font correctly installed. I have currently managed to get this to work in both gEdit (a text editor) and Google Chrome on Linux. With a little work, it should be possible to get it to work in recent versions of IE and Firefox too (and probably on Windows/Mac as well as Linux).
The characters are generated automatically by a Python script, which needs to be imported into the FontForge user interface. The whole set is generated (on my PC) in under 10 minutes, and takes up slightly less than the whole “Private Use” area of Unicode (and also just slightly less than the maximum allowed number of ligatures in “liga”, I think).
First, here is a sample of some Chinese text with embedded Pinyin, using the standard “WenQuanYi Micro Hei” font, displayed in Google Chrome:
And here is the same text in my modified font, still in Google Chrome:
Note that the only difference here is that a different font is selected! The text is identical. Same characters, same number of characters; just some of them are grouped into ligatures. There is no need to re-encode the Pinyin; and saving to a file from gEdit (for instance) causes the original Latin characters to be saved, not the ligatures.
Why would I want to do this? Well, as with most of the things I do, it just seemed like a good idea at the time, I suppose. But the principal motivation really was that I have read online that one of the main reasons for the Chinese not using Pinyin more is that it doesn’t look right alongside Chinese characters. So I thought, what if I could change that? If Pinyin was made to fit in better with ordinary Chinese characters, would the Chinese start using Pinyin more? Would they find it useful? Or does it miss the point? I think it would be interesting to find out.