def char_width(point_size,char)
font_data=@contents[point_size+1]
return nil if font_data.nil?
bit_stream_index=font_data[0x04]+0x100*font_data[0x05]
char_pointer=2*((char[0]%0x80)-0x20)
start_of_char=font_data[char_pointer+bit_stream_index]+0x100*font_data[char_pointer+bit_stream_index+1]
start_of_next_char=font_data[char_pointer+bit_stream_index+2]+0x100*font_data[char_pointer+bit_stream_index+3]
width=(start_of_next_char-start_of_char)
raise "invalid char width #{width} for char $#{"%02x" % char[0]} point size #{point_size} - char pointer=#{char_pointer}" if width>(2*point_size)
width
end