Class: TkFont

Inherits:
Object show all
Extended by:
TkCore, CoreMethods
Includes:
Tk, CoreMethods
Defined in:
lib/tk/font.rb,
lib/tk/font.rb

Defined Under Namespace

Modules: CoreMethods Classes: DescendantFont

Constant Summary collapse

TkCommandNames =
['font'.freeze].freeze
Tk_FontID =
["@font".freeze, "00000".taint].freeze
Tk_FontNameTBL =
TkCore::INTERP.create_table
Tk_FontUseTBL =
TkCore::INTERP.create_table
OptionType =

option_type : default => string

Hash.new(?s)
MetricType =

metric_type : default => num_or_str

Hash.new(?n)

Constants included from TkCore

TkCore::EventFlag, TkCore::INTERP, TkCore::WIDGET_DESTROY_HOOK

Constants included from TkComm

TkComm::GET_CONFIGINFO_AS_ARRAY, TkComm::GET_CONFIGINFOwoRES_AS_ARRAY, TkComm::TkExtlibAutoloadModule, TkComm::Tk_CMDTBL, TkComm::Tk_IDs, TkComm::Tk_WINDOWS, TkComm::USE_TCLs_LIST_FUNCTIONS, TkComm::WidgetClassNames

Constants included from TkUtil

TkUtil::None, TkUtil::RELEASE_DATE

Constants included from Tk

Tk::AUTO_PATH, Tk::INTERP, Tk::JAPANIZED_TK, Tk::LIBRARY_PATH, Tk::MAINLOOP, Tk::PACKAGE_PATH, Tk::RELEASE_DATE, Tk::TCL_LIBRARY_PATH, Tk::TCL_MAJOR_VERSION, Tk::TCL_MINOR_VERSION, Tk::TCL_PACKAGE_PATH, Tk::TCL_PATCHLEVEL, Tk::TCL_PRECISION, Tk::TCL_VERSION, Tk::TK_MAJOR_VERSION, Tk::TK_MINOR_VERSION, Tk::TK_PATCHLEVEL, Tk::TK_VERSION, Tk::Tkextlib_RELEASE_DATE, Tk::TreeCtrl_Widget, Tk::X_Scrollable, Tk::Y_Scrollable

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TkCore

_tk_call_to_list_core, after, after_cancel, after_idle, appname, appsend, appsend_deny, appsend_displayof, callback, callback_break, callback_continue, callback_return, chooseColor, chooseDirectory, do_one_event, event_generate, getMultipleOpenFile, getMultipleSaveFile, getOpenFile, getSaveFile, get_eventloop_tick, get_eventloop_weight, get_no_event_wait, inactive, inactive_displayof, info, ip_eval, ip_eval_with_enc, ip_eval_without_enc, ip_invoke, ip_invoke_with_enc, ip_invoke_without_enc, is_mainloop?, load_cmd_on_ip, mainloop, mainloop_exist?, mainloop_thread?, mainloop_watchdog, messageBox, rb_appsend, rb_appsend_displayof, reset_inactive, reset_inactive_displayof, restart, scaling, scaling_displayof, set_eventloop_tick, set_eventloop_weight, set_no_event_wait, tk_call, tk_call_to_list, tk_call_to_list_with_enc, tk_call_to_list_without_enc, tk_call_to_simplelist, tk_call_to_simplelist_with_enc, tk_call_to_simplelist_without_enc, tk_call_with_enc, tk_call_without_enc, windowingsystem

Methods included from TkComm

_at, _callback_entry?, _callback_entry_class?, _curr_cmd_id, _fromUTF8, _genobj_for_tkwidget, _next_cmd_id, _toUTF8, array2tk_list, #bind, #bind_all, #bind_append, #bind_append_all, #bind_remove, #bind_remove_all, #bindinfo, #bindinfo_all, bool, image_obj, install_cmd, list, num_or_str, number, procedure, simplelist, string, #subst, tk_tcl2ruby, uninstall_cmd, window

Methods included from TkUtil

_conv_args, #_conv_args, #_fromUTF8, _get_eval_enc_str, #_get_eval_enc_str, #_get_eval_string, _get_eval_string, _symbolkey2str, #_symbolkey2str, #_toUTF8, bool, #bool, callback, eval_cmd, #hash_kv, hash_kv, install_cmd, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd

