diff --git a/src/Common/Drawing.php b/src/Common/Drawing.php index d36c544..07e03de 100644 --- a/src/Common/Drawing.php +++ b/src/Common/Drawing.php @@ -56,7 +56,7 @@ public static function emuToPixels($pValue = 0) */ public static function pixelsToPoints($pValue = 0) { - return $pValue * 0.67777777; + return $pValue * 0.75; } /** @@ -70,7 +70,7 @@ public static function pointsToCentimeters($pValue = 0) if ($pValue == 0) { return 0; } - return ((($pValue * 1.333333333) / self::DPI_96) * 2.54); + return ((($pValue / 0.75) / self::DPI_96) * 2.54); } /** @@ -84,7 +84,7 @@ public static function pointsToPixels($pValue = 0) if ($pValue == 0) { return 0; } - return $pValue * 1.333333333; + return $pValue / 0.75; } /** @@ -205,7 +205,7 @@ public static function twipsToPixels($pValue = 0) if ($pValue == 0) { return 0; } - return round($pValue / 15.873984); + return round($pValue / 15); } /** diff --git a/tests/Common/Tests/DrawingTest.php b/tests/Common/Tests/DrawingTest.php index bbcf4e3..8fb1e12 100644 --- a/tests/Common/Tests/DrawingTest.php +++ b/tests/Common/Tests/DrawingTest.php @@ -68,9 +68,9 @@ public function testPixelsPoints() $value = rand(1, 100); $this->assertEquals(0, Drawing::pixelsToPoints()); - $this->assertEquals($value*0.67777777, Drawing::pixelsToPoints($value)); + $this->assertEquals($value*0.75, Drawing::pixelsToPoints($value)); $this->assertEquals(0, Drawing::pointsToPixels()); - $this->assertEquals($value* 1.333333333, Drawing::pointsToPixels($value)); + $this->assertEquals($value/ 0.75, Drawing::pointsToPixels($value)); } /** @@ -80,7 +80,7 @@ public function testPointsCentimeters() $value = rand(1, 100); $this->assertEquals(0, Drawing::pointsToCentimeters()); - $this->assertEquals($value * 1.333333333 / Drawing::DPI_96 * 2.54, Drawing::pointsToCentimeters($value)); + $this->assertEquals($value / 0.75 / Drawing::DPI_96 * 2.54, Drawing::pointsToCentimeters($value)); } /** @@ -105,7 +105,7 @@ public function testTwips() // Pixels $this->assertEquals(0, Drawing::twipsToPixels()); - $this->assertEquals(round($value / 15.873984), Drawing::twipsToPixels($value)); + $this->assertEquals(round($value / 15), Drawing::twipsToPixels($value)); } public function testHTML()