From 19cb045850ffebc2785f44a362fdc7e199f293a5 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 30 Sep 2018 14:45:49 +0000 Subject: [PATCH 334/693] Fix [6437e8d00d]: font-24.5 test fails on macOS and Linux. This is the fix for Linux, with Xft enabled (the default). --- unix/tkUnixRFont.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 8e0ce5552..70aebfa72 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -711,9 +711,19 @@ Tk_MeasureChars( (flags & TK_AT_LEAST_ONE && curByte == 0)) { curX = newX; curByte = newByte; - } else if (flags & TK_WHOLE_WORDS && termX != 0) { - curX = termX; - curByte = termByte; + } else if (flags & TK_WHOLE_WORDS) { + if ((flags & TK_AT_LEAST_ONE) && (termX == 0)) { + /* + * No space was seen before reaching the right + * of the allotted maxLength space, i.e. no word + * boundary. Return the string that fills the + * allotted space, without overfill. + * curX and curByte are already the right ones: + */ + } else { + curX = termX; + curByte = termByte; + } } break; } -- 2.19.1