From: SourceForge.net <no...@so...> - 2011-07-26 22:12:12
|
Bugs item #3234167, was opened at 2011-03-22 02:45 Message generated for change (Comment added) made by wordtech You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3234167&group_id=12997 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 66. Aqua Window Operations Group: development: 8.6b1.1 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Adrian Robert (arobert3434) Assigned to: Kevin Walzer (wordtech) Summary: Image and font problems on Tk Cocoa Buttons Initial Comment: Last-CVS Tk. Image button displays the image off-center and if border width 0 will obscure one pixel around the image. Text buttons, if the font is set, seem to be setting their size based on the point size rather than querying the font's metrics. These problems are specific to Tk Cocoa and do not occur under Tk Carbon. The following script reproduces, and the attached zip contains the image and screenshots of the results. #!/usr/bin/wish # Reproduce Tk-Cocoa button issues # Last-CVS version as of 2011-03-22 set searchButtonImg [image create photo -file "searchButton.gif"] toplevel .l wm title .l [expr { $tcl_platform(pointerSize) == 8 ? "Cocoa" : "Carbon" }] frame .l.i frame .l.t button .l.i.b1 -image $searchButtonImg -borderwidth 0 button .l.i.b2 -image $searchButtonImg -borderwidth 1 set cfont [font create -family 华文楷体 -size 24] set tfont [font create -family Courier -size 24] button .l.t.b1 -font $cfont -text "华文楷体" button .l.t.b2 -font $tfont -text "Courier" pack .l.i.b1 -padx 10 pack .l.i.b2 -padx 10 pack .l.t.b1 -padx 10 pack .l.t.b2 -padx 10 pack .l.i -pady 10 pack .l.t -pady 10 ---------------------------------------------------------------------- Comment By: Kevin Walzer (wordtech) Date: 2011-07-26 17:12 Message: Whoops, thought the upload went through before. It's there now. ---------------------------------------------------------------------- Comment By: Adrian Robert (arobert3434) Date: 2011-07-26 12:47 Message: No attachment added? ---------------------------------------------------------------------- Comment By: Kevin Walzer (wordtech) Date: 2011-07-26 09:15 Message: See attached file. Looks fine to me. code: button .b -text Foo -image foo -compound top; pack .b ---------------------------------------------------------------------- Comment By: Adrian Robert (arobert3434) Date: 2011-07-26 09:05 Message: Could you post an example of an image that gets centered correctly in Cocoa? At the very least, it might help me learn how to work around the issue. As for the text, the Cocoa version is rendering the button edges overlapping the text in some cases. This is a bug. I don't know if the solution is simply to add padding, or if the metrics determination is off, or if Cocoa needs to take the Carbon approach and use a different button shape for larger fonts. ---------------------------------------------------------------------- Comment By: Kevin Walzer (wordtech) Date: 2011-06-23 10:09 Message: I can see the differences in rendering, but I am not persuaded this is a bug. The layout of the text in the Cocoa version is better than the Carbon, where (for some reason) the button is rendered as a flat toolbutton rather than a rounded pushbutton. (Some quirk in how Carbon renders button geometry.) As for the image, I see that the included image is slightly off-center, but I am not able to reproduce the issue with other, random images--they appear to render just fine and with correct centering. As a result, I do not see anything that can be done here. If you find otherwise, patches are welcome. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3234167&group_id=12997 |