nanogui: PCF font support
Subject:
Re: [nanogui] PCF font support
From:
Evgeny Romanov ####@####.####
Date:
19 Aug 2008 09:15:08 -0000
Message-Id: <48AA8F86.5000107@neurosoft.ru>
Hi,
Function CreateFont declared like:
HFONT WINAPI
CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation,
int fnWeight, DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut,
DWORD fdwCharSet,DWORD fdwOutputPrecision,DWORD fdwClipPrecision,
DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCSTR lpszFace);
According to Win-API ECMA-234, the fdwCharSet parameter can be one of
the following values:
ANSI_CHARSET: 0
DEFAULT_CHARSET: 1
SYMBOL_CHARSET: 2
SHIFTJIS_CHARSET: 128
OEM_CHARSET: 255
This parameter is stored in "MWLOGFONT" structure in field "lfCharSet".
This structure passed to GdCreateFont function, but ignored there.
MWFONTOBJ contains "PMWFONT", pointer to sfructure "_mwfont".
Structure "_mwfont" contains pointer to structure "MWFONTPROCS".
Structure MWFONTPROCS contains field "MWTEXTFLAGS encoding". Probably,
in this field should be used for character set storing? Instead of
global variable "long mwTextCoding"?
Greg Haerr пишет:
>> 1. Variable "long mwTextCoding" appeared in file "wingdi.c". It's
>> default value MWTF_UTF8, so ASCII -coding PCF fonts does not work
>> correctly.
>> I can't found a way, how I change mwTextCoding value from my program.
>> For my porpose, I've change its' default value to MWTF_ASCII.
>>
>
> Unfortunately, win32 api doesn't have any mechanism to change
> the default encoding, including specification in a seperate
> parameter. We probably need an MwSetTextEncoding or
> something to specify the default text encoding for standard
> win32 api calls. You can use the internal MwTextOutExt
> which allows a parameter for text encoding, but its not standard.
>
P. S. MSDN say:
/fdwCharSet/
[in] Specifies the character set. The following values are predefined:
ANSI_CHARSET
BALTIC_CHARSET
CHINESEBIG5_CHARSET
DEFAULT_CHARSET
EASTEUROPE_CHARSET
GB2312_CHARSET
GREEK_CHARSET
HANGUL_CHARSET
MAC_CHARSET
OEM_CHARSET
RUSSIAN_CHARSET
SHIFTJIS_CHARSET
SYMBOL_CHARSET
TURKISH_CHARSET
*Windows NT/2000 or Middle-Eastern Windows 3.1 or later:*
HEBREW_CHARSET
ARABIC_CHARSET
*Windows NT/2000 or Thai Windows 3.1 or later:*
THAI_CHARSET
The OEM_CHARSET value specifies a character set that is
operating-system dependent.
*Windows 95/98/Me: *You can use the DEFAULT_CHARSET value to allow
the name and size of a font to fully describe the logical font. If
the specified font name does not exist, a font from any character
set can be substituted for the specified font, so you should use
DEFAULT_CHARSET sparingly to avoid unexpected results.
*Windows NT/2000 or later: *DEFAULT_CHARSET is set to a value based
on the current system locale. For example, when the system locale is
English (United States), it is set as ANSI_CHARSET.
Fonts with other character sets may exist in the operating system.
If an application uses a font with an unknown character set, it
should not attempt to translate or interpret strings that are
rendered with that font.
To ensure consistent results when creating a font, do not specify
OEM_CHARSET or DEFAULT_CHARSET. If you specify a typeface name in
the /lpszFace /parameter, make sure that the /fdwCharSet/ value
matches the character set of the typeface specified in /lpszFace./
--
Sincerely yours,
Evgeny