From a43ba87d14872bde5b450d17e502ad0d82f38baa Mon Sep 17 00:00:00 2001 From: "peter.spjuth@gmail.com" Date: Wed, 25 Jan 2017 22:05:51 +0000 Subject: Fix [140ea8ab38]: Long text lines are not drawn on Windows. --- win/tkWinFont.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/win/tkWinFont.c b/win/tkWinFont.c index f209716..1292772 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -1307,7 +1307,15 @@ MultiFontTextOut( for (p = source; p < end; ) { next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); - if (thisSubFontPtr != lastSubFontPtr) { + + /* + * The drawing API has a limit of 32767 pixels in one go. + * To avoid spending time on a rare case we do not measure each char, + * instead we limit to drawing chunks of 200 bytes since that works + * well in practice. + */ + + if ((thisSubFontPtr != lastSubFontPtr) || (p-source > 200)) { if (p > source) { familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, -- cgit v0.12