From 9413f191a02dc5ec85402de107e1916c9ce22c9a Mon Sep 17 00:00:00 2001 From: cc_benny Date: Fri, 16 Nov 2007 17:47:30 +0000 Subject: * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Correct an oversight in the bug fix from 2007-11-11. [Bug 1824638] --- ChangeLog | 5 +++++ macosx/tkMacOSXFont.c | 21 +++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed17970..afa556f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-11-16 Benjamin Riefenstahl + + * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Correct an + oversight in the bug fix from 2007-11-11. [Bug 1824638] + 2007-11-15 Daniel Steffen * macosx/Wish.xcodeproj/project.pbxproj: add new chanio.test. diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index f6075d1..5e2cfdd 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -35,7 +35,7 @@ * that such fonts can not be used for controls, because controls * definitely require a family id (this assertion needs testing). * - * RCS: @(#) $Id: tkMacOSXFont.c,v 1.34 2007/11/13 06:47:21 das Exp $ + * RCS: @(#) $Id: tkMacOSXFont.c,v 1.35 2007/11/16 17:47:30 cc_benny Exp $ */ #include "tkMacOSXPrivate.h" @@ -939,12 +939,14 @@ TkpMeasureCharsInContext( if (flags & TK_WHOLE_WORDS) { if ((flags & TK_AT_LEAST_ONE) - && ((offset == urstart) || (uchars[offset] != ' '))) { + && ((offset == urstart) + || ((offset != urend) + && (uchars[offset] != ' ')))) { /* * With TK_AT_LEAST_ONE, if we are the the start of the * range, we need to add at least one character. If we are * not at the end of a word, we must be in the middle of the - * first word still and we want to run with what we have so + * first word still and we want to just use what we have so * far. In both cases we still need to find the right * character boundary, so we set a flag that gets us into the * code for character mode below. @@ -971,13 +973,16 @@ TkpMeasureCharsInContext( /* * If "flags" says that we don't actually want a word break, we need - * to find the next character break ourself, as ATSUBreakLine() will - * only give us word breaks. Do a simple linear search. + * to find the next character break ourself, as ATSUBreakLine will + * only give us word breaks. Do a simple linear search. + * + * Even do this, if ATSUBreakLine returned kATSULineBreakInWord, + * because we have not accounted correctly for all of the flags yet, + * like TK_AT_LEAST_ONE. */ - if ((err != kATSULineBreakInWord) - && (!(flags & TK_WHOLE_WORDS) || forceCharacterMode) - && (offset <= urend)) { + if ((!(flags & TK_WHOLE_WORDS) || forceCharacterMode) + && (offset <= urend)) { UniCharArrayOffset lastOffset = offset; UniCharArrayOffset nextoffset; int lastX = -1; -- cgit v0.12