SAMPLE: KEYBFONT.EXE: Input Language and Font Matching

Last reviewed: January 15, 1998
Article ID: Q152753
4.00    | 4.00
WINDOWS | WINDOWS NT kbprg kbui kbprint kbfile

The information in this article applies to:

  • Microsoft Win32 Software Development Kit (SDK), versions 3.5, 3.51, 4.0

SUMMARY

In Windows 95 and Windows NT 4.0 non-Unicode applications, when the input language changes and, as a result, the default character set supported by this language also changes, the script of the current font should also be changed, such as changing the input language from English to Russian. By the same token, when the character set (script) of the font changes, the input language should be changed to match the new script, such as changing from Times New Roman Western script to Times New Roman Cyrillic script. Note that in Windows NT 4.0 Unicode applications, changing the font is not necessary because of support for multicharset fonts. For these applications, the methods described here can be used to detect if a given language is supported by a given font.

The KEYBFONT sample demonstrates the use of WM_INPUTLANGCHANGEREQUEST and WM_INPUTLANGCHANGE messages to match the current font to the input language. If the current font is changed, the list of loaded keyboard drivers is scanned for a match and, if one is found, the font is allowed to change. Otherwise, an error message is displayed and the font does not change. If the input language changes, the scripts of the current font are scanned for a match and, if none is found, an error message is displayed and the input language does not change.

Download KEYBFONT.EXE, a self-extracting file, from the following services:

  • Microsoft's World Wide Web site on the Internet

          On the www.microsoft.com home page, click the Support icon
          Click Knowledge Base, and select the product
    
          Enter kbfile KEYBFONT.EXE (size: 37016 bytes) 
                                   , and click GO!
          Open the article, and click the button to download the file
    
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the Softlib/Mslfiles folder
          Get KEYBFONT.EXE (size: 37016 bytes) 
    
  • The Microsoft Network

          On the Edit menu, click Go To, and then click Other Location
          Type "mssupport" (without the quotation marks)
          Double-click the MS Software Library icon
          Find the appropriate product area
          Locate and download KEYBFONT.EXE
    
  • Microsoft Partner Network (MSPN)

          On MSPN Desktop, double-click the Software Library icon
          Search for KEYBFONT.EXE
          Display results and download
    
  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download KEYBFONT.EXE (size: 37016 bytes) 
    

For additional information about downloading, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

NOTE: Use the -d option when running KEYBFONT.EXE to decompress the file and recreate the proper directory structure.

MORE INFORMATION

The WM_INPUTLANGCHANGEREQUEST message is sent when the user chooses an input language, either with an input language change hotkey (see Control Panel.Keyboard.Language.Switch Languages) or from the language indicator on the system taskbar. This indicator will only be present if more than one keyboard layout has been installed and the indicator is enabled. An application can accept the change by passing the message to the DefWindowProc function, or reject the change, preventing it from taking place, by returning immediately.

In this sample, during WM_INPUTLANGCHANGEREQUEST, the character set of the requested language is compared to the default character set of each font script in the current font family via EnumFontFamilies(). If the font is not supported, the function returns immediately, disallowing any language change request.

The WM_INPUTLANGCHANGE message is sent to the top-most affected window after a task's locale has been changed. It should be used to make any application-specific settings, such as changing the current font script, and passed on to the DefWindowProc function to be passed on to any children.

In this sample, during WM_INPUTLANGCHANGE, the script of the current font is changed to match the character set of the language the user has switched to.

REFERENCES

For more information on font scripts and multilanguage keyboard support, please see the Chapter "Accommodating Multilingual I/O on Microsoft Windows" in "Developing International Software", by Nadine Kano (MS Press ISBN: 1-55615-840-8).


Additional reference words: 4.00 softlib internationalization hot key task
bar
KBCategory: kbprg kbprint kbui kbfile
KBSubcategory: KBIntlDev
Keywords : KBIntlDev kbfile kbprg kbprint kbui
Version : 4.00 | 4.00
Platform : NT WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 15, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.