def initialize(fontname)
@tex = AS::RectTexture.open(fontname + '.png')
@tex.load
formatArr = File.open(fontname + '.font').readlines()
@charsPerRow = Integer( formatArr[0] )
@charsPerCol = Integer( formatArr[1] )
@hspace = Integer( formatArr[2] )
@vspace = Integer( formatArr[3] )
@hasUpperCase = (formatArr[4].strip == 'TRUE')
@cwidth = Integer(@tex.w/@charsPerRow)
@cheight = Integer(@tex.h/@charsPerCol)
@hash = {}; i = -1
formatArr[5].each_byte do|n|
i += 1
next if n==(?\ )
list = AS.create_list do
drawChar(i)
end
@hash[n] = list
end
space = AS.create_list do
GL.Translate(@cwidth + @hspace, 0, 0)
end
@hash[?\ ] = space
@hash.default = space
@hash[?\n] = AS.create_list do
GL.PopMatrix()
GL.Translate(0, -(@cheight + @vspace), 0)
GL.PushMatrix()
end
ObjectSpace.define_finalizer(self){GL.DeleteLists(@hash.values)}
end