summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-10-04 20:23:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-10-04 20:23:35 (GMT)
commit7e485239eb3db9233291c64777d8e74b9dad1ff6 (patch)
treea62bf476b8f02927be3a2e252b6aaa89d3a69f77 /win/tkWinFont.c
parent6746e8c834b3f360b5bdb770baad9aca64e02920 (diff)
downloadtk-7e485239eb3db9233291c64777d8e74b9dad1ff6.zip
tk-7e485239eb3db9233291c64777d8e74b9dad1ff6.tar.gz
tk-7e485239eb3db9233291c64777d8e74b9dad1ff6.tar.bz2
Sometimes one MultiByteToWideChar() call does the same as 5 Tcl API calls.
Diffstat (limited to 'win/tkWinFont.c')
-rw-r--r--win/tkWinFont.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index e48f93c..11385ed 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -2462,7 +2462,6 @@ GetScreenFont(
double angle) /* What is the desired orientation of the
* font. */
{
- Tcl_DString ds;
HFONT hFont;
LOGFONTW lf;
@@ -2481,10 +2480,7 @@ GetScreenFont(
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(faceName, -1, &ds);
- wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1);
- Tcl_DStringFree(&ds);
+ MultiByteToWideChar(CP_UTF8, 0, faceName, -1, lf.lfFaceName, LF_FACESIZE);
lf.lfFaceName[LF_FACESIZE-1] = 0;
hFont = CreateFontIndirectW(&lf);
return hFont;