4 # This file, [source]d at initialization time, sets up the following
5 # symbolic fonts based on the current platform:
7 # TkDefaultFont -- default for GUI items not otherwise specified
8 # TkTextFont -- font for user text (entry, listbox, others)
9 # TkFixedFont -- standard fixed width font
10 # TkHeadingFont -- headings (column headings, etc)
11 # TkCaptionFont -- dialog captions (primary text in alert dialogs, etc.)
12 # TkTooltipFont -- font to use for tooltip windows
13 # TkIconFont -- font to use for icon captions
14 # TkMenuFont -- used to use for menu items
16 # In Tk 8.5, some of these fonts may be provided by the TIP#145 implementation
17 # (On Windows and Mac OS X as of Oct 2007).
22 # The default system font changed from "MS Sans Serif" to "Tahoma"
23 # in Windows XP/Windows 2000.
25 # MS documentation says to use "Tahoma 8" in Windows 2000/XP,
26 # although many MS programs still use "MS Sans Serif 8"
28 # Should use SystemParametersInfo() instead.
31 # Quoth the Apple HIG:
32 # The _system font_ (Lucida Grande Regular 13 pt) is used for text
33 # in menus, dialogs, and full-size controls.
34 # [...] Use the _view font_ (Lucida Grande Regular 12pt) as the default
35 # font of text in lists and tables.
36 # [...] Use the _emphasized system font_ (Lucida Grande Bold 13 pt)
37 # sparingly. It is used for the message text in alerts.
38 # [...] The _small system font_ (Lucida Grande Regular 11 pt) [...]
39 # is also the default font for column headings in lists, for help tags,
40 # and for small controls.
42 # Note that the font for column headings (TkHeadingFont) is
43 # _smaller_ than the default font.
45 # There does not appear to be any recommendations for fixed-width fonts.
48 # Need a way to tell if Xft is enabled or not.
49 # For now, assume patch #971980 applied.
51 # "Classic" look used Helvetica bold for everything except
52 # for entry widgets, which use Helvetica medium.
53 # Most other toolkits use medium weight for all UI elements,
54 # which is what we do now.
56 # Font size specified in pixels on X11, not points.
57 # This is Theoretically Wrong, but in practice works better; using
58 # points leads to huge inconsistencies across different servers.
63 set tip145
[catch {font create TkDefaultFont
}]
64 catch {font create TkTextFont
}
65 catch {font create TkHeadingFont
}
66 catch {font create TkCaptionFont
}
67 catch {font create TkTooltipFont
}
68 catch {font create TkFixedFont
}
69 catch {font create TkIconFont
}
70 catch {font create TkMenuFont
}
71 catch {font create TkSmallCaptionFont
}
74 variable F
;# miscellaneous platform-specific font parameters
75 switch -- [tk windowingsystem
] {
77 # In safe interps there is no osVersion element.
78 if {[info exists tcl_platform
(osVersion
)]} {
79 if {$tcl_platform(osVersion
) >= 5.0} {
80 set F
(family
) "Tahoma"
82 set F
(family
) "MS Sans Serif"
85 if {[lsearch -exact [font families
] Tahoma
] != -1} {
86 set F
(family
) "Tahoma"
88 set F
(family
) "MS Sans Serif"
93 font configure TkDefaultFont
-family $F(family
) -size $F(size
)
94 font configure TkTextFont
-family $F(family
) -size $F(size
)
95 font configure TkHeadingFont
-family $F(family
) -size $F(size
)
96 font configure TkCaptionFont
-family $F(family
) -size $F(size
) \
98 font configure TkTooltipFont
-family $F(family
) -size $F(size
)
99 font configure TkFixedFont
-family Courier
-size 10
100 font configure TkIconFont
-family $F(family
) -size $F(size
)
101 font configure TkMenuFont
-family $F(family
) -size $F(size
)
102 font configure TkSmallCaptionFont
-family $F(family
) -size $F(size
)
105 set F
(family
) "Lucida Grande"
106 set F
(fixed
) "Monaco"
114 font configure TkDefaultFont
-family $F(family
) -size $F(size
)
115 font configure TkTextFont
-family $F(family
) -size $F(size
)
116 font configure TkHeadingFont
-family $F(family
) -size $F(smallsize
)
117 font configure TkCaptionFont
-family $F(family
) -size $F(size
) \
119 font configure TkTooltipFont
-family $F(family
) -size $F(smallsize
)
120 font configure TkFixedFont
-family $F(fixed
) -size $F(fixedsize
)
121 font configure TkIconFont
-family $F(family
) -size $F(size
)
122 font configure TkMenuFont
-family $F(family
) -size $F(menusize
)
123 font configure TkSmallCaptionFont
-family $F(family
) -size $F(labelsize
)
127 if {![catch {tk::pkgconfig get fontsystem
} F
(fs
)] && $F(fs
) eq
"xft"} {
128 set F
(family
) "sans-serif"
129 set F
(fixed
) "monospace"
131 set F
(family
) "Helvetica"
132 set F
(fixed
) "courier"
139 font configure TkDefaultFont
-family $F(family
) -size $F(size
)
140 font configure TkTextFont
-family $F(family
) -size $F(size
)
141 font configure TkHeadingFont
-family $F(family
) -size $F(size
) \
143 font configure TkCaptionFont
-family $F(family
) -size $F(capsize
) \
145 font configure TkTooltipFont
-family $F(family
) -size $F(ttsize
)
146 font configure TkFixedFont
-family $F(fixed
) -size $F(fixedsize
)
147 font configure TkIconFont
-family $F(family
) -size $F(size
)
148 font configure TkMenuFont
-family $F(family
) -size $F(size
)
149 font configure TkSmallCaptionFont
-family $F(family
) -size $F(ttsize
)