8/6/2019 Unicode and Keyboards on Windows_c
1/24
Unicode and Keyboards onUnicode and Keyboards onWindowsWindows
Michael KaplanMichael KaplanCathy WissinkCathy Wissink
Globalization Infrastructure and Font TechnologyGlobalization Infrastructure and Font Technology
Windows InternationalWindows International
MicrosoftMicrosoft
8/6/2019 Unicode and Keyboards on Windows_c
2/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 22
Who is this talk geared towards?Who is this talk geared towards?
This is a highThis is a high--level introduction tolevel introduction tokeyboards on Windows, assuming no priorkeyboards on Windows, assuming no priorknowledge.knowledge.
Audience:Audience: Developers new to conceptDevelopers new to concept People who need to understand keyboardsPeople who need to understand keyboards
enough to understand how applications canenough to understand how applications canwork with themwork with them Not completely intended to be a nuts andNot completely intended to be a nuts and
bolts talkbolts talk
8/6/2019 Unicode and Keyboards on Windows_c
3/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 33
Keyboards are simple, right?Keyboards are simple, right?
FontsFonts
Rendering enginesRendering engines
135 different locales on Windows135 different locales on WindowsCustom keyboard layoutsCustom keyboard layouts
Turns out they are not so simple!Turns out they are not so simple!
8/6/2019 Unicode and Keyboards on Windows_c
4/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 44
Keyboard Layout, definedKeyboard Layout, defined
A collection of data for each keystroke andA collection of data for each keystroke andshift state combination with a particularshift state combination with a particular
keyboard driver (DLL)keyboard driver (DLL)
In other words, it is not the keyboardIn other words, it is not the keyboardhardware but the software that connectshardware but the software that connectsthe hardware to the systemthe hardware to the system
8/6/2019 Unicode and Keyboards on Windows_c
5/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 55
Anatomy of a keystrokeAnatomy of a keystroke
User presses a keyUser presses a key
Key contains a scan codeKey contains a scan code
Keyboard layout DLL maps the scan codeKeyboard layout DLL maps the scan codeto a virtual key (VK)to a virtual key (VK)
OS sends the VK to the applicationOS sends the VK to the application
If asked, the DLL maps the VK/shift stateIf asked, the DLL maps the VK/shift stateto characters (if they are assigned)to characters (if they are assigned)
8/6/2019 Unicode and Keyboards on Windows_c
6/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 66
8/6/2019 Unicode and Keyboards on Windows_c
7/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 77
Language featuresLanguage features
single character keystrokessingle character keystrokes
ligaturesligatures
dead keysdead keysshift statesshift states
SGCapSGCap
Caps lock keyCaps lock key
8/6/2019 Unicode and Keyboards on Windows_c
8/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 88
LigaturesLigaturesFor keyboard layouts, not the same as theFor keyboard layouts, not the same as thetypographic/linguistic termtypographic/linguistic term
A combination of2 to 4 UTFA combination of2 to 4 UTF--16 code points16 code points
inserted by a single keystrokeinserted by a single keystroke
8/6/2019 Unicode and Keyboards on Windows_c
9/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 99
Examples of ligatures on keyboardExamples of ligatures on keyboard
Tamil keyboard in the shifted state, showing linguistic charactersTamil keyboard in the shifted state, showing linguistic charactersSri, Ksa, and others as ligaturesSri, Ksa, and others as ligatures
8/6/2019 Unicode and Keyboards on Windows_c
10/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1010
Dead keysDead keys
A combination of two keystrokes to insertA combination of two keystrokes to inserta single charactera single character
Used often in European languages forUsed often in European languages fordiacriticsdiacritics
Called dead since the first keystrokeCalled dead since the first keystrokedoes not appear to do anythingdoes not appear to do anything
Not intuitive to people who are not used toNot intuitive to people who are not used tothemthem
8/6/2019 Unicode and Keyboards on Windows_c
11/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1111
Dead key example:
Diaeresis on the Finnish keyboardInput keysInput keys
TypeType (deadkey)(deadkey)
TypeType + a+ aTypeType + A+ ATypeType + o+ o
TypeType
+ O+ O......TypeType + +
ResultResult
NothingNothing
...... (spacing diaeresis)(spacing diaeresis)
8/6/2019 Unicode and Keyboards on Windows_c
12/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1212
Shift statesShift states
Only 47Only 47--48 physical keys to work with on48 physical keys to work with onthe keyboardthe keyboard
Shift states expand that number by manyShift states expand that number by manytimestimes
For languages with casing, usually theyFor languages with casing, usually theyare cased variants of each otherare cased variants of each other
More shift states available (AltGr, Ctrl)More shift states available (AltGr, Ctrl)
8/6/2019 Unicode and Keyboards on Windows_c
13/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1313
The Greek Keyboard, shifted and unshiftedThe Greek Keyboard, shifted and unshifted
8/6/2019 Unicode and Keyboards on Windows_c
14/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1414
Caps lockCaps lock
Usually intended to be a persistent ShiftUsually intended to be a persistent Shiftkeypress (in other words, it acts like akeypress (in other words, it acts like atypewriter caps lock)typewriter caps lock)
Generally used to get at shift state withoutGenerally used to get at shift state withouthaving to press two keys concurrentlyhaving to press two keys concurrently
Often used with cased languagesOften used with cased languages
May do nothing in languages without case,May do nothing in languages without case,or be used for other purposesor be used for other purposes
8/6/2019 Unicode and Keyboards on Windows_c
15/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1515
SGCapSGCap
Advanced usage of the Caps Lock keyAdvanced usage of the Caps Lock key
Used by Swiss German, Czech, andUsed by Swiss German, Czech, and
Hebrew keyboardsHebrew keyboardsAdds two additional shift statesAdds two additional shift states
Only intuitive to people who understandOnly intuitive to people who understand
the mechanismthe mechanism
8/6/2019 Unicode and Keyboards on Windows_c
16/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1616
APIsAPIs
keybd_eventkeybd_eventMapVirtualKey[Ex]MapVirtualKey[Ex]OemKeyScanOemKeyScan
SendInputSendInputToAscii[Ex]ToAscii[Ex]ToUnicode[Ex]ToUnicode[Ex]VkKeyScan[Ex]VkKeyScan[Ex]
The APIs allow developers to do the same mappings the OSThe APIs allow developers to do the same mappings the OSdoes when moving between scan codes, VKs, anddoes when moving between scan codes, VKs, andcharacters.characters.
8/6/2019 Unicode and Keyboards on Windows_c
17/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1717
Factors in keyboard layout creationFactors in keyboard layout creation
National/regional standard?National/regional standard?What languages need to be supported?What languages need to be supported?
Is the set of characters needed for theIs the set of characters needed for thelanguage complete?language complete?Focus on code points and not glyphs?Focus on code points and not glyphs?Do all required characters exist inDo all required characters exist in
Unicode?Unicode?Consistent use of features such as deadConsistent use of features such as deadkeys, ligatures, etc.?keys, ligatures, etc.?
8/6/2019 Unicode and Keyboards on Windows_c
18/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1818
Where do IMEs fit in?Where do IMEs fit in?
For most languages, they dont!For most languages, they dont!
For CJK languages, even 47 keys X 8 shiftFor CJK languages, even 47 keys X 8 shift
states is not enoughstates is not enoughDifferent mechanisms and APIs are usedDifferent mechanisms and APIs are usedfor IME interactionfor IME interaction
More information can be found in theMore information can be found in thePlatform SDKPlatform SDK((http://msdn.microsoft.com/platformsdkhttp://msdn.microsoft.com/platformsdk))
8/6/2019 Unicode and Keyboards on Windows_c
19/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 1919
FAQs about keyboardsFAQs about keyboards
Does Microsoft make these layouts up?Does Microsoft make these layouts up?
How do I add every glyph for myHow do I add every glyph for my
language?language?Dont I need an IME?Dont I need an IME?
How do I replace the layout for myHow do I replace the layout for my
language if I do not like the one provided?language if I do not like the one provided?How do I add my own keyboard layout?How do I add my own keyboard layout?
8/6/2019 Unicode and Keyboards on Windows_c
20/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 2020
MSKLCMSKLCMicrosoft Keyboard Layout CreatorMicrosoft Keyboard Layout Creator
Create new keyboard layouts:Create new keyboard layouts: Brand new layoutsBrand new layouts
Modified from existing keyboardsModified from existing keyboardsDeploy the created keyboard layout toDeploy the created keyboard layout toNT4, Win2000, WinXP, or Win ServerNT4, Win2000, WinXP, or Win Server2003 machines2003 machines
Save the definition of the keyboard forSave the definition of the keyboard forlater developmentlater development
8/6/2019 Unicode and Keyboards on Windows_c
21/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 2121
MSKLC demosMSKLC demos
8/6/2019 Unicode and Keyboards on Windows_c
22/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 2222
Other ReferencesOther ReferencesThis tutorial's corresponding paperThis tutorial's corresponding paperWindows Keyboard LayoutsWindows Keyboard Layoutshttp://www.microsoft.com/globaldev/reference/keyboards.asp x
Nadine Kano,Nadine Kano, Developing International SoftwareDeveloping International Software
(out of print, but still available on the web)(out of print, but still available on the web)http://microsoft.com/globaldev/dis_v1/disv1.asphttp://microsoft.com/globaldev/dis_v1/disv1.aspNew!New! Developing International SoftwareDeveloping International Software , 2nd, 2ndeditioneditionhttp://microsoft.com/globaldev/dis_v2/disv2.asphttp://microsoft.com/globaldev/dis_v2/disv2.asp
Internationalization with Visual BasicInternationalization with Visual Basichttp://i18nWithVB.com/http://i18nWithVB.com/
Get on the MSKLC Beta!Get on the MSKLC Beta!
8/6/2019 Unicode and Keyboards on Windows_c
23/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 2323
Questions?Questions?
8/6/2019 Unicode and Keyboards on Windows_c
24/24
25 March 200325 March 2003 Prague, Czech Republic (IUC23)Prague, Czech Republic (IUC23) 2424
Don't forget to fill out yourDon't forget to fill out yourevaluations!evaluations!
Unicode and KeyboardsUnicode and Keyboardson Windowson Windows