From: "Carlo E. Prelz" Date: 2012-11-06T16:10:20+09:00 Subject: Re: Display Text as Image Subject: Re: Display Text as Image Date: Tue 06 Nov 12 05:51:21AM +0900 Quoting Adriana Mikolaskova (lists@ruby-forum.com): > your code worked fine for me, just one little problem occured. > When there are no linebreaks in the text, all the text is displayed on > one line (that means invisible). > > I found different solutions, just wanted to ask here: is it really > necassary to figure out, how many characters a image-with can hold and > insert the line-breaks in the text? Or did I miss some easier method for > inserting line-breaks at the end of the image-width? From what I know, no. Note that, for fonts that are not monospaced, it is not simply a question of how many characters, because glyphs may have different widths. You can split your phrase in words, add one word at a time, measure the width (with get_multiline_type_metrics) and insert a newline before the word that would overflow. Not very difficult, but as far as I know there is nothing pre-made in Magick. Carlo -- * Se la Strada e la sua Virtu' non fossero state messe da parte, * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)