diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-04 20:23:35 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-04 20:23:35 (GMT) |
commit | 7e485239eb3db9233291c64777d8e74b9dad1ff6 (patch) | |
tree | a62bf476b8f02927be3a2e252b6aaa89d3a69f77 /win | |
parent | 6746e8c834b3f360b5bdb770baad9aca64e02920 (diff) | |
download | tk-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')
-rw-r--r-- | win/tkWinFont.c | 6 |
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; |