Tk Source Code

View Ticket
Login
Ticket UUID: 7716cb2f67729993b56012959ee1fcaa8d876ac8
Title: [tk print] fails for canvas items with non integer widths
Type: Bug Version: trunk
Submitter: emiliano Created on: 2025-04-27 20:12:11
Subsystem: -- New Commands Assigned To: fvogel
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2025-04-29 20:53:37
Resolution: Fixed Closed By: fvogel
    Closed on: 2025-04-29 20:53:37
Description:
[tk print] fails for canvas items with non integer widths

(bin) 1 % pack [canvas .c]
(bin) 2 % .c create line 0 0 20 20 -width 2.5
1
(bin) 3 % tk print .c
expected integer but got "2.5"

win/tkWinGDI.c expects integer widths for canvas items, since this is what ExtCreatePen() GDI function uses. The canvas itself, however, uses doubles for widths, part of the Tk_Outline structure.

Attached patch fixes the issue by using doubles everywhere and converting it to integer in the GdiMakePen() function only.
User Comments: fvogel added on 2025-04-29 20:53:37:
Now merged. Thanks again!

fvogel added on 2025-04-28 05:50:00:

Committed in a bugfix branch in [e03df40ddd]. Thanks!


emiliano added on 2025-04-27 20:19:12:
Forgot to add: this is a Windows only issue.

Attachments: