[PD-cvs] SF.net SVN: pure-data:[10634] branches/pd-devel/0.41.4/src/pd.tk

mescalinum at users.sourceforge.net mescalinum at users.sourceforge.net
Sun Jan 25 15:22:46 CET 2009


Revision: 10634
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10634&view=rev
Author:   mescalinum
Date:     2009-01-25 14:22:45 +0000 (Sun, 25 Jan 2009)

Log Message:
-----------
fix: when user specifies unexisting font, just pick a default font; do the same with
weight.

Modified Paths:
--------------
    branches/pd-devel/0.41.4/src/pd.tk

Modified: branches/pd-devel/0.41.4/src/pd.tk
===================================================================
--- branches/pd-devel/0.41.4/src/pd.tk	2009-01-25 06:43:15 UTC (rev 10633)
+++ branches/pd-devel/0.41.4/src/pd.tk	2009-01-25 14:22:45 UTC (rev 10634)
@@ -147,6 +147,18 @@
 # this proc creates all the needed fonts so that they fit
 # into the metrics given by  $::font_fixed_metrics
 proc fit_font_into_metrics {} {
+    set defaultfamily {Courier New}
+    set defaultweight {normal}
+
+    set availweight {normal bold}
+    set availfamily [font families]
+    foreach i {weight family} {
+        if {[lsearch -exact [set avail$i] [set ::font_$i]] < 0} {
+            puts "bad font-$i: '[set ::font_$i]'. using default '[set default$i]'"
+            set ::font_$i [set default$i]
+        }
+    }
+
     foreach {size width height} $::font_fixed_metrics {
         set myfont [pdtk_font_name $size]
         font create $myfont -family $::font_family -weight $::font_weight \


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list