Methods included from TkEvent

#install_bind, #install_bind_for_event_class

Methods included from Tk

BinaryString, EncodedString, UTF8_String, add_kinsoku, bell, bell_on_display, const_missing, current_grabs, cursor_display, delete_kinsoku, destroy, #encoding, #encoding=, errorCode, errorInfo, exit, focus, focus_lastfor, focus_next, focus_prev, focus_to, fromUTF8, grid, grid_forget, has_mainwindow?, load_tcllibrary, load_tclscript, load_tclscript_rsrc, load_tclscript_rsrcid, lower_window, pack, pack_forget, pkgconfig_get, pkgconfig_list, place, place_forget, raise_window, #root, show_kinsoku, strictMotif, subst_tk_backslash, subst_utf_backslash, tcl_pkgconfig_get, tcl_pkgconfig_list, thread_update, thread_update_idletasks, tk_pkgconfig_get, tk_pkgconfig_list, toUTF8, to_backslash_sequence, ungrid, unload_tcllibrary, unpack, unplace, #update, update, update_idletasks, utf_to_backslash, utf_to_backslash_sequence

Methods included from Tk::Encoding

#encoding, #encoding=, #encoding_convertfrom, #encoding_convertto, #encoding_dirs, #encoding_dirs=, #encoding_names, #encoding_system, #encoding_system=

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args) ⇒ Object



847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
# File 'lib/tk/font.rb', line 847

def method_missing(id, *args)
  name = id.id2name
  case args.length
  when 1
    if name[-1] == ?=
      configure name[0..-2], args[0]
      args[0]
    else
      configure name, args[0]
      self
    end
  when 0
    begin
      configinfo name
    rescue
      super(id, *args)
#        fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
    end
  else
    super(id, *args)
#      fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
  end
end

Class Method Details

.actual(fnt, option = nil) ⇒ Object

class methods



166
167
168
169
170
171
172
173
# File 'lib/tk/font.rb', line 166

def TkFont.actual(fnt, option=nil)
  fnt = '{}' if fnt == ''
  if fnt.kind_of?(TkFont)
   fnt.actual(option)
  else
    actual_core(fnt, nil, option)
  end
end

.actual_displayof(fnt, win, option = nil) ⇒ Object



175
176
177
178
179
180
181
182
183
# File 'lib/tk/font.rb', line 175

def TkFont.actual_displayof(fnt, win, option=nil)
  fnt = '{}' if fnt == ''
  if fnt.kind_of?(TkFont)
   fnt.actual_displayof(win, option)
  else
    win = '.' unless win
    actual_core(fnt, win, option)
  end
end

.configinfo(fnt, slot = nil) ⇒ Object



194
195
196
197
198
199
200
# File 'lib/tk/font.rb', line 194

def TkFont.configinfo(fnt, slot=nil)
  if fnt.kind_of?(TkFont)
    fnt.configinfo(fnt, slot)
  else
    configinfo_core(fnt, slot)
  end
end

.configure(fnt, slot, value = None) ⇒ Object



185
186
187
188
189
190
191
192
# File 'lib/tk/font.rb', line 185

def TkFont.configure(fnt, slot, value=None)
  if fnt.kind_of?(TkFont)
    fnt.configure(fnt, slot, value)
  else
    configure_core(fnt, slot, value)
  end
  fnt
end

.create_copy(font) ⇒ Object



276
277
278
279
280
281
282
283
284
285
# File 'lib/tk/font.rb', line 276

def TkFont.create_copy(font)
  fail 'source-font must be a TkFont object' unless font.kind_of? TkFont
  if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
    keys = {}
    font.configinfo.each{|key,value| keys[key] = value }
    TkFont.new(font.latin_font_id, font.kanji_font_id, keys)
  else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
    TkFont.new(font.latin_font_id, font.kanji_font_id, font.configinfo)
  end
end

.current_configinfo(fnt, slot = nil) ⇒ Object



202
203
204
205
206
207
208
# File 'lib/tk/font.rb', line 202

def TkFont.current_configinfo(fnt, slot=nil)
  if fnt.kind_of?(TkFont)
    fnt.current_configinfo(fnt, slot)
  else
    current_configinfo_core(fnt, slot)
  end
