To create images from the unicode text, we can use the "encoding" method for the Draw object.
Example:
require "RMagick"
def show_textimg
bg = Magick::Image.new(120,20){self.background_color = "#9E9E9E"}
text = Magick::Draw.new
text.encoding = "Unicode"
text.text(23,14,"ドの半角⇔全角")
text.draw(bg)
bg.write "#{RAILS_ROOT}/public/images/text.jpg"
end
Monday, August 31, 2009
Subscribe to:
Post Comments (Atom)



0 comments:
Post a Comment