summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstanton <stanton>1999-02-04 21:00:48 (GMT)
committerstanton <stanton>1999-02-04 21:00:48 (GMT)
commit9b971a980e0054f319cdd698ecfbbafcef9f185c (patch)
tree4356ef30e262d0e1fc2974223737f4cc6c0ffb36
parentbc0fcbc79eb5d50d8c902eeaaf15b0c2fb0f7541 (diff)
downloadtk-9b971a980e0054f319cdd698ecfbbafcef9f185c.zip
tk-9b971a980e0054f319cdd698ecfbbafcef9f185c.tar.gz
tk-9b971a980e0054f319cdd698ecfbbafcef9f185c.tar.bz2
* win/tkWinFont.c (Tk_MeasureChars): Added a workaround for a bug
in GetTextExtentExPoint on Win NT 4.0/Japanese. [Bug: 1006]
-rw-r--r--win/tkWinFont.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 01733b4..b850857 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -10,7 +10,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.3 1998/09/14 18:24:00 stanton Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.4 1999/02/04 21:00:48 stanton Exp $
*/
#include "tkWinInt.h"
@@ -391,14 +391,24 @@ Tk_MeasureChars(tkfont, source, numChars, maxLength, flags, lengthPtr)
if (((flags & TK_PARTIAL_OK) && max < numChars && curX < maxLength)
|| ((flags & TK_AT_LEAST_ONE) && max == 0 && numChars > 0)) {
+
+ /*
+ * MS BUG ALERT - We have to pass the bogus length, and
+ * the dummyMax parameter, because without them the call crashes on
+ * NT/J Service Pack 3 and less. This is documented in the
+ * Microsoft Knowledge Base.
+ */
+
+ int dummyMax;
+
/*
* We want to include the first character that didn't
* quite fit. Call the function again to include the
* width of the extra character.
*/
- GetTextExtentExPoint(hdc, source, max + 1, 0, NULL, partials,
- &size);
+ GetTextExtentExPoint(hdc, source, max + 1, INT_MAX, &dummyMax,
+ partials, &size);
curX = partials[max];
++max;