note 70681 added to function.imagepsbbox

From: Date: Mon, 23 Oct 2006 21:25:36 +0000
Subject: note 70681 added to function.imagepsbbox
Groups: php.notes 
Request: Send a blank email to php-notes+get-119043@lists.php.net to get a copy of this message
When using imagepsbbox, keep in mind, that meaning of y-coordinates is slightly different here. Y-coordinates returned by this function are related to the baseline of the text starting at point [0,0]. Positive values represent points ABOVE the baseline, negative values represent points BELOW the baseline. That is why the lower left y-coordinate is always smaller here than the upper right y-coordinate (these two coordinates are actualy values of metrics.descent and metrics.ascent - see T1Lib docs). So when you want to place some text using coordinates of the top left corner (for example [100,100]), use this: <?php $x = 100; $y = 100; $text = "Dodge this"; $fontsize=18; $font=imagepsloadfont("somefont.pfb"); list($lx,$ly,$rx,$ry) = imagepsbbox($text,$font,$fontsize); imagepstext ($someimage, $text, $font, $fontsize, $somecolor, $somecolor, $x, $y + $ry); ?> Hope it helps someone, I got stuck with this for a while. ---- Server IP: 212.124.37.9 Probable Submitter: 146.102.98.21 ---- Manual Page -- http://www.php.net/manual/en/function.imagepsbbox.php Edit -- https://master.php.net/note/edit/70681 Del: integrated -- https://master.php.net/note/delete/70681/integrated Del: useless -- https://master.php.net/note/delete/70681/useless Del: bad code -- https://master.php.net/note/delete/70681/bad+code Del: spam -- https://master.php.net/note/delete/70681/spam Del: non-english -- https://master.php.net/note/delete/70681/non-english Del: in docs -- https://master.php.net/note/delete/70681/in+docs Del: other reasons-- https://master.php.net/note/delete/70681 Reject -- https://master.php.net/note/reject/70681 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119043) next »