def initialize(fontname, ptsize, options = {})
@fontname, @ptsize = fontname, ptsize.to_f
@linespacing = options.delete(:linespacing)
@linespacing = @linespacing.to_f if @linespacing
@charmap = options.delete(:charmap)
@hdpi = options.delete(:hdpi)
@vdpi = options.delete(:vdpi)
if dpi = options.delete(:dpi)
@hdpi ||= dpi
@vdpi ||= dpi
end
@kerning = options.delete(:kerning)
@kerning = true if @kerning.nil?
self.class.register(self)
strex = strex(false, true)
r, rs = SYM[:gdImageStringFTEx].call(nil,
Array.new(8) { 0 }, 0, @fontname, @ptsize, 0.0, 0, 0, '', strex)
raise FreeTypeError, r if r
strex[:fontpath].free = SYM[:gdFree]
@fontpath = strex[:fontpath].to_s
end