From: SourceForge.net <no...@so...> - 2008-09-11 10:15:29
|
Bugs item #1961455, was opened at 2008-05-10 11:17 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1961455&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: 46. Unix Fonts Group: obsolete: 8.5.2 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Peter Caffin (pcaffin) Assigned to: Jeffrey Hobbs (hobbs) Summary: Font underlining seems broken on X11 Initial Comment: The following should see the label's font underlined during mouse-over. =========== catch {font create url} catch {font create urlmo} font configure url -family Arial -size 12 -underline 0 font configure urlmo -family Arial -size 12 -underline 1 grid [ttk::label .l -text "Should be underlined on mouse-over." -font url -foreground darkgreen] bind .l <Enter> ".l configure -cursor hand2 -font urlmo -foreground darkblue" bind .l <Leave> ".l configure -cursor arrow -font url -foreground darkgreen" bind .l <Button-1> ".l configure -font urlmo -foreground red ; # someProc" =========== The font's colour changes on X11 (so the rest of the configure works). Underline tested OK on Windows and Mac OS X. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-09-11 10:15 Message: Font understrike doesn't work either on all 8.5 i've tested, up to 8.5.4. (stevenaaus) ---------------------------------------------------------------------- Comment By: Sergei Golovan (teopetuk) Date: 2008-09-10 13:38 Message: Apparently I've tested the patch using Xft-disabled build. So, while it fixes canvas postscript problem, it doesn't fix underlined fonts. Sorry for the noise. ---------------------------------------------------------------------- Comment By: Sergei Golovan (teopetuk) Date: 2008-09-10 13:21 Message: While investigating another font related bug (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498408) I've found that when using old X11 fonts Tk never uses negative font sizes (it converts them to positive throug TkFontGetPoints()). So, I suppose that there's code which uses fonts and implicitly assumes that its size is always positive. After applying the attached patch which simply converts font size to a positive value (size in points) both bug in canvas and this bug are gone. Though probably in long run it would be better to find code which cannot work if font size is negative and fix it. (Can't find how to attach the patch, so listing it here) --- tk8.5-8.5.4.orig/unix/tkUnixRFont.c +++ tk8.5-8.5.4/unix/tkUnixRFont.c @@ -260,6 +260,7 @@ ftFont = GetFont(fontPtr, 0); fontPtr->font.fid = XLoadFont(Tk_Display(tkwin), "fixed"); GetTkFontAttributes(ftFont, &fontPtr->font.fa); + fontPtr->font.fa.size = TkFontGetPoints(tkwin, fontPtr->font.fa.size); GetTkFontMetrics(ftFont, &fontPtr->font.fm); return fontPtr; @@ -517,6 +518,7 @@ /* Actual font used to render the character */ GetTkFontAttributes(ftFont, faPtr); + faPtr->size = TkFontGetPoints(tkwin, faPtr->size); faPtr->underline = fontPtr->font.fa.underline; faPtr->overstrike = fontPtr->font.fa.overstrike; } ---------------------------------------------------------------------- Comment By: Peter Caffin (pcaffin) Date: 2008-05-10 11:23 Message: Logged In: YES user_id=2029956 Originator: YES The first example using ttk::label, but, I've just tested with the standard Tk label and it's much the same. Definitely font related rather than widget related. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1961455&group_id=12997 |