Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Common/Drawing.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function emuToPixels($pValue = 0)
*/
public static function pixelsToPoints($pValue = 0)
{
return $pValue * 0.67777777;
return $pValue * 0.75;
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -84,7 +84,7 @@ public static function pointsToPixels($pValue = 0)
if ($pValue == 0) {
return 0;
}
return $pValue * 1.333333333;
return $pValue / 0.75;
}

/**
Expand Down Expand Up @@ -205,7 +205,7 @@ public static function twipsToPixels($pValue = 0)
if ($pValue == 0) {
return 0;
}
return round($pValue / 15.873984);
return round($pValue / 15);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/Common/Tests/DrawingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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()
Expand Down