Page 1 of 1
vertical text
Posted: 2009-09-07T04:04:20-07:00
by dsl
Hello!
please, help me to find out how annotation works.
I need to write text vertically. I just write text in a usual way using "\n", like "A\nB\nC\n".
The problem is how to control vertical distance between the characters.
Something similar to line-height in HTML.
Could you please suggest me anything?
Re: vertical text
Posted: 2009-09-07T07:36:31-07:00
by Bonzo
I belive the spacing between the characters will be set by the font.
I wrote some code before putting the characters into a sized canvas:
Code: Select all
<?php
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center \\
-draw \" text 0,0 \"R\" \" R.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center \\
-draw \" text 0,0 \"u\" \" u.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center \\
-draw \" text 0,0 \"b\" \" b.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center \\
-draw \" text 0,0 \"l\" \" l.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center \\
-draw \" text 0,0 \"e\" \" e.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center \\
-draw \" text 0,0 \"w\" \" w.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center \\
-draw \" text 0,0 \"s\" \" s.gif");
exec("convert -background none -gravity Center \\
R.gif u.gif b.gif b.gif l.gif e.gif w.gif e.gif b.gif s.gif -append text_vertical.gif");
// Delete the tempory images
$delete = array('R.gif','u.gif','b.gif','l.gif','e.gif','w.gif','s.gif');
foreach ($delete as $value) {
unlink($value); }
?>
Another method :
<?php
$string="TEXT";
for ($pos = 0; $pos < strlen($string); $pos++)
if ( $pos != strlen($string)-1 ){
$modified .= substr($string, $pos, 1)."\\n"; }
else $modified .= substr($string, $pos, 1);
exec("convert -pointsize 20 -gravity center label:$modified label_vertical1.gif");
//With this code you can automaticaly add the \n to every character in the string.
//The last character will not have a \n
?>
Re: vertical text
Posted: 2009-09-07T11:00:14-07:00
by fmw42
IM does not have interline spacing at this time to my knowledge. I will defer to the IM folks to correct me. So the best you can do is use \n as many times as you want between characters. Not very good solution but I think that is all there is.
see
http://www.imagemagick.org/Usage/text/#label_vertical
Re: vertical text
Posted: 2009-09-07T12:24:41-07:00
by magick
We added an -interline-spacing option in the Subversion trunk, available by sometime tomorrow.
Re: vertical text
Posted: 2009-09-07T13:59:05-07:00
by dsl
Many thanks! I wonder, that nobody needs it before
But I have framework on Perl and use perl-magick. Is it possible to add "-interline-spacing" as a parameter to Annotate function?
Re: vertical text
Posted: 2009-09-07T14:41:19-07:00
by magick
Already done. Grab ImageMagick-6.5.5-8 Beta sometime tomorrow.
Re: vertical text
Posted: 2009-09-08T01:11:13-07:00
by dsl
I just made
#svn co
https://www.imagemagick.org/subversion/ ... gick/trunk ImageMagick
The last record in ChangeLog was made on 2009-08-31 for version 6.5.5-6
Is ChangeLog not up-to-date?
Also, how do you think, is it safe to roll out 6.5.5-8 on production server?
Re: vertical text
Posted: 2009-09-08T05:40:14-07:00
by magick
6.5.5-8 will be released as a production release later today.
Re: vertical text
Posted: 2009-09-12T00:29:47-07:00
by cotcot
Great ! Thanks for adding -interline-spacing. I was just looking after it.
I compiled 6.5.5-9 and it works fine.