summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-04-07 20:57:07 (GMT)
committerhobbs <hobbs>2000-04-07 20:57:07 (GMT)
commiteb7f9e1b5da5a265d7c9ae88e3c028089c1c6f3a (patch)
tree09e49de5e18de64d610e0224f678e09484b9d977 /win/tkWinFont.c
parent8d8a8c02be6abffb6388fa9034355b1c82e8ae08 (diff)
downloadtk-eb7f9e1b5da5a265d7c9ae88e3c028089c1c6f3a.zip
tk-eb7f9e1b5da5a265d7c9ae88e3c028089c1c6f3a.tar.gz
tk-eb7f9e1b5da5a265d7c9ae88e3c028089c1c6f3a.tar.bz2
* win/tkWinFont.c (GetScreenFont): corrected adjustment against
LC_FACESIZE limitation for NT. [Bug: 4931]
Diffstat (limited to 'win/tkWinFont.c')
-rw-r--r--win/tkWinFont.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 1c35fc7..84867ad 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinFont.c,v 1.9 2000/03/31 09:24:27 hobbs Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.10 2000/04/07 20:57:10 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -1947,15 +1947,15 @@ GetScreenFont(
Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &ds);
- /*
- * We can only store up to LF_FACESIZE characters
- */
- if (Tcl_DStringLength(&ds) >= LF_FACESIZE) {
- Tcl_DStringSetLength(&ds, LF_FACESIZE);
- }
-
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
Tcl_UniChar *src, *dst;
+
+ /*
+ * We can only store up to LF_FACESIZE wide characters
+ */
+ if (Tcl_DStringLength(&ds) >= (LF_FACESIZE * sizeof(WCHAR))) {
+ Tcl_DStringSetLength(&ds, LF_FACESIZE);
+ }
src = (Tcl_UniChar *) Tcl_DStringValue(&ds);
dst = (Tcl_UniChar *) lf.lfFaceName;
while (*src != '\0') {
@@ -1964,6 +1964,12 @@ GetScreenFont(
*dst = '\0';
hFont = CreateFontIndirectW(&lf);
} else {
+ /*
+ * We can only store up to LF_FACESIZE characters
+ */
+ if (Tcl_DStringLength(&ds) >= LF_FACESIZE) {
+ Tcl_DStringSetLength(&ds, LF_FACESIZE);
+ }
strcpy((char *) lf.lfFaceName, Tcl_DStringValue(&ds));
hFont = CreateFontIndirectA((LOGFONTA *) &lf);
}