DWORD dwCodePage ;
HKL hkl = (HKL) lParam ;
LOGFONT lf ;
HDC hDc ;
CHARSETINFO cs ;
TCHAR szLocaleData [BUFFER_SIZE] ;
lstrcpy (lf.lfFaceName, TEXT("")) ;
lf.lfCharSet = DEFAULT_CHARSET ;
// This is a hack for Hindi and Tamil, since they
// don't have charsets. Mangal and Latha are the
// fonts for Hindi and Tamil shipping with Windows NT 5.0.
// A better hack would be to put these strings in
// data files that can be updated with new
// typeface names. You would then call
// EnumFontFamiliesEx once per face name.
if (LOWORD(hkl) ==
MAKELANGID(LANG_HINDI, SUBLANG_DEFAULT))
{
lstrcpy (lf.lfFaceName, TEXT("Mangal")) ;
}
else
if (LOWORD(hkl) ==
MAKELANGID(LANG_TAMIL, SUBLANG_DEFAULT))
{
lstrcpy (lf.lfFaceName, TEXT("Latha")) ;
}
else
{
// Find out what Charset the new kbd wants
GetLocaleInfo (LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE, szLocaleData, 6) ;
dwCodePage = _ttol (szLocaleData) ;
if (TranslateCharsetInfo (
(LPVOID) dwCodePage, &cs,
TCI_SRCCODEPAGE))
{
lf.lfCharSet = (BYTE) cs.ciCharset ;
}
}
// Get list of fonts that support this charset
// hDc is needed by EnumFontFamilies
hDc = GetDC (hWnd) ;
// Callback uses hDlg
EnumFontFamiliesEx (hDc, &lf, (FONTENUMPROC) EnumFontProc, (LPARAM) hDlg,
(DWORD) 0) ;
ReleaseDC (hWnd, hDc) ;
Figure 2 Toggling Alignment and Reading Order
/* If static variables bother you, use your favorite technique to save the state of lAlign without using a static variable. */ static LONG lAlign = TA_LEFT ; // Do the following when the user // toggles alignment. This assumes // that the TA_CENTER alignment is // not supported lAlign ^= TA_RIGHT ; // Do this when the user toggles reading // order lAlign ^= TA_RTLREADING ; // // Before calling ExtTextOut, (e.g., when // processing WM_PAINT messages), do the // following: SetTextAlign (hDc, lAlign) ;
Figure 5 Scripts Supported by Platform
| Platform | Western scripts |
Arabic, Hebrew, Thai, Vietnamese |
Hindi, Tamil | Chinese, Japanese, Korean |
| Windows NT 4.0 |
|
|
|
|
| Windows NT 5.0 |
|
|
|
|
| Windows 98 |
|
|
. |
|
| Windows 95 (FE) |
|
. | . |
|
| Windows 95 (rest) |
|
|
. |
|
Figure 7 Interfaces by Platform
| Platform | Win32 API | Interfaces Edit Control | RichEdit | Uniscribe |
| English Windows 95/98 | . | . | . | M |
| Enabled/localized Windows 95/98 | En | En | En | M |
| U.S. Windows NT 4.0 | . | . | . | M |
| Enabled/localized Windows NT 4.0 | En | En | En | M |
| U.S. Windows NT 5.0 | M | M | M | M |
| Localized Windows NT 5.0 | M | M | M | M |
|
En: Supports complex scripts consistent with the platform enabling. For example, Hebrew-enabled Windows 95 will support Hebrew through all interfaces, but not Arabic or Thai. M: Supports all multilingual text. |
||||