diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2007-05-04 21:29:22 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2007-05-04 21:29:22 (GMT) |
commit | b721e1f32dc43b3626d65e9211ae661af0d969f3 (patch) | |
tree | 51e7b83d5b0e0635d7c5c5de62858ea248f463ec /library | |
parent | 8d83285f461dd84680e46ac7ff6325f43cf48a74 (diff) | |
download | tk-b721e1f32dc43b3626d65e9211ae661af0d969f3.zip tk-b721e1f32dc43b3626d65e9211ae661af0d969f3.tar.gz tk-b721e1f32dc43b3626d65e9211ae661af0d969f3.tar.bz2 |
TIP #145 implementation
Diffstat (limited to 'library')
-rw-r--r-- | library/demos/widget | 28 | ||||
-rw-r--r-- | library/ttk/fonts.tcl | 19 |
2 files changed, 32 insertions, 15 deletions
diff --git a/library/demos/widget b/library/demos/widget index ec964f9..c4e9fd6 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -11,7 +11,7 @@ exec wish "$0" "$@" # ".tcl" files is this directory, which are sourced by this script # as needed. # -# RCS: @(#) $Id: widget,v 1.28 2006/09/11 14:41:04 das Exp $ +# RCS: @(#) $Id: widget,v 1.29 2007/05/04 21:29:22 patthoyts Exp $ package require Tcl 8.5 package require Tk 8.5 @@ -33,12 +33,26 @@ if {[tk windowingsystem] eq "x11"} { } if {[lsearch -exact [font names] defaultFont] == -1} { - font create mainFont -family Helvetica -size 12 - font create fixedFont -family Courier -size 10 - font create boldFont -family Helvetica -size 12 -weight bold - font create titleFont -family Helvetica -size 18 -weight bold - font create statusFont -family Helvetica -size 10 - font create varsFont -family Helvetica -size 14 + # TIP #145 defines some standard named fonts + if {[lsearch -exact [font names] TkDefaultFont] != -1} { + # FIX ME: the following tecnique of cloning the font to copy it works + # fine but means that if the system font is changed by + # Tk cannot update the copied font. font alias might be + # useful here -- or fix the app to use TkDefaultFont etc. + font create mainFont {*}[font configure TkDefaultFont] + font create fixedFont {*}[font configure TkFixedFont] + font create boldFont {*}[font configure TkDefaultFont] -weight bold + font create titleFont {*}[font configure TkDefaultFont] -weight bold + font create statusFont {*}[font configure TkDefaultFont] + font create varsFont {*}[font configure TkDefaultFont] + } else { + font create mainFont -family Helvetica -size 12 + font create fixedFont -family Courier -size 10 + font create boldFont -family Helvetica -size 12 -weight bold + font create titleFont -family Helvetica -size 18 -weight bold + font create statusFont -family Helvetica -size 10 + font create varsFont -family Helvetica -size 14 + } } set widgetDemo 1 diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl index db15ad1..8cb6c33 100644 --- a/library/ttk/fonts.tcl +++ b/library/ttk/fonts.tcl @@ -1,5 +1,5 @@ # -# $Id: fonts.tcl,v 1.3 2006/11/28 21:25:27 jenglish Exp $ +# $Id: fonts.tcl,v 1.4 2007/05/04 21:29:22 patthoyts Exp $ # # Font specifications. # @@ -75,7 +75,8 @@ namespace eval ttk { -catch {font create TkDefaultFont} + +set tip145 [catch {font create TkDefaultFont}] catch {font create TkTextFont} catch {font create TkHeadingFont} catch {font create TkCaptionFont} @@ -100,12 +101,14 @@ switch -- [tk windowingsystem] { } set F(size) 8 - font configure TkDefaultFont -family $F(family) -size $F(size) - font configure TkTextFont -family $F(family) -size $F(size) - font configure TkHeadingFont -family $F(family) -size $F(size) - font configure TkCaptionFont -family $F(family) -size $F(size) \ - -weight bold - font configure TkTooltipFont -family $F(family) -size $F(size) + if {!$tip145} { + font configure TkDefaultFont -family $F(family) -size $F(size) + font configure TkTextFont -family $F(family) -size $F(size) + font configure TkHeadingFont -family $F(family) -size $F(size) + font configure TkCaptionFont -family $F(family) -size $F(size) \ + -weight bold + font configure TkTooltipFont -family $F(family) -size $F(size) + } } aqua { set F(family) "Lucida Grande" |