[R-SIG-Mac] Ugly default Tk font on Mac OS

David Winsemius dwinsemius at comcast.net
Mon Oct 8 19:54:00 CEST 2012


On Oct 8, 2012, at 10:26 AM, John Fox wrote:

> Dear all,
> 
> Milan and I have now corresponded about this issue privately, and it appears that there's a difference in the font used under his Mac OS X system (running Snow Leopard) and mine (running Mountain Lion). I currently get the font
> 
> 	> tkfont.actual("RcmdrDefaultFont")
> 	<Tcl> -family {Bitstream Vera Sans} -size 10 -weight normal -slant roman -underline 0 -overstrike 0
> 
> which (to my eye) is substantially more attractive than what I get when I hard-code Helvetica:
> 
> 	<Tcl> -family Helvetica -size 10 -weight normal -slant roman -underline 0 -overstrike 0
> 
> I don't know what the source of the difference is -- a different X-windows is used for Snow Leopard and Mountain Lion, and Milan and I are in different language locales.
> 
> Of course, if there's a way to correct this problem, I'm happy to implement it.

Just as a point of reference. With a recently installed update to Snow Leopard (yes, I'm way behind that adoption curve) and Rcmdr version 1.8.4 ( I'm not a user and I see this is out-of-date) , I get:

> tkfont.actual("RcmdrDefaultFont")
<Tcl> -family {Bitstream Vera Sans} -size 12 -weight normal -slant roman -underline 0 -overstrike 0 

> 

> Best,
> John
> 
>> -----Original Message-----
>> From: Milan Bouchet-Valat [mailto:nalimilan at club.fr]
>> Sent: Monday, October 08, 2012 4:15 AM
>> To: r-sig-mac
>> Cc: John Fox
>> Subject: Ugly default Tk font on Mac OS
>> 
>> Hi!
>> 
>> On Mac OS, since John Fox has removed the code that forced the default
>> font to be Helvetica (which is a good idea), Rcommander looks terribly
>> ugly (try by yourself ;-). I've reports of this on at least two
>> machines, under Snow Leopard.
>> 
>> I've played a bit with fonts on such machines, and I discovered that the
>> problem is not particular to Rcmdr at all, but that it affects all named
>> fonts that are created manually.
>> 
>> Rcommander uses a font created that way:
>> .Tcl("font create RcmdrDefaultFont -size X") # with X a given value
>> 
>> On Mac OS, this command creates a font whose family name is "fixed",
>> according to tkfont.actual(), and it is somewhat translated to an ugly
>> font. This is weird, because all default Tk fonts, like TkDefaultFont,
>> TkTextFont, TkMenuFont... all use "helvetica" as font family, which is a
>> reasonable default (and not a fixed font). What might be happening on
>> Macs is that system fonts like "systemSystemFont",
>> "systemApplicationFont" and friends are _not_ defined correctly, i.e.
>> they also use "fixed" as font family. So maybe newly created named fonts
>> inherits from them.
>> 
>> On Linux (and most likely on Windows), the default font family is
>> correct when creating a named font.
>> 
>> 
>> Here's a minimal example that reproduces the issue:
>> library(tcltk)
>> .Tcl("font create test")
>> tkfont.actual("test") # Wrong
>> tkfont.actual("TkDefaultFont") # OK
>> tkfont.actual("systemSystemFont) # Wrong
>> etc.
>> 
>> 
>> Regards
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

David Winsemius, MD
Alameda, CA, USA



More information about the R-SIG-Mac mailing list