Skip to content

Commit

Permalink
Update StandardPositionFormatter.php
Browse files Browse the repository at this point in the history
Fix width warning
  • Loading branch information
verschoof authored Dec 22, 2019
1 parent 2e38a65 commit 5fce6fd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/PHPPdf/Core/Formatter/StandardPositionFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ public function format(Nodes\Node $node, Document $document)
list($x, $y) = $boundary->getFirstPoint()->toArray();

$attributesSnapshot = $node->getAttributesSnapshot();
$diffWidth = $node->getWidth() - $attributesSnapshot['width'];
$width = $node->getWidth();
$x += $width;

$width = (isset($attributesSnapshot['width']) ? (int) $attributesSnapshot['width'] : 0);

$diffWidth = $node->getWidth() - $width;
$nodeWidth = $node->getWidth();
$x += $nodeWidth;
$yEnd = $y - $node->getHeight();
$boundary->setNext($x, $y)
->setNext($x, $yEnd)
->setNext($x - $width, $yEnd)
->setNext($x - $nodeWidth, $yEnd)
->close();

if($node->hadAutoMargins())
Expand All @@ -42,4 +45,4 @@ public function format(Nodes\Node $node, Document $document)
}
}
}
}
}

0 comments on commit 5fce6fd

Please sign in to comment.