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

Milan Bouchet-Valat nalimilan at club.fr
Mon Oct 8 10:15:29 CEST 2012


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



More information about the R-SIG-Mac mailing list