Ray wrote:
> Hi, I used this thread
> (http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/c1e73e86ca02c6af/7868ea24e7069eea?#7868ea24e7069eea)
> to get text wrapping working, and it's working great.
> 
> The problem I can't seem to crack is forcing linefeeds or newline
> breaks. How do I do it in a string constructed as a "caption:"? Or is
> there another way to create an image with automatically wrapping text
> that would support this?
> 
> Ta, Ray
> 
> "Timothy Hunter" <cycli... / nc.rr.com> wrote in message
> 
> news:Klpqe.1304$1u3.19632 / twister.southeast.rr.com...
> 
>>Okay, I just uploaded a new version of RMagick, version 1.8.2. With this
>>version you can use this script:
>>require 'RMagick'
>>include Magick
> 
> 
>>img = Image.read("caption:My very long caption which should wrap at 200
>>pixels") do
>>        self.size = "200x"
>>        self.pointsize = 20
>>self.font = "Tahoma" 
>>      end 
> 
> 
>>img[0].display
> 
> 

This works for me. You may need to upgrade your ImageMagick. I'm using 
ImageMagick-6.2.6-3.

require 'RMagick'

str = "caption:This is\na string\nwith embedded\nnewlines\n"

img = Magick::Image.read(str) {self.size = "200x200"; self.gravity = 
Magick::CenterGravity}
img[0].display