diff options
author | stanton <stanton@noemail.net> | 1999-02-04 21:00:47 (GMT) |
---|---|---|
committer | stanton <stanton@noemail.net> | 1999-02-04 21:00:47 (GMT) |
commit | b2b45ce1be45ec4c869e5183261fa631c1c3eddf (patch) | |
tree | 4356ef30e262d0e1fc2974223737f4cc6c0ffb36 /win/tkWinFont.c | |
parent | f364d14f889080f6d7f19e573cc635170afbef2c (diff) | |
download | tk-b2b45ce1be45ec4c869e5183261fa631c1c3eddf.zip tk-b2b45ce1be45ec4c869e5183261fa631c1c3eddf.tar.gz tk-b2b45ce1be45ec4c869e5183261fa631c1c3eddf.tar.bz2 |
* win/tkWinFont.c (Tk_MeasureChars): Added a workaround for a bug
in GetTextExtentExPoint on Win NT 4.0/Japanese. [Bug: 1006]
FossilOrigin-Name: 9946f072a52a9c97ed34d2cfede954ea19469c84
Diffstat (limited to 'win/tkWinFont.c')
-rw-r--r-- | win/tkWinFont.c | 16 |
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; |