Unicode and Keyboards on Windows Michael Kaplan Cathy Wissink Globalization Infrastructure and Font Technology Windows International Microsoft.

Download Report

Transcript Unicode and Keyboards on Windows Michael Kaplan Cathy Wissink Globalization Infrastructure and Font Technology Windows International Microsoft.

Unicode and Keyboards on
Windows
Michael Kaplan
Cathy Wissink
Globalization Infrastructure and Font Technology
Windows International
Microsoft
Who is this talk geared towards?
This is a high-level introduction to
keyboards on Windows, assuming no prior
knowledge.
Audience:
– Developers new to concept
– People who need to understand keyboards
enough to understand how applications can
work with them
– Not completely intended to be a “nuts and
bolts” talk
25 March 2003
Prague, Czech Republic (IUC23)
2
Keyboards are simple, right?
Fonts
Rendering engines
135 different locales on Windows
Custom keyboard layouts
Turns out they are not so simple!
25 March 2003
Prague, Czech Republic (IUC23)
3
Keyboard Layout, defined
A collection of data for each keystroke and
shift state combination with a particular
keyboard driver (DLL)
In other words, it is not the keyboard
hardware but the software that connects
the hardware to the system
25 March 2003
Prague, Czech Republic (IUC23)
4
Anatomy of a keystroke
User presses a key
Key contains a scan code
Keyboard layout DLL maps the scan code
to a virtual key (VK)
OS sends the VK to the application
If asked, the DLL maps the VK/shift state
to characters (if they are assigned)
25 March 2003
Prague, Czech Republic (IUC23)
5
25 March 2003
Prague, Czech Republic (IUC23)
6
Language features
single character keystrokes
ligatures
dead keys
shift states
SGCap
Caps lock key
25 March 2003
Prague, Czech Republic (IUC23)
7
Ligatures
For keyboard layouts, not the same as the
typographic/linguistic term
A combination of 2 to 4 UTF-16 code points
inserted by a single keystroke
25 March 2003
Prague, Czech Republic (IUC23)
8
Examples of ligatures on keyboard
Tamil keyboard in the shifted state, showing linguistic characters
Sri, Ksa, and others as ligatures
25 March 2003
Prague, Czech Republic (IUC23)
9
Dead keys
A combination of two keystrokes to insert a
single character
Used often in European languages for
diacritics
Called “dead” since the first keystroke
does not appear to do anything
Not intuitive to people who are not used to
them
25 March 2003
Prague, Czech Republic (IUC23)
10
Dead key example:
Diaeresis on the Finnish keyboard
Input keys
Result
Type ¨ (deadkey)
Type ¨ + a
Type ¨ + A
Type ¨ + o
Type ¨ + O
...
Type ¨ + <space>
Nothing
ä
Ä
ö
Ö
...
¨ (spacing diaeresis)
25 March 2003
Prague, Czech Republic (IUC23)
11
Shift states
Only 47-48 physical keys to work with on
the keyboard
Shift states expand that number by many
times
For languages with casing, usually they
are cased variants of each other
More shift states available (AltGr, Ctrl)
25 March 2003
Prague, Czech Republic (IUC23)
12
The Greek Keyboard, shifted and unshifted
25 March 2003
Prague, Czech Republic (IUC23)
13
Caps lock
Usually intended to be a persistent Shift
keypress (in other words, it acts like a
typewriter caps lock)
Generally used to get at shift state without
having to press two keys concurrently
Often used with cased languages
May do nothing in languages without case,
or be used for other purposes
25 March 2003
Prague, Czech Republic (IUC23)
14
SGCap
Advanced usage of the Caps Lock key
Used by Swiss German, Czech, and
Hebrew keyboards
Adds two additional shift states
Only intuitive to people who understand
the mechanism
25 March 2003
Prague, Czech Republic (IUC23)
15
APIs
keybd_event
MapVirtualKey[Ex]
OemKeyScan
SendInput
ToAscii[Ex]
ToUnicode[Ex]
VkKeyScan[Ex]
The APIs allow developers to do the same mappings the OS
does when moving between scan codes, VKs, and
characters.
25 March 2003
Prague, Czech Republic (IUC23)
16
Factors in keyboard layout creation
National/regional standard?
What languages need to be supported?
Is the set of characters needed for the
language complete?
Focus on code points and not glyphs?
Do all required characters exist in
Unicode?
Consistent use of features such as dead
keys, ligatures, etc.?
25 March 2003
Prague, Czech Republic (IUC23)
17
Where do IMEs fit in?
For most languages, they don’t!
For CJK languages, even 47 keys X 8 shift
states is not enough
Different mechanisms and APIs are used
for IME interaction
More information can be found in the
Platform SDK
(http://msdn.microsoft.com/platformsdk)
25 March 2003
Prague, Czech Republic (IUC23)
18
FAQs about keyboards
Does Microsoft make these layouts up?
How do I add every glyph for my
language?
Don’t I need an IME?
How do I replace the layout for my
language if I do not like the one provided?
How do I add my own keyboard layout?
25 March 2003
Prague, Czech Republic (IUC23)
19
MSKLC
Microsoft Keyboard Layout Creator
Create new keyboard layouts:
– Brand new layouts
– Modified from existing keyboards
Deploy the created keyboard layout to
NT4, Win2000, WinXP, or Win Server
2003 machines
Save the definition of the keyboard for
later development
25 March 2003
Prague, Czech Republic (IUC23)
20
MSKLC demos
25 March 2003
Prague, Czech Republic (IUC23)
21
Other References
This tutorial's corresponding paper
Windows Keyboard Layouts
http://www.microsoft.com/globaldev/reference/keyboards.aspx
Nadine Kano, Developing International Software
(out of print, but still available on the web)
http://microsoft.com/globaldev/dis_v1/disv1.asp
New! Developing International Software , 2nd
edition
http://microsoft.com/globaldev/dis_v2/disv2.asp
Internationalization with Visual Basic
http://i18nWithVB.com/
Get on the MSKLC Beta!
25 March 2003
Prague, Czech Republic (IUC23)
22
Questions?
25 March 2003
Prague, Czech Republic (IUC23)
23
Don't forget to fill out your
evaluations!
Unicode and Keyboards
on Windows
25 March 2003
Prague, Czech Republic (IUC23)
24