summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-25 11:02:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-25 11:02:53 (GMT)
commit4f50f28c932648028f5e4056ea7fcd0fcf84b670 (patch)
tree062a7572cfa2496946ce2b784558466af2f5ad68 /win/tkWinFont.c
parent202e2b4510669128db1f8fc72b094456d5bef5d4 (diff)
downloadtk-4f50f28c932648028f5e4056ea7fcd0fcf84b670.zip
tk-4f50f28c932648028f5e4056ea7fcd0fcf84b670.tar.gz
tk-4f50f28c932648028f5e4056ea7fcd0fcf84b670.tar.bz2
Fix 2 left-over Tcl_WinUtfToTChar() calls. Some more code cleanup, made possible by TIP #548
Diffstat (limited to 'win/tkWinFont.c')
-rw-r--r--win/tkWinFont.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index b84652e..980fd4b 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -2481,8 +2481,8 @@ GetScreenFont(
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- Tcl_WinUtfToTChar(faceName, -1, &ds);
- wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1);
+ Tcl_DStringInit(&ds);
+ wcsncpy(lf.lfFaceName, Tcl_UtfToWCharDString(faceName, -1, &ds), LF_FACESIZE-1);
Tcl_DStringFree(&ds);
lf.lfFaceName[LF_FACESIZE-1] = 0;
hFont = CreateFontIndirectW(&lf);
@@ -2516,8 +2516,6 @@ FamilyExists(
int result;
Tcl_DString faceString;
- Tcl_WinUtfToTChar(faceName, -1, &faceString);
-
/*
* If the family exists, WinFontExistProc() will be called and
* EnumFontFamilies() will return whatever WinFontExistProc() returns. If
@@ -2525,7 +2523,8 @@ FamilyExists(
* non-zero value.
*/
- result = EnumFontFamiliesW(hdc, (WCHAR*) Tcl_DStringValue(&faceString),
+ Tcl_DStringInit(&faceString);
+ result = EnumFontFamiliesW(hdc, Tcl_UtfToWCharDString(faceName, -1, &faceString),
(FONTENUMPROCW) WinFontExistProc, 0);
Tcl_DStringFree(&faceString);
return (result == 0);