for built-in named fonts
# File tk/lib/tk/font.rb, line 2235 def TkNamedFont.find(name) name = name.to_s unless (obj = Tk_FontNameTBL[name]) obj = self.new(name) if TkFont.is_system_font?(name) end obj end
# File tk/lib/tk/font.rb, line 2243 def TkNamedFont.new(name, keys=nil) name = name.to_s obj = nil Tk_FontNameTBL.mutex.synchronize{ unless (obj = Tk_FontNameTBL[name]) (obj = self.allocate).instance_eval{ @id = @compoundfont = name.to_s @latinfont = nil @kanjifont = nil @descendant = [self, self] # [latin, kanji] : dummy Tk_FontNameTBL[@id] = self } end } obj.instance_eval{ initialize(name, keys) } obj end
# File tk/lib/tk/font.rb, line 2264 def initialize(name, keys=nil) @id = @compoundfont = name.to_s # if not exist named font, create it. begin if keys tk_call('font', 'configure', @compoundfont, keys) else tk_call('font', 'configure', @compoundfont) end rescue # the named font doesn't exist -> create if keys tk_call('font', 'create', @compoundfont, keys) else tk_call('font', 'create', @compoundfont) end end end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.