FontDlg sample text
Dmitry Timoshkov
dmitry at baikal.ru
Sun Nov 30 21:27:31 CST 2003
"Shachar Shemesh" <wine-devel at shemesh.biz> wrote:
> > Please explain:
> > 1. What kind of a resource should I use, in your opinion?
String resources.
> > 2. How should I select which resource to load, given a specific locale?
Font charsets doesn't depend on the current user locale. So, just create
LANG_NEUTRAL resource with strings for each charset you want and IDs something
like:
#define CHARSET_BASE 1000
STRINGTABLE
{
ANSI_CHARSET+CHARSET_BASE "AaBbYyZz"
DEFAULT_CHARSET+CHARSET_BASE "AaBbYyZz"
SYMBOL_CHARSET+CHARSET_BASE "Symbol"
...
}
and load them when you need to display sample text:
char sample[256];
hfont = CreateFontIndirectA(...)
SelectObject(hdc, hfont);
charset = GetTextCharset(hdc);
LoadStringW(hinst_comdlg32, CHARSET_BASE + charset, sample, 256);
DrawTextW(hdc, sample);
> Make that: "How should I select which resource to load, given a specific
> charset?"
>
> > 3. What is the advantage of this mechanism?
I mentioned at least one already: make it easily available for translators.
You could always have a look at the traces produced by native comdlg32,
since it uses an approach described above, and learn how it's done there.
--
Dmitry.
More information about the wine-devel
mailing list