Overview
| Artifact ID: | 427b58ccbf79808aadcceca131edaccd4c30260c |
|---|---|
| Ticket: | 968725ffffffffffffffffffffffffffffffffff |
| Date: | 2004-06-08 15:46:56 |
| User: | mdejong |
| Artifact Attached: | 53a6fb0cbc3b312512b9cc1c7f4cf16bbb30d275 |
| Filename: | canvas_text_alias_bug.txt |
| Description: | Tcl source code that shows the problem |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65# Example script to show anti-aliasing bug in canvas # text object. This problem only seems to show up # when rendering selected text in the canvas. set fg red set bg black set sel yellow set font {Arial 33} set str {Hello$Ther@$pal} set hrange {6 10} if {0} { set str {Hello} set hrange {0 4} } if {0} { set str {Well Hello} set hrange {5 9} } destroy .t .c set t [text .t \ -width 30 -height 1 \ -font $font \ -bg $bg \ -fg $fg ] set c [canvas .c \ -width [winfo reqwidth $t] -height [winfo reqheight $t] \ -bg $bg \ -borderwidth 0 \ -highlightthickness 0 \ -selectforeground $sel \ -selectbackground $bg \ -selectborderwidth 0 ] grid $t -row 0 -column 0 -sticky news grid $c -row 1 -column 0 -sticky news $t delete 1.0 end $t insert end $str $c delete all $c create text 4 3 \ -text $str \ -font $font \ -fill $fg \ -anchor nw \ -tags {ttag} # Highlight text widget $t tag configure highlight -foreground $sel $t tag add highlight 1.[lindex $hrange 0] [list 1.[lindex $hrange 1] + 1 char] # Highlight canvas widget $c select clear $c select from ttag [lindex $hrange 0] $c select to ttag [lindex $hrange 1]
