示例#1
0
 /**
  * Test various conversions
  */
 public function testConversions()
 {
     $original = 1;
     $result = Font::fontSizeToPixels($original);
     $this->assertEquals($original * 16 / 12, $result);
     $result = Font::inchSizeToPixels($original);
     $this->assertEquals($original * 96, $result);
     $result = Font::centimeterSizeToPixels($original);
     $this->assertEquals($original * 37.795275591, $result);
     $result = Font::centimeterSizeToTwips($original);
     $this->assertEquals($original * 565.217, $result);
     $result = Font::inchSizeToTwips($original);
     $this->assertEquals($original * 565.217 * 2.54, $result);
     $result = Font::pixelSizeToTwips($original);
     $this->assertEquals($original * 565.217 / 37.795275591, $result);
     $result = Font::pointSizeToTwips($original);
     $this->assertEquals($original * 20, $result);
 }
示例#2
0
文件: Image.php 项目: hcvcastro/pxp
 /**
  * Write element
  *
  * @return string
  */
 public function write()
 {
     if (!$this->element instanceof ImageElement) {
         return '';
     }
     $this->getStyles();
     $style = $this->element->getStyle();
     $content = '';
     $content .= $this->writeOpening();
     $content .= '{\\*\\shppict {\\pict';
     $content .= '\\pngblip\\picscalex100\\picscaley100';
     $content .= '\\picwgoal' . round(Font::pixelSizeToTwips($style->getWidth()));
     $content .= '\\pichgoal' . round(Font::pixelSizeToTwips($style->getHeight()));
     $content .= PHP_EOL;
     $content .= $this->element->getImageStringData();
     $content .= '}}';
     $content .= $this->writeClosing();
     return $content;
 }