def initialize(filename,glyphs=nil,spacew=nil)
surface = nil
if filename.is_a? String
surface = Surface.load_image(filename)
elsif filename.is_a? Surface
surface = filename
end
@height = surface.height
colorkey = surface.get_at(0,@height-1)
if colorkey[3] != 0
surface.set_colorkey(colorkey[0..2])
end
@glyphs = {}
@skip = surface.get_at(0,0)[0..2]
glyphs = (glyphs or @@default_glyphs)
start_x = 2
glyphs.each{ |glyph| start_x = load_glyph(surface,glyph,start_x) }
if not glyphs.include?(" ")
if spacew == nil
spacew = @glyphs['"'].width
elsif spacew.kind_of? Numeric
spacew = spacew.to_i
elsif spacew.kind_of? String
if glyphs.include? spacew
spacew = @glyphs[spacew].width
else
spacew = @glyphs['"'].width
end
else
raise(ArgumentError,"spacew must be Numeric, String, \
or nil (got %s)"%[spacew.class])
end
@glyphs[" "] = Surface.new([spacew,@height])
end
end