Skip to content

Ugly default Tk font on Mac OS

12 messages · David Winsemius, John Fox, Milan Bouchet-Valat

#
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.

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

            
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:
<Tcl> -family {Bitstream Vera Sans} -size 12 -weight normal -slant roman -underline 0 -overstrike 0
David Winsemius, MD
Alameda, CA, USA
#
Dear David,
Thanks for this -- it's helpful, though (as you note), the current CRAN
version of the Rcmdr is 1.9-1. The development version, 1.9-2 on R-Forge,
has a number of cosmetic improvements, but not a change to font-handling.

Best,
 John
#
Le lundi 08 octobre 2012 ? 10:54 -0700, David Winsemius a ?crit :
Interesting. Do you get the same if you run my small test?

library(tcltk)
.Tcl("font create test")
tkfont.actual("test") # Wrong
tkfont.actual("TkDefaultFont") # OK
tkfont.actual("systemSystemFont) # Wrong

Thanks!
#
Dear Milan,
For curiosity, I tried this on my Windows 7 machine:
<Tcl> test
<Tcl> -family Arial -size 12 -weight normal -slant roman -underline 0 -overstrike 0
<Tcl> -family {Segoe UI} -size 9 -weight normal -slant roman -underline 0 -overstrike 0
<Tcl> -family Arial -size 12 -weight normal -slant roman -underline 0 -overstrike 0

Note that 1 matches 3 but not 2.

Best,
 John
#
On Oct 8, 2012, at 11:10 AM, Milan Bouchet-Valat wrote:

            
<Tcl> test
<Tcl> -family {Bitstream Vera Sans} -size 12 -weight normal -slant roman -underline 0 -overstrike 0
<Tcl> -family {Bitstream Vera Sans} -size -12 -weight normal -slant roman -underline 0 -overstrike 0
(Actually there was a trailing "+" sign aft the last one because of amissing quote.
<Tcl> -family {Bitstream Vera Sans} -size 12 -weight normal -slant roman -underline 0 -overstrike 0 

I don't know if I need to update to the current Rcmdr, since this was earlier done without it being loaded. But I did and then here goes:
Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = "tclObj") : 
  [tcl] named font "test" already exists.
<Tcl> -family {Bitstream Vera Sans} -size 12 -weight normal -slant roman -underline 0 -overstrike 0
<Tcl> -family {Bitstream Vera Sans} -size -12 -weight normal -slant roman -underline 0 -overstrike 0
<Tcl> -family {Bitstream Vera Sans} -size 12 -weight normal -slant roman -underline 0 -overstrike 0 

I see a "Script Window and an Output Window but admit considerable difficulty with its very non-Mac-ish interface conventions (no cut and paste, unclear what the submit button requires for proper operation);

I seem to be getting the same font being identified when I run these tests from the "Script Window" but the Output Window was not allowing me to copy to the Clipboard in the various efforts I have made. This is the output of the Save Output as ... pulldown menu:
<Tcl> -family {Bitstream Vera Sans} -size 12 -weight normal -slant roman -underline 0 -overstrike 0
<Tcl> -family {Bitstream Vera Sans} -size -12 -weight normal -slant roman -underline 0 -overstrike 0
#
Le lundi 08 octobre 2012 ? 12:15 -0700, David Winsemius a ?crit :
No, it's not needed, the test is plain tcltk.
Weird, because cut and paste should work AFAIK.
Thanks! So it means you really get Bitstream Vera Sans by default in all
possible cases. This is unexpected to me, as I thought this font was not
included by default on Mac OS X. Maybe this is just the default for
X11... I guess you haven't changed your default font for the system
(native Quartz apps)?


Regards
#
Le lundi 08 octobre 2012 ? 14:47 -0400, John Fox a ?crit :
Indeed. Segoe UI is apparently the default font on Windows 7, so
TkDefaultFont is the best choice. It probably makes sense to make
RcmdrDefaultFont "inherit" the family from TkDefaultFont on all
platforms then. On Mac OS X, it would use the correct font and fix the
bug I reported where it appears, and on Windows 7 it would use the
default Segoe UI instead of Arial. (On Linux, both give me the same font
family, but none is absolutely right, that's another standardization
issue...)


Cheers
#
On Oct 8, 2012, at 12:36 PM, Milan Bouchet-Valat wrote:

            
Nope. Haven't changed any of the defaults:
$serif
[1] "Times-Roman"      "Times-Bold"       "Times-Italic"     "Times-BoldItalic"

$sans
[1] "Helvetica"             "Helvetica-Bold"        "Helvetica-Oblique"    
[4] "Helvetica-BoldOblique"

$mono
[1] "Courier"             "Courier-Bold"        "Courier-Oblique"    
[4] "Courier-BoldOblique"
David Winsemius, MD
Alameda, CA, USA
#
Le lundi 08 octobre 2012 ? 12:43 -0700, David Winsemius a ?crit :
Then, there's still a bug in Tcl/Tk or X11: it would be better if it
used the default sans font, Helvetica, so that it looks as similar as
possible to Quartz apps. But I have no idea where the default of
Bitstream Vera Sans comes from...

Cheers
#
On Oct 8, 2012, at 12:46 PM, Milan Bouchet-Valat wrote:

            
Cannot tell you. Is this at all helpful:
$serif
[1] "-*-times-%s-%s-*-*-%d-*-*-*-*-*-*-*"

$sans
[1] "-*-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*"

$mono
[1] "-*-courier-%s-%s-*-*-%d-*-*-*-*-*-*-*"

$Times
[1] "-adobe-times-%s-%s-*-*-%d-*-*-*-*-*-*-*"

$Helvetica
[1] "-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*"

$CyrTimes
[1] "-cronyx-times-%s-%s-*-*-%d-*-*-*-*-*-*-*"

$CyrHelvetica
[1] "-cronyx-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*"

$Arial
[1] "-monotype-arial-%s-%s-*-*-%d-*-*-*-*-*-*-*"

$Mincho
[1] "-*-mincho-%s-%s-*-*-%d-*-*-*-*-*-*-*"
David Winsemius, MD
Alameda, CA, USA
#
On Oct 8, 2012, at 12:51 PM, David Winsemius wrote:

            
Also note this:
[1] TRUE
David Winsemius, MD
Alameda, CA, USA