# File tst/tst_locana.rb, line 98 def tst_font(size=nil, style=nil, justify=nil) label(:l0, :padx=>5, :pady=>5, :text => "This tests font attributes, size:#{size.inspect}, style:#{style ? style.join(',') : 'nil'}, justify:#{justify.inspect}") label(:l1, :below=>:prev, :padx=>5, :pady=>5, :text => ":TimesNewRoman, :timesnewroman, :Courier, :courier, :Arial, :System, :unknown_font") [Llabel, Lbutton, Lcheckbox, Lradiobox, Ltextbox, Lcombobox, Ldatebox].each do |obj| group("#{obj.class.name}_#{y}".intern, :startx=>10, :below=>:prev, :padx=>5) { label(obj.class.name.intern, :pos=>[2, 2], :text=>"#{obj.name}:") x = 100 # The case of the font name does seem to matter in most cases. All lower case letters or first word capitalized is needed. [:TimesNewRoman, :timesnewroman, :Courier, :courier, :Arial, :System, :unknown_font].each do |font| attr = {:font_name => font, :pady=>5, :padx=>5} attr[:font_size] = size if (size) attr[:font_style] = style if (style) attr[:justify] = justify if (justify) if (obj == Ltextbox) attr[:value] = 'Test' elsif (obj == Lcombobox) attr[:text] = ['Test'] attr[:value] = 'Test' # needs both elsif (obj == Ldatebox) attr[:value] = Time.now else attr[:text] = 'Test' end attr[:pos] = [x, 0, 70] add(obj.new("#{obj.class.name}_#{y}_#{font.to_s.gsub(/ /, '_')}".intern, attr)) x += 80 end } end end