summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXFont.c
diff options
context:
space:
mode:
authorcc_benny <cc_benny>2007-11-16 17:47:30 (GMT)
committercc_benny <cc_benny>2007-11-16 17:47:30 (GMT)
commit9413f191a02dc5ec85402de107e1916c9ce22c9a (patch)
tree7330722a9f552dea80f477bbe410ed4fd626e08a /macosx/tkMacOSXFont.c
parent7b4e635d20039d668c981dd657782d2fd37bc494 (diff)
downloadtk-9413f191a02dc5ec85402de107e1916c9ce22c9a.zip
tk-9413f191a02dc5ec85402de107e1916c9ce22c9a.tar.gz
tk-9413f191a02dc5ec85402de107e1916c9ce22c9a.tar.bz2
* macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Correct an
oversight in the bug fix from 2007-11-11. [Bug 1824638]
Diffstat (limited to 'macosx/tkMacOSXFont.c')
-rw-r--r--macosx/tkMacOSXFont.c21
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;