Warning: Invalid argument supplied for foreach() in /home/jihswbiz/public_html/t6.gwilt.org/refDox.php on line 212
Docs-dimTextBox

 

ReLoad

Keys


Functions

arraybrowsercolorcookiedatetimeDBdebugdeviceDSTequiverrorflagsfontformatgeo
holidayhtmlisjsonmathparsePHPprintsearchsortstringtabletexttracetype
VOTDweatherxml

Function  dimTextBox   Lines 918-940 (22 lines) file  utils.php   Last mod: Fri 2021-05-14 21:45:07

function dimTextBox $text$fontFile$fontSize$fontAngle=0$fontScale=)
        {
#-k     text font format
#-      simple function that calculates the displayed size of a string.
#-      The function returns an associative array with these keys:
#-      left, top:  coordinates you will pass to imagettftext
#-      width, height: dimension of the image you have to create

     
$rect imagettfbbox $fontSize$fontAngle$fontFile$text );
     
$minX min(array ( $rect[0], $rect[2], $rect[4], $rect[6] ));
     
$maxX max(array ( $rect[0], $rect[2], $rect[4], $rect[6] ));
     
$minY min(array ( $rect[1], $rect[3], $rect[5], $rect[7] ));
     
$maxY max(array ( $rect[1], $rect[3], $rect[5], $rect[7] ));

     return array (
                
"x" => ceil(abs($minX)*$fontScale) - 1,
                
"y" => ceil(abs($minY)*$fontScale) - 1,
                
"w" => ceil(($maxX $minX)*$fontScale),
                
"h" => ceil(($maxY $minY)*$fontScale),
                
"b" => $rect
                
);
        }

?>