summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
diff options
context:
space:
mode:
authorcc_benny <cc_benny>2003-12-10 12:00:22 (GMT)
committercc_benny <cc_benny>2003-12-10 12:00:22 (GMT)
commit3c7f4c1d603d6514b84e1005eba4afc571e7028e (patch)
tree7f41b26200cc5e6047151ec9e88e279b08e56bd5 /win/tkWinFont.c
parentad2a18922848bd511edfa470e1ac6caa78c9ae3c (diff)
downloadtk-3c7f4c1d603d6514b84e1005eba4afc571e7028e.zip
tk-3c7f4c1d603d6514b84e1005eba4afc571e7028e.tar.gz
tk-3c7f4c1d603d6514b84e1005eba4afc571e7028e.tar.bz2
* (Tk_MeasureChars): Initialize size.cx in case of errors.
Initialize lastsize (fixes bug with wrong *lenghtPtr results in case no chars fit at all).
Diffstat (limited to 'win/tkWinFont.c')
-rw-r--r--win/tkWinFont.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index a790baf..416b17f 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.19 2003/12/05 16:05:31 cc_benny Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.20 2003/12/10 12:00:22 cc_benny Exp $
*/
#include "tkWinInt.h"
@@ -643,6 +643,7 @@ Tk_MeasureChars(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, start,
(int) (p - start), &runString);
+ size.cx = 0;
(*familyPtr->getTextExtentPoint32Proc)(hdc,
Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
@@ -671,6 +672,7 @@ Tk_MeasureChars(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, start,
(int) (p - start), &runString);
+ size.cx = 0;
(*familyPtr->getTextExtentPoint32Proc)(hdc,
Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
@@ -694,7 +696,7 @@ Tk_MeasureChars(
char buf[16];
int dstWrote;
- int lastSize;
+ int lastSize = 0;
familyPtr = lastSubFontPtr->familyPtr;
Tcl_DStringInit(&runString);
@@ -704,6 +706,7 @@ Tk_MeasureChars(
(int) (next - p), 0, NULL, buf, sizeof(buf), NULL,
&dstWrote, NULL);
Tcl_DStringAppend(&runString,buf,dstWrote);
+ size.cx = 0;
(*familyPtr->getTextExtentPoint32Proc)(hdc,
Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,