summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tktext.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-29 08:34:14 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-29 08:34:14 +0000
commit24ff3f444882ba60418a6736d6c5d57ba3c0b80c (patch)
tree813a69918ff8435617ca58e193f9440c06febdb7 /ext/tk/lib/tktext.rb
parent22a5aec4b322c1be9eced78967e5cfd0ae54b6cb (diff)
* doc/ChangeLog-1.8.0: add changes of Ruby/Tk
* ext/tcltklib/tcltklib.c : some methods have no effect if on slave-IP * ext/tcltklib/tcltklib.c : can create a interpreter without Tk * ext/tcltklib/tcltklib.c : bug fix on handling exceptions * ext/tcltklib/MANUAL.euc : modify * ext/tk/lib/tk.rb : freeze some core modules * ext/tk/lib/multi-tk.rb : more secure * ext/tk/lib/tk.rb: TkVariable.new(array) --> treat the array as the Tk's list * ext/tk/lib/tk.rb: improve accessibility of TkVariable object * ext/tk/lib/tk.rb, ext/tk/lib/tkfont.rb, ext/tk/lib/tkcanvas.rb, ext/tk/lib/tktext.rb : fix bug of font handling * ext/tk/lib/tkfont.rb TkFont.new() accepts compound fonts * process.c: bug fix * process.c: add rb_secure(2) to methods of Process::{UID,GID,Sys} * process.c: deny handling IDs during evaluating the block given to the Process::{UID,GID}.switch method git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tktext.rb')
-rw-r--r--ext/tk/lib/tktext.rb34
1 files changed, 32 insertions, 2 deletions
diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb
index ae40ac8750..9f1ad24665 100644
--- a/ext/tk/lib/tktext.rb
+++ b/ext/tk/lib/tktext.rb
@@ -330,6 +330,12 @@ class TkText<TkTextWin
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
tk_call(@path, 'tag', 'cget', tag, "-#{key}")
+ when 'font', 'kanjifont'
+ fnt = tk_tcl2ruby(tk_send('tag', 'cget', tag, "-#{key}"))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(tag, fnt)
+ end
+ fnt
else
tk_tcl2ruby(tk_call(@path, 'tag', 'cget', tag, "-#{key}"))
end
@@ -363,13 +369,17 @@ class TkText<TkTextWin
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(tk_send('tag','configure',tag,"-#{key}"))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(tk_send('tag','configure',tag,"-#{key}") )
+ conf[4] = tagfont_configinfo(tag, conf[4])
else
conf = tk_split_list(tk_send('tag','configure',tag,"-#{key}"))
end
conf[0] = conf[0][1..-1]
conf
else
- tk_split_simplelist(tk_send('tag', 'configure', tag)).collect{|conflist|
+ ret = tk_split_simplelist(tk_send('tag', 'configure',
+ tag)).collect{|conflist|
conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
@@ -392,6 +402,14 @@ class TkText<TkTextWin
end
conf
}
+ fontconf = ret.assoc('font')
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(tag, fontconf[4])
+ ret.push(fontconf)
+ else
+ ret
+ end
end
end
@@ -431,6 +449,12 @@ class TkText<TkTextWin
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
tk_send('window', 'cget', index, "-#{slot}")
+ when 'font', 'kanjifont'
+ fnt = tk_tcl2ruby(tk_send('window', 'cget', index, "-#{slot}"))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(index, fnt)
+ end
+ fnt
else
tk_tcl2ruby(tk_send('window', 'cget', index, "-#{slot}"))
end
@@ -853,8 +877,14 @@ class TkTextTag<TkObject
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
tk_call @t.path, 'tag', 'cget', @id, "-#{key}"
+ when 'font', 'kanjifont'
+ fnt = tk_tcl2ruby(tk_call(@t.path, 'tag', 'cget', @id, "-#{key}"))
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(@id, fnt)
+ end
+ fnt
else
- tk_tcl2ruby tk_call(@t.path, 'tag', 'cget', @id, "-#{key}")
+ tk_tcl2ruby(tk_call(@t.path, 'tag', 'cget', @id, "-#{key}"))
end
end