[Updated 11 Aug 2006, changed tlh-pIqaD-US names to reflect IETF standard]
Cool, they let us post files now I’ll have to try that out. The example only works for Windows Vista, although the culture would work for Microsoft .Net 2.0.
Creating a custom locale for a script that isn’t in one of the existing system fonts is a bit more challenging. I picked Klingon for this, even though its a “made up” language because it demonstrates all of the parts. Presumably “real” locales will have a similar need to make a keyboard or maybe even use a 3rd party font to support their language and script. Here’s what it looks like in Outlook (Outlook creates the date from user locale data when you press reply).
WARNING: What I’m doing isn’t supported, but it mostly works for me, so maybe it’ll be informative to you. This example involves mucking with the registry and if the wrong thing happens you could pretty much make a mess of your system. Back up the registry before doing this and don’t do this if you don’t understand the registry.
The problem with Klingon in its native script as an example is that pIqaD isn’t supported in Unicode, nor is it supported by Windows, nor is there any way to type it in. So to make it work in a reasonable fashion we need A) a Custom Locale, B) a font, C) a way to trick the system into using our font, and D) a keyboard to type in that culture.
The attached tlh-pIqaD-US.zip has these pieces in it.
- example.png shows an example of Outlook using the custom locale on Windows Vista after doing these steps.
- tlh-pIqaD-US.msi installs a Klingon custom locale on Vista that uses the pIqaD font. This .msi was created using the Microsoft Custom Locale Builder tool beta, which I’ll blog about later when I have more links.
- tlh-pIqad-US.ldml is the LDML for that culture. You don’t need this if you use the .msi, but I included it for completeness.
- pIqaD.ttf is a font I created for Klingon. This is my first time making a font and I’m not an expert. Its been a bit strange for me sometimes, but mostly it works.
- pIqaD font linking.reg has some registry entries to make Windows Vista include this in its font linking list for some common fonts used by the system. Theoretically this slows down the system to do this, but I haven’t noticed any problem. This is another area I don’t understand well, but it works (for me anyway).
- US-Kling.msi is an installer for a Klingon keyboard. It attaches to EN and uses Alt-GR for the Klingon (press ctrl+alt+a letter key). I picked letters for the sounds in Klingon. It uses the US-kling.dll in the i386 folder to install.
- en-klingon.klc is a Microsoft Keyboard Layout Creator file used with MSKLC to create the preceding .msi. In case you don’t like my keyboard you can make your own.
Making it all work. To use my example, unzip all the attached files somewhere convenient and follow these steps:
A) To make a Klingon custom locale with the pIqaD script on Windows Vista, the first thing we need is to create and install the locale. You can either run tlh-pIqaD-US.msi on Windows Vista, or use the LDML with the CultureAndRegionInfoBuilder or make your own. I covered a bit more about custom locales in my previous blogs.
B) Making a font is really hard. Hopefully you can get whatever font you need from someone else for a few bucks, but I needed a font I could post here, so I had to make my own. Just copy the pIqaD.ttf to your %windir%\fonts folder. Note that my font isn’t “quite right” and I don’t know why. Some builds of Vista have given me fits with it, let me know if there are problems.
C) “Font Linking” is what we call the Windows behavior where the OS looks for a different font if it can’t find your character in the specified font. MSDN describes this more here.
If you look at [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink] in the registry, you’ll see entries for each font. Stick your font name (ie: pIqaD.ttf) at the beginning of each font you want to fallback to your characters. The attached “pIqaD Font Linking.reg” does that for 4 common fonts in Windows Vista. Note that this means that any other font using those code points won’t get used, so do this with care. Normally the list falls back in cases like falling back to Chinese fonts from Latin fonts. You have to reboot to get the new linked fonts to behave.
D) A font doesn’t do much good if you can’t type it into the machine. I used the Microsoft Keyboard Layout Creator to create the US-Kling.msi. Michael Blogs about the MSKLC if you want more info. Run US-Kling.msi to install the keyboard.
- Install the US-Kling.msi (the i386 folder and the US-Kling.dll in it must be in the same place as the .msi)
- From Regional Options (run intl.cpl), pick Keyboards and Languages, then pick Settings, then pick Add and pick English US Klingon (AltGr) from the list. There might be a better way to attach it in Vista, but I haven’t tried since XP and they have to be stuck to existing system languages.
- Go ahead and select Klingon (US, pIqaD) as your default user locale if you want while you’re in regional options.
- You may need to right click on the task bar to pick the Language Bar toolbar.
- Click on the Keyboard icon on the Language Bar to change to the new keyboard.
I hope this has been useful (or at least entertaining). Even though I picked Klingon, hopefully other users will find more mainstream uses for these pieces.