Method: TkTreatFont#font_configinfo

Defined in:
lib/tk.rb

#font_configinfo(key = nil) ⇒ Object Also known as: fontobj



3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
# File 'lib/tk.rb', line 3433

def font_configinfo(key = nil)
  optkeys = __font_optkeys
  if key && !optkeys.find{|opt| opt.to_s == key.to_s}
    fail ArgumentError, "unknown font option name `#{key}'"
  end

  win, tag = __pathname.split(':')

  if key
    pathname = [win, tag, key].join(';')
    TkFont.used_on(pathname) ||
      TkFont.init_widget_font(pathname, *__confinfo_cmd)
  elsif optkeys.size == 1
    pathname = [win, tag, optkeys[0]].join(';')
    TkFont.used_on(pathname) ||
      TkFont.init_widget_font(pathname, *__confinfo_cmd)
  else
    fonts = {}
    optkeys.each{|k|
      k = k.to_s
      pathname = [win, tag, k].join(';')
      fonts[k] =
        TkFont.used_on(pathname) ||
        TkFont.init_widget_font(pathname, *__confinfo_cmd)
    }
    fonts
  end
end