* Aldo Buratti <
aldo.w....@gmail.com>
| I'm not an expert of these font-management APIs for those platforms; I
| just did a copy&paste . Maybe a code review could be useful... and
| more testing, of course.
On Windows, you do
unicode = Tcl_GetEncoding(_interp, "unicode");
Tcl_UtfToExternalDString(unicode, path, len, &ds);
res = AddFontResourceExW((LPCWSTR)Tcl_DStringValue(&ds), FR_PRIVATE, NULL);
i.e. basically passing an 'unicode' encoded string to
AddFontResourceExW() which expects a 'wide' string. I'm not sure
whether this is 100% correct in all cases of all unicode strings out
there.
We usually do
- convert Tcl-to-utf8
- MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf-8-char*, utf-8-len, 0, 0);
to obtain the required length, allocate the wbuffer and perform the conversion:
- MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf-8-char*, utf-8-len, wbuffer, reqlen);
I had the impression that 'unicode' and Microsoft's wide strings are two
different beasts which very much look alike, but not 100% (I might be
wrong here).
My EUR 0.02.
R'