Re: How to create Unicode input methods for MacOS? (long)

From: Deborah Goldsmith (
Date: Fri Apr 21 2000 - 14:57:53 EDT

on 4/21/2000 9:28 AM, Sebastian Hagedorn <>

> Hmm, I don't want to put the cart before the horse, but if I managed to
> create a 'uchr' resource, what file type and creator would I have to use to
> be able to install it by dragging it to the System file?

The type is 'kfil' and the creator is 'movr'.

> Now for the meatier stuff: I don't really understand the relationship
> between the 'UCKeyModifiersToTableNum' structure and the
> 'UCKeyToCharTableIndex' structure. Taking the Extended Roman example, there
> are 112 modifier key combinations that are mapped to 8 different tables. I
> guess these 8 tables are similar to the ones in a KCHR resource. What I
> don't get is how I know which modifier key combination is mapped to which
> table, i.e. how do I know which modifier keys are pressed for the first of
> the 112 entries, for the second etc.

The (0-based) index into the UCKeyModifiersToTableNum structure is just the
modifierKeyState value that is passed into UCKeyTranslate. This is described
on page 36 of the document.

The whole process is described on page 39, though for some mysterious reason
steps 1 through 5 of the process have been renumbered 5 through 9...

> The tables with the actual UCKeyOutput values are also somewhat baffling. I
> understand the distinction between the 3 different kinds of values these
> can be, but even the simple Unicode characters confuse me. When I noticed
> that the ciphers appear in the order 1 2 3 4 6 5 I remembered that they
> appear in this order in ResEdit's KCHR editor as well. The (virtual?) key
> codes there seem to correspond to the ones in the uchr table, but only for
> the ciphers. The other code points don't always seem to point to state
> records or character sequences, but they also don't give values for plain
> Roman characters, as I would've expected (c.f. offset 178 ff.).

Looking at the examples I have of the source code for some 'uchr's, I guess
I don't understand what you are seeing. Plain (single) Unicode characters
should appear as themselves. Just to recap:

1. Use the keyboard type to find the right set of tables.

2. Using the modifiers bits, you get a table number out of the
UCKeyModifiersToTableNum structure.

3. Using the table number, get a particular offset from the array of offsets
(member keyToCharTableOffsets of UCKeyToCharTableIndex).

4. Add the virtual key code to get the offset (from the beginning of the
'uchr') of a 16-bit value. For plain Unicodes, that's just the value of the

If you have further questions, please contact me off-list.

Deborah Goldsmith
Manager, International Toolbox Group
Apple Computer, Inc.

This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:21:02 EDT