end

.failsafe(font) ⇒ Object



380
381
382
383
384
385
386
387
# File 'lib/tk/font.rb', line 380

def TkFont.failsafe(font)
  begin
    if /^8\.*/ === Tk::TK_VERSION  && JAPANIZED_TK
      tk_call('font', 'failsafe', font)
    end
  rescue
  end
end

.families(win = nil) ⇒ Object



248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/tk/font.rb', line 248

def TkFont.families(win=nil)
  case (Tk::TK_VERSION)
  when /^4\.*/
    ['fixed']

  when /^8\.*/
    if win
      tk_split_simplelist(tk_call('font', 'families', '-displayof', win))
    else
      tk_split_simplelist(tk_call('font', 'families'))
    end
  end
end

.get_obj(name) ⇒ Object



287
288
289
290
291
292
293
# File 'lib/tk/font.rb', line 287

def TkFont.get_obj(name)
  if name =~ /^(@font[0-9]+)(|c|l|k)$/
    Tk_FontNameTBL[$1]
  else
    nil
  end
end

.init_widget_font(pathname, *args) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/tk/font.rb', line 295

def TkFont.init_widget_font(pathname, *args)
  win, tag, key = pathname.split(';')
  key = 'font' if key == nil || key == ''
  path = [win, tag, key].join(';')

  case (Tk::TK_VERSION)
  when /^4\.*/
    regexp = /^-(|kanji)#{key} /

    conf_list = tk_split_simplelist(tk_call(*args)).
      find_all{|prop| prop =~ regexp}.
      collect{|prop| tk_split_simplelist(prop)}

    if conf_list.size == 0
      raise RuntimeError, "the widget may not support 'font' option"
    end

    args << {}

    ltn_key = "-#{key}"
    knj_key = "-kanji#{key}"

    ltn_info = conf_list.find{|conf| conf[0] == ltn_key}
    ltn = ltn_info[-1]
    ltn = nil if ltn == [] || ltn == ""

    knj_info = conf_list.find{|conf| conf[0] == knj_key}
    knj = knj_info[-1]
    knj = nil if knj == [] || knj == ""

    TkFont.new(ltn, knj).call_font_configure([path, key], *args)

  when /^8\.*/
    regexp = /^-#{key} /

    conf_list = tk_split_simplelist(tk_call(*args)).
      find_all{|prop| prop =~ regexp}.
      collect{|prop| tk_split_simplelist(prop)}

    if conf_list.size == 0
      raise RuntimeError, "the widget may not support 'font' option"
    end

    args << {}

    optkey = "-#{key}"

    info = conf_list.find{|conf| conf[0] == optkey}
    fnt = info[-1]
    fnt = nil if fnt == [] || fnt == ""

    unless fnt
      # create dummy
      # TkFont.new(nil, nil).call_font_configure([path, key], *args)
      dummy_fnt = TkFont.allocate
      dummy_fnt.instance_eval{ init_dummy_fontobj() }
      dummy_fnt
    else
      begin
        compound = tk_split_simplelist(
            Hash[*tk_split_simplelist(tk_call('font', 'configure', 
                                              fnt))].collect{|k,v|
              [k[1..-1], v]
            }.assoc('compound')[1])
      rescue
        compound = []
      end
      if compound == []
        TkFont.new(fnt).call_font_configure([path, key], *args)
      else
        TkFont.new(compound[0], 
                   compound[1]).call_font_configure([path, key], *args)
      end
    end
  end
end

.measure(fnt, text) ⇒ Object



210
211
212
213
214
215
216
217
# File 'lib/tk/font.rb', line 210

def TkFont.measure(fnt, text)
  fnt = '{}' if fnt == ''
  if fnt.kind_of?(TkFont)
    fnt.measure(text)
  else
    measure_core(fnt, nil, text)
  end
end

.measure_displayof(fnt, win, text) ⇒ Object



219
220
221
222
223
224
225
226
227
# File 'lib/tk/font.rb', line 219

def TkFont.measure_displayof(fnt, win, text)
  fnt = '{}' if fnt == ''
  if fnt.kind_of?(TkFont)
    fnt.measure_displayof(win, text)
  else
    win = '.' unless win
    measure_core(fnt, win, text)
  end
end

.metrics(fnt, option = nil) ⇒ Object



