summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkTextDisp.c10
-rw-r--r--macosx/tkMacOSXFont.c6
-rw-r--r--unix/tkUnixFont.c5
-rw-r--r--win/tkWinFont.c6
4 files changed, 17 insertions, 10 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index f07650f..4b7b0db 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -7933,6 +7933,7 @@ CharDisplayProc(
#if TK_DRAW_IN_CONTEXT
int start = ciPtr->baseOffset + offsetBytes;
int len = ciPtr->numBytes - offsetBytes;
+ int xDisplacement = x - chunkPtr->x;
if ((len > 0) && (string[start + len - 1] == '\t')) {
len--;
@@ -7942,12 +7943,14 @@ CharDisplayProc(
}
TkpDrawCharsInContext(display, dst, stylePtr->fgGC, sValuePtr->tkfont,
- string, numBytes, start, len, offsetX,
+ string, numBytes, start, len,
+ ciPtr->baseChunkPtr->x + xDisplacement,
y + baseline - sValuePtr->offset);
if (sValuePtr->underline) {
TkUnderlineCharsInContext(display, dst, stylePtr->ulGC,
- sValuePtr->tkfont, string, numBytes, offsetX,
+ sValuePtr->tkfont, string, numBytes,
+ ciPtr->baseChunkPtr->x + xDisplacement,
y + baseline - sValuePtr->offset,
start, start+len);
}
@@ -7956,7 +7959,8 @@ CharDisplayProc(
Tk_GetFontMetrics(sValuePtr->tkfont, &fm);
TkUnderlineCharsInContext(display, dst, stylePtr->ovGC,
- sValuePtr->tkfont, string, numBytes, offsetX,
+ sValuePtr->tkfont, string, numBytes,
+ ciPtr->baseChunkPtr->x + xDisplacement,
y + baseline - sValuePtr->offset
- fm.descent - (fm.ascent * 3) / 10,
start, start+len);
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 78e245a..d3e0e41 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -1032,12 +1032,8 @@ TkpDrawCharsInContext(
* whole (not just the range) string when
* drawing. */
{
- int widthUntilStart;
-
- TkpMeasureCharsInContext(tkfont, source, numBytes, 0, rangeStart,
- -1, 0, &widthUntilStart);
DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
- rangeStart, rangeLength, x-widthUntilStart, y, 0.0);
+ rangeStart, rangeLength, x, y, 0.0);
}
static void
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 4a466f1..0c663a3 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -1414,10 +1414,13 @@ TkpDrawCharsInContext(
* whole (not just the range) string when
* drawing. */
{
+ int widthUntilStart;
+
(void) numBytes; /*unused*/
+ Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
- rangeLength, x, y);
+ rangeLength, x+widthUntilStart, y);
}
/*
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 47c4c3c..860451b 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -1407,9 +1407,13 @@ TkpDrawCharsInContext(
* whole (not just the range) string when
* drawing. */
{
+ int widthUntilStart;
+
(void) numBytes; /*unused*/
+
+ Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
- rangeLength, x, y);
+ rangeLength, x+widthUntilStart, y);
}
/*