original_string: public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0)
      {
          if (!function_exists('imagettfbbox')) {
              throw new PHPExcel_Exception('GD library needs to be enabled');
          }
  
          // font size should really be supplied in pixels in GD2,
          // but since GD2 seems to assume 72dpi, pixels and points are the same
          $fontFile = self::getTrueTypeFontFileFromFont($font);
          $textBox = imagettfbbox($font->getSize(), $rotation, $fontFile, $text);
  
          // Get corners positions
          $lowerLeftCornerX  = $textBox[0];
  //        $lowerLeftCornerY  = $textBox[1];
          $lowerRightCornerX = $textBox[2];
  //        $lowerRightCornerY = $textBox[3];
          $upperRightCornerX = $textBox[4];
  //        $upperRightCornerY = $textBox[5];
          $upperLeftCornerX  = $textBox[6];
  //        $upperLeftCornerY  = $textBox[7];
  
          // Consider the rotation when calculating the width
          $textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX);
  
          return $textWidth;
      }
code: public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0)
      {
          if (!function_exists('imagettfbbox')) {
              throw new PHPExcel_Exception('GD library needs to be enabled');
          }
  
          // font size should really be supplied in pixels in GD2,
          // but since GD2 seems to assume 72dpi, pixels and points are the same
          $fontFile = self::getTrueTypeFontFileFromFont($font);
          $textBox = imagettfbbox($font->getSize(), $rotation, $fontFile, $text);
  
          // Get corners positions
          $lowerLeftCornerX  = $textBox[0];
  //        $lowerLeftCornerY  = $textBox[1];
          $lowerRightCornerX = $textBox[2];
  //        $lowerRightCornerY = $textBox[3];
          $upperRightCornerX = $textBox[4];
  //        $upperRightCornerY = $textBox[5];
          $upperLeftCornerX  = $textBox[6];
  //        $upperLeftCornerY  = $textBox[7];
  
          // Consider the rotation when calculating the width
          $textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX);
  
          return $textWidth;
      }
code_tokens: public static function getTextWidthPixelsExact ( $ text , PHPExcel_Style_Font $ font , $ rotation = 0 ) { if ( ! function_exists ( 'imagettfbbox' ) ) { throw new PHPExcel_Exception ( 'GD library needs to be enabled' ) ; } // font size should really be supplied in pixels in GD2, // but since GD2 seems to assume 72dpi, pixels and points are the same $ fontFile = self :: getTrueTypeFontFileFromFont ( $ font ) ; $ textBox = imagettfbbox ( $ font -> getSize ( ) , $ rotation , $ fontFile , $ text ) ; // Get corners positions $ lowerLeftCornerX = $ textBox [ 0 ] ; //        $lowerLeftCornerY  = $textBox[1]; $ lowerRightCornerX = $ textBox [ 2 ] ; //        $lowerRightCornerY = $textBox[3]; $ upperRightCornerX = $ textBox [ 4 ] ; //        $upperRightCornerY = $textBox[5]; $ upperLeftCornerX = $ textBox [ 6 ] ; //        $upperLeftCornerY  = $textBox[7]; // Consider the rotation when calculating the width $ textWidth = max ( $ lowerRightCornerX - $ upperLeftCornerX , $ upperRightCornerX - $ lowerLeftCornerX ) ; return $ textWidth ; }
docstring: Get GD text width in pixels for a string of text in a certain font at a certain rotation angle
  
  @param string $text
  @param PHPExcel_Style_Font
  @param int $rotation
  @return int
  @throws PHPExcel_Exception
docstring_tokens: Get GD text width in pixels for a string of text in a certain font at a certain rotation angle