diff options
Diffstat (limited to 'macosx/tkMacOSXFont.c')
-rw-r--r-- | macosx/tkMacOSXFont.c | 21 |
1 files changed, 13 insertions, 8 deletions
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; |