Update tk to version 8.5.5
[msysgit.git] / mingw / lib / tk8.5 / ttk / fonts.tcl
blob93ced36bc3f32e9856aaaace689c35dc4d75a08b
2 # $Id: fonts.tcl,v 1.11 2007/12/13 15:27:08 dgp Exp $
4 # Font specifications.
6 # This file, [source]d at initialization time, sets up the following
7 # symbolic fonts based on the current platform:
9 # TkDefaultFont -- default for GUI items not otherwise specified
10 # TkTextFont -- font for user text (entry, listbox, others)
11 # TkFixedFont -- standard fixed width font
12 # TkHeadingFont -- headings (column headings, etc)
13 # TkCaptionFont -- dialog captions (primary text in alert dialogs, etc.)
14 # TkTooltipFont -- font to use for tooltip windows
15 # TkIconFont -- font to use for icon captions
16 # TkMenuFont -- used to use for menu items
18 # In Tk 8.5, some of these fonts may be provided by the TIP#145 implementation
19 # (On Windows and Mac OS X as of Oct 2007).
21 # +++ Platform notes:
23 # Windows:
24 # The default system font changed from "MS Sans Serif" to "Tahoma"
25 # in Windows XP/Windows 2000.
27 # MS documentation says to use "Tahoma 8" in Windows 2000/XP,
28 # although many MS programs still use "MS Sans Serif 8"
30 # Should use SystemParametersInfo() instead.
32 # Mac OSX / Aqua:
33 # Quoth the Apple HIG:
34 # The _system font_ (Lucida Grande Regular 13 pt) is used for text
35 # in menus, dialogs, and full-size controls.
36 # [...] Use the _view font_ (Lucida Grande Regular 12pt) as the default
37 # font of text in lists and tables.
38 # [...] Use the _emphasized system font_ (Lucida Grande Bold 13 pt)
39 # sparingly. It is used for the message text in alerts.
40 # [...] The _small system font_ (Lucida Grande Regular 11 pt) [...]
41 # is also the default font for column headings in lists, for help tags,
42 # and for small controls.
44 # Note that the font for column headings (TkHeadingFont) is
45 # _smaller_ than the default font.
47 # There does not appear to be any recommendations for fixed-width fonts.
49 # X11:
50 # Need a way to tell if Xft is enabled or not.
51 # For now, assume patch #971980 applied.
53 # "Classic" look used Helvetica bold for everything except
54 # for entry widgets, which use Helvetica medium.
55 # Most other toolkits use medium weight for all UI elements,
56 # which is what we do now.
58 # Font size specified in pixels on X11, not points.
59 # This is Theoretically Wrong, but in practice works better; using
60 # points leads to huge inconsistencies across different servers.
63 namespace eval ttk {
65 set tip145 [catch {font create TkDefaultFont}]
66 catch {font create TkTextFont}
67 catch {font create TkHeadingFont}
68 catch {font create TkCaptionFont}
69 catch {font create TkTooltipFont}
70 catch {font create TkFixedFont}
71 catch {font create TkIconFont}
72 catch {font create TkMenuFont}
73 catch {font create TkSmallCaptionFont}
75 if {!$tip145} {
76 variable F ;# miscellaneous platform-specific font parameters
77 switch -- [tk windowingsystem] {
78 win32 {
79 # In safe interps there is no osVersion element.
80 if {[info exists tcl_platform(osVersion)]} {
81 if {$tcl_platform(osVersion) >= 5.0} {
82 set F(family) "Tahoma"
83 } else {
84 set F(family) "MS Sans Serif"
86 } else {
87 if {[lsearch -exact [font families] Tahoma] != -1} {
88 set F(family) "Tahoma"
89 } else {
90 set F(family) "MS Sans Serif"
93 set F(size) 8
95 font configure TkDefaultFont -family $F(family) -size $F(size)
96 font configure TkTextFont -family $F(family) -size $F(size)
97 font configure TkHeadingFont -family $F(family) -size $F(size)
98 font configure TkCaptionFont -family $F(family) -size $F(size) \
99 -weight bold
100 font configure TkTooltipFont -family $F(family) -size $F(size)
101 font configure TkFixedFont -family Courier -size 10
102 font configure TkIconFont -family $F(family) -size $F(size)
103 font configure TkMenuFont -family $F(family) -size $F(size)
104 font configure TkSmallCaptionFont -family $F(family) -size $F(size)
106 aqua {
107 set F(family) "Lucida Grande"
108 set F(fixed) "Monaco"
109 set F(menusize) 14
110 set F(size) 13
111 set F(viewsize) 12
112 set F(smallsize) 11
113 set F(labelsize) 10
114 set F(fixedsize) 11
116 font configure TkDefaultFont -family $F(family) -size $F(size)
117 font configure TkTextFont -family $F(family) -size $F(size)
118 font configure TkHeadingFont -family $F(family) -size $F(smallsize)
119 font configure TkCaptionFont -family $F(family) -size $F(size) \
120 -weight bold
121 font configure TkTooltipFont -family $F(family) -size $F(smallsize)
122 font configure TkFixedFont -family $F(fixed) -size $F(fixedsize)
123 font configure TkIconFont -family $F(family) -size $F(size)
124 font configure TkMenuFont -family $F(family) -size $F(menusize)
125 font configure TkSmallCaptionFont -family $F(family) -size $F(labelsize)
127 default -
128 x11 {
129 if {![catch {tk::pkgconfig get fontsystem} F(fs)] && $F(fs) eq "xft"} {
130 set F(family) "sans-serif"
131 set F(fixed) "monospace"
132 } else {
133 set F(family) "Helvetica"
134 set F(fixed) "courier"
136 set F(size) -12
137 set F(ttsize) -10
138 set F(capsize) -14
139 set F(fixedsize) -12
141 font configure TkDefaultFont -family $F(family) -size $F(size)
142 font configure TkTextFont -family $F(family) -size $F(size)
143 font configure TkHeadingFont -family $F(family) -size $F(size) \
144 -weight bold
145 font configure TkCaptionFont -family $F(family) -size $F(capsize) \
146 -weight bold
147 font configure TkTooltipFont -family $F(family) -size $F(ttsize)
148 font configure TkFixedFont -family $F(fixed) -size $F(fixedsize)
149 font configure TkIconFont -family $F(family) -size $F(size)
150 font configure TkMenuFont -family $F(family) -size $F(size)
151 font configure TkSmallCaptionFont -family $F(family) -size $F(ttsize)
154 unset -nocomplain F
159 #*EOF*