From 1ca97b8a98e83cc573495d14aa846df1fd58c583 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 15 Apr 2020 06:25:05 +0000 Subject: Fix [3519111fff]: Problem with scroll in ttk --- generic/ttk/ttkScroll.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index 47db6ac..f008bb4 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -104,15 +104,18 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h) Tcl_Release(corePtr); if (code != TCL_OK && !Tcl_InterpDeleted(interp)) { - /* Disable the -scrollcommand, add to stack trace: + /* Add error to stack trace and report. + * Also set the SCROLL_UPDATE_REQUIRED flag so that a later call to + * TtkScrolled has an effect. Indeed, the error in the -scrollcommand + * callback may later be gone, for instance the callback proc got + * defined in the meantime). */ - ckfree(s->scrollCmd); - s->scrollCmd = 0; - Tcl_AddErrorInfo(interp, /* @@@ "horizontal" / "vertical" */ + Tcl_AddErrorInfo(interp, /* @@@ "horizontal" / "vertical" */ "\n (scrolling command executed by "); Tcl_AddErrorInfo(interp, Tk_PathName(h->corePtr->tkwin)); Tcl_AddErrorInfo(interp, ")"); + TtkScrollbarUpdateRequired(h); } return code; } -- cgit v0.12 From 97918a751ee1d93942f849bbb0dbe8c1039f7320 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 15 Apr 2020 18:40:36 +0000 Subject: Fix [6e25fc7cc1]: widget demo: dark-mode friendly 'NEW' image. Patch from Christopher Chavez. --- library/demos/widget | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/library/demos/widget b/library/demos/widget index 6d0b045..fca6cfd 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -83,12 +83,20 @@ image create photo ::img::print -format GIF -data { # Note that this is run through the message catalog! This is because this is # actually an image of a word. -image create photo ::img::new -format GIF -data [mc { - R0lGODlhHgAOALMPALMAANyIiOu7u8dEROaqqvru7sxVVeGZmbgREfXd3b0iItZ3 - d8IzM9FmZvDMzP///yH5BAEAAA8ALAAAAAAeAA4AAASa8MlJq7046827WVOCHEkw - nANhUgJlEBIABJIwL3K+4IcUALCHjfbItYZDSgJgkBiYPmBMAUAkkLPKs/BAyLgM - wAQwOAAY2ByCaw4QAFQSoDEePJ6DmU1xInYZTw5nOEFFdgVUelkVDTIMd3AKFGQ1 - MgI2AwEmQW8APZ0gdRONAks5nhIFVVxdAAkUAS2pAVwFl7ITB4UqHb0XEQA7 +image create photo ::img::new -format PNG -data [mc { + iVBORw0KGgoAAAANSUhEUgAAAB4AAAAOCAYAAAA45qw5AAACMElEQVR4AeVTAwxd + QRCc2tZHGtQ2w9q2bdsOa9u2bUW1bdt2Z372JZe6DapJLqtb3h7+T8yKi5j4CsYD + EUQXxETclT7kWOlH2VV+tFkdQHPSwksSISF+BauCqL0qgOcMWgGfgEkaMsHxqUBk + 3plE/sOnh/qDPAPJH/CKFBivGHWzFwBRnHhlqbu1Mh6CoFNnC/JshQ9p4YC2lrKt + DCAV+THiVejyhMjAbrNSrroiEfKR9g7ZfCgOog8QfnUQV62wAk68ndQ9ZbyoWO1H + Y6eDY1LCQL6a9ApOp9Hi1T0+gQq2JKMlky/oTKQliKWxEZvyG575kpW4pl1aZnQK + CLOVt45Lkp8uXp2SL8KO6uitNTZLdpK6s+I/eZbhpmsmWeOGOVQNKYLITzpKPAO3 + tY7LSNZ7ccSLxX9y3uuOxRkg3dKESMoCHvL+GRVCutXsB3guLgDCeXOv4iWWkvwG + BaS+PmlpK6SI9ApI2oC2UtrwZQEkhkH+NtolVlQXJl1I+QltuU3XEc721bIRFpa8 + IA5iqTo6vNNWmkNBLQbPeXwF2g17Q94nTQAfY3YzeY+WSu8MDzQ2kpELUhSGJUHE + 0zeR3rY1L+Xl5G/re+jbiK6KhThwwInsts1fbMUUcpZszKeVtggZEiGdZDe5AtHh + 7vL4CGiRvvKPS8FAvq9Nr4ZkFadR2y6kggu1z4vlyIbBp6BugQ8JLEg4bTkD9eMZ + QZ8hpJ3VvTtuvbWrY/ElvP/9R+Aj3603+iE3fkEAAAAASUVORK5CYII= }] #---------------------------------------------------------------- -- cgit v0.12 From 26f63772e7f0ec8eb1245e39ff44391cc16152a6 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 15 Apr 2020 20:56:42 +0000 Subject: Refine comment and revert useless tab->spaces change --- generic/ttk/ttkScroll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index f008bb4..9cf8eae 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -104,14 +104,14 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h) Tcl_Release(corePtr); if (code != TCL_OK && !Tcl_InterpDeleted(interp)) { - /* Add error to stack trace and report. + /* Add error to stack trace. * Also set the SCROLL_UPDATE_REQUIRED flag so that a later call to * TtkScrolled has an effect. Indeed, the error in the -scrollcommand * callback may later be gone, for instance the callback proc got - * defined in the meantime). + * defined in the meantime. */ - Tcl_AddErrorInfo(interp, /* @@@ "horizontal" / "vertical" */ + Tcl_AddErrorInfo(interp, /* @@@ "horizontal" / "vertical" */ "\n (scrolling command executed by "); Tcl_AddErrorInfo(interp, Tk_PathName(h->corePtr->tkwin)); Tcl_AddErrorInfo(interp, ")"); -- cgit v0.12 From 9632444b883bc5e9fb7273102329e1a61c38cebb Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 16 Apr 2020 21:14:19 +0000 Subject: Add non-regression test entry-2.1.1. This test fails before the fix, and passes after the fix. --- tests/ttk/entry.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 8b5f490..2e5f43c 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -74,6 +74,18 @@ test entry-2.1 "Create entry before scrollbar" -body { -expand false -fill x } -cleanup {destroy .te .tsb} +test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body { + pack [ttk::entry .te -xscrollcommand [list .tsb set]] \ + -expand true -fill both + .te insert end [string repeat "abc" 50] + catch {update} ; # error triggers because the -xscrollcommand callback + # errors out: invalid command name ".tsb" + pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \ + -expand false -fill x + update ; # no error + lappend res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update +} -result {1} -cleanup {destroy .te .tsb} + test entry-2.2 "Initial scroll position" -body { ttk::entry .e -font fixed -width 5 -xscrollcommand scroll .e insert end "0123456789" -- cgit v0.12 From 084ab3a3855d26eaef4e15d63fed53ddb256decf Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Apr 2020 09:44:32 +0000 Subject: Fix [14188104c3]: ttk::treeview scrollbar not updating. Add test treeview-9.2 revealing this bug, failing before the fix and passing with it. Thanks to cjmcdonald. --- generic/ttk/ttkTreeview.c | 5 ++++- tests/ttk/treeview.test | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index ccc5e2e..715e671 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -2842,7 +2842,10 @@ static int TreeviewSeeCommand( TtkRedisplayWidget(&tv->core); } } - tv->tree.yscroll.total = CountRows(tv->tree.root) - 1; + TtkScrolled(tv->tree.yscrollHandle, + tv->tree.yscroll.first, + tv->tree.yscroll.last, + CountRows(tv->tree.root) - 1); /* Make sure item is visible: */ diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test index c9dcf52..144f6d9 100644 --- a/tests/ttk/treeview.test +++ b/tests/ttk/treeview.test @@ -508,6 +508,32 @@ test treeview-9.1 "scrolling" -setup { destroy .tree } -result {I006} +test treeview-9.2 {scrolling on see command - bug [14188104c3]} -setup { + toplevel .top + ttk::treeview .top.tree -show {} -height 10 -columns {label} \ + -yscrollcommand [list .top.vs set] + ttk::scrollbar .top.vs -command {.top.tree yview} + grid .top.tree -row 0 -column 0 -sticky ns + grid .top.vs -row 0 -column 1 -sticky ns + update + proc setrows {n} { + .top.tree delete [.top.tree children {}] + for {set i 1} {$i <= $n} {incr i} { + .top.tree insert {} end -id row$i \ + -values [list [format "Row %2.2d" $i]] + } + .top.tree see row1 + update idletasks + } +} -body { + setrows 10 + set res [.top.vs get] + setrows 20 + lappend res [expr [lindex [.top.vs get] 1] < 1] +} -cleanup { + destroy .top +} -result {0.0 1.0 1} + ### identify tests: # proc identify* {tv comps args} { -- cgit v0.12 From d9d6f5687e69570b40f6c3aa2036976277aa4b5a Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Apr 2020 10:52:00 +0000 Subject: Add .gitignore file --- .gitignore | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d96b03e --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +*.a +*.dll +*.dylib +*.exe +*.exp +*.lib +*.o +*.obj +*.pdb +*.res +*.sl +*.so +*/Makefile +*/config.cache +*/config.log +*/config.status +*/tkConfig.sh +*/wish* +*/tktest* +*/versions.vc +unix/tk.pc +unix/tclIndex +win/Debug* +win/Release* +win/*.manifest +win/nmhlp-out.txt +win/nmakehlp.out + -- cgit v0.12 From 37be1cea7bd233677e375d54d95a72e5d9f70247 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Apr 2020 17:10:09 +0000 Subject: Add new test case treeview-9.3 exercising scrollbar change on 'see' command for an item whose ancestors are closed --- tests/ttk/treeview.test | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test index 144f6d9..0ad0443 100644 --- a/tests/ttk/treeview.test +++ b/tests/ttk/treeview.test @@ -534,6 +534,34 @@ test treeview-9.2 {scrolling on see command - bug [14188104c3]} -setup { destroy .top } -result {0.0 1.0 1} +test treeview-9.3 {scrolling on see command, requested item is closed} -setup { + toplevel .top + ttk::treeview .top.tree -show tree -height 10 -columns {label} \ + -yscrollcommand [list .top.vs set] + ttk::scrollbar .top.vs -command {.top.tree yview} + grid .top.tree -row 0 -column 0 -sticky ns + grid .top.vs -row 0 -column 1 -sticky ns + + .top.tree insert {} end -id a -text a + .top.tree insert a end -id b -text b + .top.tree insert b end -id c -text c + .top.tree insert c end -id d -text d + .top.tree insert d end -id e -text e + for {set i 6} {$i <= 15} {incr i} { + .top.tree insert {} end -id row$i \ + -values [list [format "Row %2.2d" $i]] + } + update +} -body { + set before [lindex [.top.vs get] 1] + .top.tree see e + update idletasks + set after [lindex [.top.vs get] 1] + expr $after < $before +} -cleanup { + destroy .top +} -result {1} + ### identify tests: # proc identify* {tv comps args} { -- cgit v0.12 From a2825054eb9322ba9a6de105dd74f1d86073582d Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 19 Apr 2020 09:02:45 +0000 Subject: Remove superfluous call to TtkScrolled. Analysis (see the ticket) shows it is not needed, moreover all tests still pass, and we can't find a script that fails without this call. --- generic/ttk/ttkTreeview.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 715e671..358e409 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -2842,10 +2842,6 @@ static int TreeviewSeeCommand( TtkRedisplayWidget(&tv->core); } } - TtkScrolled(tv->tree.yscrollHandle, - tv->tree.yscroll.first, - tv->tree.yscroll.last, - CountRows(tv->tree.root) - 1); /* Make sure item is visible: */ -- cgit v0.12 From 4665e91c605a6ae30ea0f579f1e4481f9494fe40 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 22 Apr 2020 21:39:03 +0000 Subject: Fix [cd8714756c]: Long lines of rotated text not printing correctly - MultiFontTextOut. Patch from Christopher Chavez. --- win/tkWinFont.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/win/tkWinFont.c b/win/tkWinFont.c index cef505a..63ca37a 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -215,8 +215,8 @@ static int LoadFontRanges(HDC hdc, HFONT hFont, USHORT **startCount, USHORT **endCount, int *symbolPtr); static void MultiFontTextOut(HDC hdc, WinFont *fontPtr, - const char *source, int numBytes, int x, int y, - double angle); + const char *source, int numBytes, + double x, double y, double angle); static void ReleaseFont(WinFont *fontPtr); static inline void ReleaseSubFont(SubFont *subFontPtr); static int SeenName(const char *name, Tcl_DString *dsPtr); @@ -1429,7 +1429,7 @@ MultiFontTextOut( * following string. */ const char *source, /* Potentially multilingual UTF-8 string. */ int numBytes, /* Length of string in bytes. */ - int x, int y, /* Coordinates at which to place origin of + double x, double y, /* Coordinates at which to place origin of * string when drawing. */ double angle) { @@ -1441,6 +1441,7 @@ MultiFontTextOut( const char *p, *end, *next; SubFont *lastSubFontPtr, *thisSubFontPtr; TEXTMETRICW tm; + double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); lastSubFontPtr = &fontPtr->subFontArray[0]; oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle); @@ -1470,7 +1471,8 @@ MultiFontTextOut( (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); - x += size.cx; + x += cosA*size.cx; + y -= sinA*size.cx; Tcl_DStringFree(&runString); } lastSubFontPtr = thisSubFontPtr; -- cgit v0.12 From 0c67c10d860650e92d4ff45a2a6d8c9cde76bb07 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 23 Apr 2020 20:58:29 +0000 Subject: Fix [2712f43f6e]: X11: crash for rotated text w/o Xft. Patch from Christopher Chavez. --- unix/tkUnixFont.c | 64 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 6e7b4c3..d58bab0 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -3066,29 +3066,31 @@ GetImageOfText( Pixmap bitmap; GC bitmapGC; XGCValues values; - XImage *image; + XImage *image = NULL; (void) Tk_MeasureChars(tkfont, source, numBytes, -1, 0, &width); height = fontPtr->fm.ascent + fontPtr->fm.descent; - bitmap = Tk_GetPixmap(display, drawable, width, height, 1); - values.graphics_exposures = False; - values.foreground = BlackPixel(display, DefaultScreen(display)); - bitmapGC = XCreateGC(display, bitmap, GCGraphicsExposures|GCForeground, - &values); - XFillRectangle(display, bitmap, bitmapGC, 0, 0, width, height); - - values.font = Tk_FontId(tkfont); - values.foreground = WhitePixel(display, DefaultScreen(display)); - values.background = BlackPixel(display, DefaultScreen(display)); - XChangeGC(display, bitmapGC, GCFont|GCForeground|GCBackground, &values); - Tk_DrawChars(display, bitmap, bitmapGC, tkfont, source, numBytes, 0, - fontPtr->fm.ascent); - XFreeGC(display, bitmapGC); - - image = XGetImage(display, bitmap, 0, 0, width, height, AllPlanes, - ZPixmap); - Tk_FreePixmap(display, bitmap); + if ((width > 0) && (height > 0)) { + bitmap = Tk_GetPixmap(display, drawable, width, height, 1); + values.graphics_exposures = False; + values.foreground = BlackPixel(display, DefaultScreen(display)); + bitmapGC = XCreateGC(display, bitmap, GCGraphicsExposures|GCForeground, + &values); + XFillRectangle(display, bitmap, bitmapGC, 0, 0, width, height); + + values.font = Tk_FontId(tkfont); + values.foreground = WhitePixel(display, DefaultScreen(display)); + values.background = BlackPixel(display, DefaultScreen(display)); + XChangeGC(display, bitmapGC, GCFont|GCForeground|GCBackground, &values); + Tk_DrawChars(display, bitmap, bitmapGC, tkfont, source, numBytes, 0, + fontPtr->fm.ascent); + XFreeGC(display, bitmapGC); + + image = XGetImage(display, bitmap, 0, 0, width, height, AllPlanes, + ZPixmap); + Tk_FreePixmap(display, bitmap); + } *realWidthPtr = width; *realHeightPtr = height; @@ -3103,21 +3105,23 @@ InitDestImage( int height, Pixmap *bitmapPtr) { - Pixmap bitmap; - XImage *image; + Pixmap bitmap = None; + XImage *image = NULL; GC bitmapGC; XGCValues values; - bitmap = Tk_GetPixmap(display, drawable, width, height, 1); - values.graphics_exposures = False; - values.foreground = BlackPixel(display, DefaultScreen(display)); - bitmapGC = XCreateGC(display, bitmap, GCGraphicsExposures|GCForeground, - &values); - XFillRectangle(display, bitmap, bitmapGC, 0, 0, width, height); - XFreeGC(display, bitmapGC); + if ((width > 0) && (height > 0)) { + bitmap = Tk_GetPixmap(display, drawable, width, height, 1); + values.graphics_exposures = False; + values.foreground = BlackPixel(display, DefaultScreen(display)); + bitmapGC = XCreateGC(display, bitmap, GCGraphicsExposures|GCForeground, + &values); + XFillRectangle(display, bitmap, bitmapGC, 0, 0, width, height); + XFreeGC(display, bitmapGC); - image = XGetImage(display, bitmap, 0, 0, width, height, AllPlanes, - ZPixmap); + image = XGetImage(display, bitmap, 0, 0, width, height, AllPlanes, + ZPixmap); + } *bitmapPtr = bitmap; return image; } -- cgit v0.12 From a5643c1cd9127a06bc125bb587a95862f4cac377 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 23 Apr 2020 21:06:20 +0000 Subject: Optimize text item drawing in canvas by skipping the drawing of empty unselected portions of text. Patch from Christopher Chavez. --- generic/tkCanvText.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index cfd0054..1e58ce9 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -957,19 +957,23 @@ DisplayCanvText( */ if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) { - TkDrawAngledTextLayout(display, drawable, textPtr->gc, - textPtr->textLayout, drawableX, drawableY, textPtr->angle, - 0, selFirstChar); + if (0 < selFirstChar) { + TkDrawAngledTextLayout(display, drawable, textPtr->gc, + textPtr->textLayout, drawableX, drawableY, textPtr->angle, + 0, selFirstChar); + } TkDrawAngledTextLayout(display, drawable, textPtr->selTextGC, textPtr->textLayout, drawableX, drawableY, textPtr->angle, selFirstChar, selLastChar + 1); - TkDrawAngledTextLayout(display, drawable, textPtr->gc, - textPtr->textLayout, drawableX, drawableY, textPtr->angle, - selLastChar + 1, -1); + if (selLastChar + 1 < textPtr->numChars) { + TkDrawAngledTextLayout(display, drawable, textPtr->gc, + textPtr->textLayout, drawableX, drawableY, textPtr->angle, + selLastChar + 1, textPtr->numChars); + } } else { TkDrawAngledTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->angle, - 0, -1); + 0, textPtr->numChars); } TkUnderlineAngledTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->angle, -- cgit v0.12 From d1db7a46168db5d2e4a1dfcfb0386096a797aa4e Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 26 Apr 2020 10:07:33 +0000 Subject: Remove cast to int when calling MultiFontTextOut from TkDrawAngledChars (since x and y are doubles and MultiFontTextOut now accepts doubles). --- win/tkWinFont.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 63ca37a..41013d5 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -1294,11 +1294,11 @@ TkDrawAngledChars( */ PatBlt(dcMem, 0, 0, size.cx, size.cy, BLACKNESS); - MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle); + MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle); BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem, 0, 0, 0xEA02E9); PatBlt(dcMem, 0, 0, size.cx, size.cy, WHITENESS); - MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle); + MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle); BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem, 0, 0, 0x8A0E06); @@ -1315,7 +1315,7 @@ TkDrawAngledChars( SetTextAlign(dc, TA_LEFT | TA_BASELINE); SetTextColor(dc, gc->foreground); SetBkMode(dc, TRANSPARENT); - MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle); + MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle); } else { HBITMAP oldBitmap, bitmap; HDC dcMem; -- cgit v0.12 From b9b0bc955ae9c212dcfe71404ded14c6814c146c Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 26 Apr 2020 20:30:00 +0000 Subject: Add test canvText-20.2 failing before commit [f74fffb4] and no longer failing with this commit. --- tests/canvText.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/canvText.test b/tests/canvText.test index 76903d7..f52b996 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -964,6 +964,20 @@ test canvText-20.1 {angled text bounding box} -setup { rename transpose {} } -result {ok ok ok} +test canvText-20.2 {crash on angled text selection (Linux, without xft) - bug 2712f43f6e} -setup { + destroy .c + canvas .c -background bisque -selectforeground green2 + grid .c + set id [.c create text 50 150 -anchor w -text "Angled text" \ + -angle 30 -font {Helvetica 32} -fill darkblue] +} -body { + .c select clear + .c select from $id 0 + .c select to $id 8 ; update ; # used to crash on Linux (--disable-xft build only) +} -cleanup { + destroy .c +} -result {} + # cleanup cleanupTests return -- cgit v0.12 From 05651b573ce92f6aa656970ef996efabb9368d04 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 26 Apr 2020 21:05:46 +0000 Subject: More accurately comment canvText-20.2 --- tests/canvText.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/canvText.test b/tests/canvText.test index f52b996..20cbff4 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -964,7 +964,7 @@ test canvText-20.1 {angled text bounding box} -setup { rename transpose {} } -result {ok ok ok} -test canvText-20.2 {crash on angled text selection (Linux, without xft) - bug 2712f43f6e} -setup { +test canvText-20.2 {crash on angled text selection (X11, without xft) - bug 2712f43f6e} -setup { destroy .c canvas .c -background bisque -selectforeground green2 grid .c @@ -973,7 +973,7 @@ test canvText-20.2 {crash on angled text selection (Linux, without xft) - bug 27 } -body { .c select clear .c select from $id 0 - .c select to $id 8 ; update ; # used to crash on Linux (--disable-xft build only) + .c select to $id 8 ; update ; # used to crash on X11 (--disable-xft build only) } -cleanup { destroy .c } -result {} -- cgit v0.12