diff options
author | mdejong <mdejong> | 2004-06-08 20:44:10 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2004-06-08 20:44:10 (GMT) |
commit | 6e6938ae4bc0b377bf297dd32a1b2a7a72c4075d (patch) | |
tree | ac0964d2dbb2d71d04ca12f843435ef456ea17eb | |
parent | 32f4bf446ed2bbdf42db6652cc19414e14f5f513 (diff) | |
download | tk-6e6938ae4bc0b377bf297dd32a1b2a7a72c4075d.zip tk-6e6938ae4bc0b377bf297dd32a1b2a7a72c4075d.tar.gz tk-6e6938ae4bc0b377bf297dd32a1b2a7a72c4075d.tar.bz2 |
* generic/tkCanvText.c (DisplayCanvText): Fix text
rendering problem with canvas text items that
have a selected region. The previous implementation
would render the whole line and then redraw the
selected text if it was a different color. This caused
problems when the selected text foreground differs
from the normal text foreground, the anti-aliasing
alpha pixels for the two text strings would blend
together resulting in strange looking text. The
fix is to draw the normal text and the selected text
separately. This problem has only been observed
under Windows, with anti-aliased text. [Patch 968725]
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | generic/tkCanvText.c | 23 |
2 files changed, 34 insertions, 9 deletions
@@ -1,6 +1,22 @@ +2004-06-08 Mo DeJong <mdejong@users.sourceforge.net> + + * generic/tkCanvText.c (DisplayCanvText): Fix text + rendering problem with canvas text items that + have a selected region. The previous implementation + would render the whole line and then redraw the + selected text if it was a different color. This caused + problems when the selected text foreground differs + from the normal text foreground, the anti-aliasing + alpha pixels for the two text strings would blend + together resulting in strange looking text. The + fix is to draw the normal text and the selected text + separately. This problem has only been observed + under Windows, with anti-aliased text. [Patch 968725] + 2004-05-14 Chengye Mao <chengye.geo@yahoo.com> - * win/tkWinWm.c <UpdateWrapper> Modified to delete the old wrapper - correctly [Bug #767176] + + * win/tkWinWm.c <UpdateWrapper> Modified to delete the old wrapper + correctly [Bug #767176] 2004-05-14 Donal K. Fellows <donal.k.fellows@man.ac.uk> diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 7adb737..99d8e30 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvText.c,v 1.15 2003/02/09 07:48:22 hobbs Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.1 2004/06/08 20:44:11 mdejong Exp $ */ #include <stdio.h> @@ -853,21 +853,30 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height) /* - * Display the text in two pieces: draw the entire text item, then - * draw the selected text on top of it. The selected text then - * will only need to be drawn if it has different attributes (such - * as foreground color) than regular text. + * If there is no selected text or the selected text foreground + * is the same as the regular text foreground, then draw one + * text string. If there is selected text and the foregrounds + * differ, draw the regular text up to the selection, draw + * the selection, then draw the rest of the regular text. + * Drawing the regular text and then the selected text over + * it would causes problems with anti-aliased text because the + * two anti-aliasing colors would blend together. */ Tk_CanvasDrawableCoords(canvas, (double) textPtr->leftEdge, (double) textPtr->header.y1, &drawableX, &drawableY); - Tk_DrawTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, - drawableX, drawableY, 0, -1); if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) { + Tk_DrawTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, + drawableX, drawableY, 0, selFirstChar); Tk_DrawTextLayout(display, drawable, textPtr->selTextGC, textPtr->textLayout, drawableX, drawableY, selFirstChar, selLastChar + 1); + Tk_DrawTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, + drawableX, drawableY, selLastChar + 1, -1); + } else { + Tk_DrawTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, + drawableX, drawableY, 0, -1); } if (stipple != None) { |