1 # -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
3 # $Id: Fonts.tcl,v 1.8 2006-06-27 13:33:42 villate Exp $
7 global maxima_priv fontCourier8 fixedFont fontSize
8 set maxima_priv
(fixedFont
) Courier
10 # Pick a default font size in pixels
11 set _screenheight
[winfo screenheight .
]
12 # if {$_screenheight < 500} {
16 # # Pick a default borderwidth which smaller
18 # } elseif {$_screenheight < 700} {
22 # } elseif {$_screenheight < 800} {
26 # } elseif {$_screenheight < 1100} {
35 # ZW: this actually produces better result
40 # setup defaults depending on the OS and Window Manager
41 # Really should do another version for mono
42 switch -exact -- $tcl_platform(platform
) {
44 set _prop_default Tahoma
45 set _fixed_default
{Courier New
}
48 set _prop_default
{Bitstream Vera Sans
}
49 set _fixed_default
{Bitstream Vera Sans Mono
}
52 # make sure these fonts are installed
53 set _allowed
[string tolow
[font families
]]
54 foreach font [list $_prop_default "MS Sans Serif" Tahoma Arial Helvetica
\
56 if {[lsearch -exact $_allowed [string tolow
$font]] > -1} {
57 set _prop_default
$font
61 foreach font [list $_fixed_default Courier fixed system
] {
62 if {[lsearch -exact $_allowed [string tolow
$font]] > -1} {
63 set _fixed_default
$font
67 set fontCourier8
[list $_fixed_default $_pixel]
68 set fixedFont
[font create
-family $_fixed_default -size $_pixel]
69 set buttonfont
[font create
-family $_prop_default -size $_pixel]
73 set maxima_default
(adjust
) 0
74 # I think this is too crude and wont work with WM schemes
77 set width_
[expr {.9 * [winfo screenwidth .
]}]
78 if { [winfo width .
] >= 500 } {
79 set width_
[winfo width .
]
81 set maxima_default
(adjust
) [expr {
91 ######### font choosing utilities #########
95 if { "$tcl_platform(platform)" == "unix" } {
97 fixed
1 {fangsong ti
} 1 {clearlyu alternate glyphs
} 0 lucidatypewriter
1 charter
0 lucidabright
0 times
0 ming
1 {lucidux sans
} 0 {open look glyph
} 0 {song ti
} 1 newspaper
0 helvetica
0 {open look cursor
} 1 li
1 mincho
1 {clearlyu ligature
} 0 {clearlyu pua
} 0 {lucidux mono
} 1 courier
1 clearlyu
0 utopia
0 lucida
0 nil
1 clean
1 terminal
1 kai
1 gothic
1 cursor
0 symbol
0 {clearlyu arabic extra
} 0 {lucidux serif
} 0 {new century schoolbook
} 0 song
1
101 proc getFontFamilies
{ fixed
} {
103 foreach font [font families
] {
104 if { ![info exists isFixedp
($font)] } {
105 set isFixedp
($font) [font metrics
[list $font] -fixed]
107 if { $isFixedp($font) == $fixed } {
111 return [lsort $answer]