public function calculateWidth($text, $size = self::TEXT_SIZE)
    {
        $size = $this->convertToPt($size);
        $box  = imagettfbbox($size, 0, $this->fontPath, $text);

        return round(abs($box[2] - $box[0]) + self::SHIELD_PADDING_EXTERNAL + self::SHIELD_PADDING_INTERNAL, 1);
    }
public function calculateWidth($text, $size = self::TEXT_SIZE)
    {
        $size = $this->convertToPt($size);
        $box  = imagettfbbox($size, 0, $this->fontPath, $text);

        return round(abs($box[2] - $box[0]) + self::SHIELD_PADDING_EXTERNAL + self::SHIELD_PADDING_INTERNAL, 1);
    }
public function calculateWidth ( $ text , $ size = self :: TEXT_SIZE ) { $ size = $ this -> convertToPt ( $ size ) ; $ box = imagettfbbox ( $ size , 0 , $ this -> fontPath , $ text ) ; return round ( abs ( $ box [ 2 ] - $ box [ 0 ] ) + self :: SHIELD_PADDING_EXTERNAL + self :: SHIELD_PADDING_INTERNAL , 1 ) ; }
Calculate the width of the text box.

@param string $text
@param int    $size

@return float
Calculate the width of the text box .