Overview
| Artifact ID: | 5520d14407248c1bd7addc03fe06d50f521b4426bbb41950ffccc5270213a261 |
|---|---|
| Ticket: | adb6352846319ff0ba4761bb46391c5ea284fd7c |
| Date: | 2022-06-12 20:04:40 |
| User: | fvogel |
| Artifact Attached: | 7316b627f2ab825af58c3f27f881658b640cdf921aa2afff5f23148453147c39 |
| Filename: | Patch1.txt |
| Description: |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43Index: macosx/tkMacOSXFont.c ================================================================== --- macosx/tkMacOSXFont.c +++ macosx/tkMacOSXFont.c @@ -908,10 +908,11 @@ CTLineRef line; CGFloat offset = 0; CFIndex index; double width; int length, fit; + int trimmed = 0; if (rangeStart < 0 || rangeLength <= 0 || rangeStart + rangeLength > numBytes || (maxLength == 0 && !(flags & TK_AT_LEAST_ONE))) { *lengthPtr = 0; @@ -970,10 +971,11 @@ cs = (index <= len && (flags & TK_WHOLE_WORDS)) ? whitespaceCharacterSet : lineendingCharacterSet; while (index > start && [cs characterIsMember:[string characterAtIndex:(index - 1)]]) { index--; + trimmed++; } /* * If there is no line breakpoint in the source string between its * start and the index position that fits in maxWidth, then @@ -1030,11 +1032,11 @@ } CFRelease(typesetter); [attributedString release]; [string release]; length = ceil(width - offset); - fit = (TkUtfAtIndex(source, index) - source) - rangeStart; + fit = (TkUtfAtIndex(source, index) - source) + trimmed - rangeStart; done: #ifdef TK_MAC_DEBUG_FONTS TkMacOSXDbgMsg("measure: source=\"%s\" range=\"%.*s\" maxLength=%d " "flags='%s%s%s%s' -> width=%d bytesFit=%d\n", source, rangeLength, source+rangeStart, maxLength,
