[try 2] [2/2] mlang: Add implementation offnIMLangFontLink_GetCharCodePages

Dmitry Timoshkov dmitry at codeweavers.com
Sat Nov 1 08:42:50 CDT 2008


"Vitaly Perov" <vitperov at etersoft.ru> wrote:

> This function must set only supported codepages bits
> The supported codepages are: 
> ttp://www.microsoft.com/globaldev/reference/WinCP.mspx

Again, it absolutely doesn't really matter what code pages Windows supports,
or MSDN declares as supported, the only thing that matters is what code pages
are valid for mlang APIs.

> For example, we use a symbol from Latin1 codepage.
> All codepages are include this symbol.
> So if we use EnumSystemCodePage() it enumerates codepages from the cptables 
> array. This array include all codepages. So when we use a symbol from Latin1, 
> all bits are set (I've tested it long time ago, so maybe I'm mistaken, maybe 
> 1 bit or 2 are not set).
> But only the following bits must be set:
> FS_LATIN1 | FS_LATIN2 | FS_CYRILLIC | FS_GREEK | FS_TURKISH | FS_HEBREW | 
> FS_ARABIC | FS_BALTIC | FS_VIETNAMESE | FS_THAI | FS_JISJAPAN | 
> FS_CHINESESIMP | FS_WANSUNG | FS_CHINESETRAD
> 
> So, it's impossible to use EnumSystemCodePage()

It *is* possible to use EnumSystemCodePages.

> If we use codepages from mlang_data[], everything works perfect.

Although yes, using code pages from mlang_data is preferrable. So, you
can remove EnumSystemCodePages from the list of APIs to use.

> The functions GetCPInfo/MultiByteToWideChar aren't also provide the list of 
> needed codepages.

They do provide other information your implementation uses, like character
size and lead bytes (although you don't need that information, therefore
that APIs are not needed either).

> There is one extra problem:
> I can't find the size of the dbcs_table->cp2uni array, so It needs to 
> calculate it. This calculation works perfect, but maybe there is more easy 
> way to obtain it?

Forget about Wine internal code page structures. Try for instance implement
GetCharCodePages using only public Win32 APIs as an exercise.

To find whether a mapping for a unicode character exists in some code page
you could use WideCharToMultiByte(WC_NO_BEST_FIT_CHARS) for instance.

-- 
Dmitry.



More information about the wine-devel mailing list