229
230
231
232
233
234
235
236
# File 'lib/tk/font.rb', line 229

def TkFont.metrics(fnt, option=nil)
  fnt = '{}' if fnt == ''
  if fnt.kind_of?(TkFont)
    fnt.metrics(option)
  else
    metrics_core(fnt, nil, option)
  end
end

.metrics_displayof(fnt, win, option = nil) ⇒ Object



238
239
240
241
242
243
244
245
246
# File 'lib/tk/font.rb', line 238

def TkFont.metrics_displayof(fnt, win, option=nil)
  fnt = '{}' if fnt == ''
  if fnt.kind_of?(TkFont)
    font.metrics_displayof(win, option=nil)
  else
    win = '.' unless win
    metrics_core(fnt, win, option)
  end
end

.namesObject



262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/tk/font.rb', line 262

def TkFont.names
  case (Tk::TK_VERSION)
  when /^4\.*/
    r = ['fixed']
    r += ['a14', 'k14'] if JAPANIZED_TK
    Tk_FontNameTBL.each_value{|obj| r.push(obj)}
    r | []

  when /^8\.*/
    tk_split_simplelist(tk_call('font', 'names'))

  end
end

.used_on(path = nil) ⇒ Object



372
373
374
375
376
377
378
# File 'lib/tk/font.rb', line 372

def TkFont.used_on(path=nil)
  if path
    Tk_FontUseTBL[path]
  else
    Tk_FontUseTBL.values | []
  end
end

Instance Method Details

#[](slot) ⇒ Object



1026
1027
1028
# File 'lib/tk/font.rb', line 1026

def [](slot)
  configinfo slot
end

#[]=(slot, val) ⇒ Object



1030
1031
1032
1033
# File 'lib/tk/font.rb', line 1030

def []=(slot, val)
  configure slot, val
  val
end

#actual(option = nil) ⇒ Object



989
990
991
# File 'lib/tk/font.rb', line 989

def actual(option=nil)
  actual_core(@compoundfont, nil, option)
end

#actual_displayof(win, option = nil) ⇒ Object



993
994
995
996
# File 'lib/tk/font.rb', line 993

def actual_displayof(win, option=nil)
  win = '.' unless win
  actual_core(@compoundfont, win, option)
end

#call_font_configure(path, *args) ⇒ Object



871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
# File 'lib/tk/font.rb', line 871

def call_font_configure(path, *args)
  if path.kind_of?(Array)
    # [path, optkey]
    win, tag = path[0].split(';')
    optkey = path[1].to_s
  else
    win, tag, optkey = path.split(';')
  end

  fontslot = _symbolkey2str(@fontslot)
  if optkey && optkey != ""
    ltn = fontslot.delete('font')
    knj = fontslot.delete('kanjifont')
    fontslot[optkey] = ltn if ltn
    fontslot["kanji#{optkey}"] = knj if knj
  end

  keys = _symbolkey2str(args.pop).update(fontslot)
  args.concat(hash_kv(keys))
  tk_call(*args)
  Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
  self
end

#configinfo(slot = nil) ⇒ Object



1040
1041
1042
# File 'lib/tk/font.rb', line 1040

def configinfo(slot=nil)
  configinfo_core(@compoundfont, slot)
end

#configure(slot, value = None) ⇒ Object



1035
1036
1037
1038
# File 'lib/tk/font.rb', line 1035

def configure(slot, value=None)
  configure_core(@compoundfont, slot, value)
  self
end

#current_configinfo(slot = nil) ⇒ Object



1044
1045
1046
# File 'lib/tk/font.rb', line 1044

def current_configinfo(slot=nil)
  current_configinfo_core(@compoundfont, slot)
end

#deleteObject



1048
1049
1050
# File 'lib/tk/font.rb', line 1048

def delete
  delete_core
end

#fontObject Also known as: font_id



956
957
958
# File 'lib/tk/font.rb', line 956

def font
  @compoundfont
end

#idObject



948
949
950
# File 'lib/tk/font.rb', line 948

def id
  @id
end

#inspectObject



843
844
845
# File 'lib/tk/font.rb', line 843

def inspect
  sprintf("#<%s:%0x:%s>", self.class.inspect, self.__id__, @compoundfont)
end

