summaryrefslogtreecommitdiffstats
path: root/ext/tk/sample/demos-en/patch_1.1c1
blob: d3952e71eb656b45aa6cde7341eaa5f27eb2286b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--- /usr/src/ruby-1.1c1/lib/tkcanvas.rb	Tue Jul 21 18:18:02 1998
+++ tkcanvas.rb	Fri Jul 24 20:38:24 1998
@@ -310,7 +310,7 @@
 	  || key == 'latinfont' || key == 'asciifont' )
 	tagfont_configure(tagid(tagOrId), {key=>value})
       else
-	tk_call 'itemconfigure', tagid(tagOrId), "-#{key}", value
+	tk_send 'itemconfigure', tagid(tagOrId), "-#{key}", value
       end
     end
   end
--- /usr/src/ruby-1.1c1/lib/tkfont.rb	Fri Jul 17 23:43:28 1998
+++ tkfont.rb	Fri Jul 24 17:46:22 1998
@@ -42,7 +42,7 @@
       r | []
 
     when /^8\.*/
-      list(tk_call('font', 'names'))
+      tk_split_simplelist(tk_call('font', 'names'))
 
     end
   end
@@ -89,10 +89,14 @@
       if fnt == []
 	TkFont.new(nil, nil).call_font_configure(path, *(args + [{}]))
       else
-	compound = Hash[*list(tk_call('font', 'configure', 
-				      fnt))].collect{|key,value|
-	  [key[1..-1], value]
-	}.assoc('compound')[1]
+	begin
+	  compound = Hash[*list(tk_call('font', 'configure', 
+					fnt))].collect{|key,value|
+	    [key[1..-1], value]
+	  }.assoc('compound')[1]
+	rescue
+	  compound = []
+	end
 	if compound == []
 	  TkFont.new(fnt, DEFAULT_KANJI_FONT_NAME) \
 	  .call_font_configure(path, *(args + [{}]))
@@ -156,14 +160,19 @@
     elsif font.kind_of? Array
       finfo = {}
       finfo['family'] = font[0].to_s
-      if font[1] && font[1] != '0' && font[1] =~ /^(|\+|-)([0-9]+)$/
-	if $1 == '-'
-	  finfo['pixels'] = font[1].to_s
+      if font[1]
+	fsize = font[1].to_s
+	if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
+	  if $1 == '-'
+	    finfo['pixels'] = $2
+	  else
+	    finfo['points'] = $2
+	  end
 	else
-	  finfo['points'] = font[1].to_s
+	  finfo['points'] = '13'
 	end
       end
-      finfo[2..-1].each{|style|
+      font[2..-1].each{|style|
 	case (style)
 	when 'normal'
 	  finfo['weight'] = style
@@ -199,16 +208,19 @@
     elsif font.kind_of? Array
       finfo = {}
       finfo['family'] = font[0].to_s
-      if font[1] && font[1] != '0' && font[1] =~ /^(|\+|-)([0-9]+)$/
-	if $1 == '-'
-	  finfo['pixels'] = $2
+      if font[1]
+	fsize = font[1].to_s
+	if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
+	  if $1 == '-'
+	    finfo['pixels'] = $2
+	  else
+	    finfo['points'] = $2
+	  end
 	else
-	  finfo['points'] = $2
+	  finfo['points'] = '13'
 	end
-      else
-	finfo['points'] = '13'
       end
-      finfo[2..-1].each{|style|
+      font[2..-1].each{|style|
 	case (style)
 	when 'normal'
 	  finfo['weight'] = style