#kanji_actual(option = nil) ⇒ Object



1007
1008
1009
1010
1011
1012
1013
1014
# File 'lib/tk/font.rb', line 1007

def kanji_actual(option=nil)
  #if JAPANIZED_TK
  if @kanjifont != ""
    actual_core(@kanjifont, nil, option)
  else
    actual_core_tk4x(nil, nil, option)
  end
end

#kanji_actual_displayof(win, option = nil) ⇒ Object



1016
1017
1018
1019
1020
1021
1022
1023
1024
# File 'lib/tk/font.rb', line 1016

def kanji_actual_displayof(win, option=nil)
  #if JAPANIZED_TK
  if @kanjifont != ""
    win = '.' unless win
    actual_core(@kanjifont, win, option)
  else
    actual_core_tk4x(nil, win, option)
  end
end

#kanji_configinfo(slot = nil) ⇒ Object



1081
1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/tk/font.rb', line 1081

def kanji_configinfo(slot=nil)
  #if JAPANIZED_TK
  if @kanjifont != ""
    configinfo_core(@kanjifont, slot)
  else
    #[]
    configinfo(slot)
  end
end

#kanji_configure(slot, value = None) ⇒ Object



1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
# File 'lib/tk/font.rb', line 1069

def kanji_configure(slot, value=None)
  #if JAPANIZED_TK
  if @kanjifont != ""
    configure_core(@kanjifont, slot, value)
    configure('size'=>configinfo('size')) # to reflect new configuration
  else
    #""
    configure(slot, value)
  end
  self
end

#kanji_fontObject Also known as: kanjifont



979
980
981
982
983
984
985
986
# File 'lib/tk/font.rb', line 979

def kanji_font
  # @kanjifont
  if @kanji_descendant
    @kanji_descendant
  else
    @kanji_descendant = DescendantFont.new(self, 'kanji')
  end
end

#kanji_font_idObject



975
976
977
# File 'lib/tk/font.rb', line 975

def kanji_font_id
  @kanjifont
end

#kanji_metrics(option = nil) ⇒ Object



1137
1138
1139
1140
1141
1142
1143
# File 'lib/tk/font.rb', line 1137

def kanji_metrics(option=nil)
  if JAPANIZED_TK
    metrics_core(@kanjifont, nil, option)
  else
    metrics_core_tk4x(nil, nil, option)
  end
end

#kanji_metrics_displayof(win, option = nil) ⇒ Object



1145
1146
1147
1148
1149
1150
1151
1152
# File 'lib/tk/font.rb', line 1145

def kanji_metrics_displayof(win, option=nil)
  if JAPANIZED_TK
    win = '.' unless win
    metrics_core(@kanjifont, win, option)
  else
    metrics_core_tk4x(nil, win, option)
  end
end

#kanji_replace(knj) ⇒ Object



1104
1105
1106
1107
1108
# File 'lib/tk/font.rb', line 1104

def kanji_replace(knj)
  kanji_replace_core(knj)
  reset_pointadjust
  self
end

#latin_actual(option = nil) ⇒ Object Also known as: ascii_actual



998
999
1000
# File 'lib/tk/font.rb', line 998

def latin_actual(option=nil)
  actual_core(@latinfont, nil, option)
end

#latin_actual_displayof(win, option = nil) ⇒ Object Also known as: ascii_actual_displayof



1002
1003
1004
1005
# File 'lib/tk/font.rb', line 1002

def latin_actual_displayof(win, option=nil)
  win = '.' unless win
  actual_core(@latinfont, win, option)
end

#latin_configinfo(slot = nil) ⇒ Object Also known as: ascii_configinfo



1061
1062
1063
1064
1065
1066
1067
# File 'lib/tk/font.rb', line 1061

def latin_configinfo(slot=nil)
  if JAPANIZED_TK
    configinfo_core(@latinfont, slot)
  else
    configinfo(slot)
  end
end

#latin_configure(slot, value = None) ⇒ Object Also known as: ascii_configure



1052
1053
1054
1055
1056
1057
1058
1059
# File 'lib/tk/font.rb', line 1052

def latin_configure(slot, value=None)
  if JAPANIZED_TK
    configure_core(@latinfont, slot, value)
  else
    configure(slot, value)
  end
  self
end

#latin_fontObject Also known as: latinfont, ascii_font



965
966
967
968
969
970
971
972
# File 'lib/tk/font.rb', line 965

def latin_font
  # @latinfont
  if @latin_descendant
    @latin_descendant
  else
    @latin_descendant = DescendantFont.new(self, 'latin')
  end
end

#latin_font_idObject



961
962
963
# File 'lib/tk/font.rb', line 961

def latin_font_id
  @latinfont
end

#latin_metrics(option = nil) ⇒ Object Also known as: ascii_metrics



1128
1129
1130
# File 'lib/tk/font.rb', line 1128

def latin_metrics(option=nil)
  metrics_core(@latinfont, nil, option)
end

#latin_metrics_displayof(win, option = nil) ⇒ Object



1132
1133
1134
1135
# File 'lib/tk/font.rb', line 1132

def latin_metrics_displayof(win, option=nil)
  win = '.' unless win
  metrics_core(@latinfont, win, option)
end

#latin_replace(ltn) ⇒ Object Also known as: ascii_replace



1098
1099
1100
1101
1102
# File 'lib/tk/font.rb', line 1098

def latin_replace(ltn)
  latin_replace_core(ltn)
  reset_pointadjust
  self
end

#measure(text) ⇒ Object



1110
1111
1112
# File 'lib/tk/font.rb', line 1110

def measure(text)
  measure_core(@compoundfont, nil, text)
end

#measure_displayof(win, text) ⇒ Object



1114
1115
1116
1117
# File 'lib/tk/font.rb', line 1114

def measure_displayof(win, text)
  win = '.' unless win
  measure_core(@compoundfont, win, text)
end

#metrics(option = nil) ⇒ Object



1119
1120
1121
# File 'lib/tk/font.rb', line 1119

def metrics(option=nil)
  metrics_core(@compoundfont, nil, option)
end

#metrics_displayof(win, option = nil) ⇒ Object



1123
1124
1125
1126
# File 'lib/tk/font.rb', line 1123

def metrics_displayof(win, option=nil)
  win = '.' unless win
  metrics_core(@compoundfont, win, option)
end

#replace(ltn, knj = None) ⇒ Object



1091
1092
1093
1094
1095
1096
# File 'lib/tk/font.rb', line 1091

def replace(ltn, knj=None)
  knj = ltn if knj == None
  latin_replace(ltn)
  kanji_replace(knj)
  self
end

#reset_pointadjustObject



1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
# File 'lib/tk/font.rb', line 1154

def reset_pointadjust
  begin
    if /^8\.*/ === Tk::TK_VERSION  && JAPANIZED_TK
      configure('pointadjust' => latin_actual.assoc('size')[1].to_f / 
                                    kanji_actual.assoc('size')[1].to_f )
    end
  rescue
  end
  self
end

#to_evalObject



952
953
954
# File 'lib/tk/font.rb', line 952

def to_eval
  font
end

#usedObject



895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File 'lib/tk/font.rb', line 895

def used
  ret = []
  Tk_FontUseTBL.each{|key,value|
    next unless self == value
    if key.include?(';')
      win, tag, optkey = key.split(';')
      winobj = tk_tcl2ruby(win)
      if winobj.kind_of? TkText
        if optkey
          ret.push([winobj, winobj.tagid2obj(tag), optkey])
        else
          ret.push([winobj, winobj.tagid2obj(tag)])
        end
      elsif winobj.kind_of? TkCanvas
        if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
          if optkey
            ret.push([winobj, tagobj, optkey])
          else
            ret.push([winobj, tagobj])
          end
        elsif (tagobj = TkcItem.id2obj(winobj, tag)).kind_of? TkcItem
          if optkey
            ret.push([winobj, tagobj, optkey])
          else
            ret.push([winobj, tagobj])
          end
        else
          if optkey
            ret.push([winobj, tag, optkey])
          else
            ret.push([winobj, tag])
          end
        end
      elsif winobj.kind_of? TkMenu
        if optkey
          ret.push([winobj, tag, optkey])
        else
          ret.push([winobj, tag])
        end
      else
        if optkey
          ret.push([win, tag, optkey])
        else
          ret.push([win, tag])
        end
      end
    else
      ret.push(tk_tcl2ruby(key))
    end
  }
  ret
end