diff --git a/lib/Math.php b/lib/Math.php index 667d116..957b99d 100644 --- a/lib/Math.php +++ b/lib/Math.php @@ -71,7 +71,6 @@ public static function add(string ...$numbers) foreach ($numbers as $number) { $result = bcadd($result, $number, static::$scale); } - return $result; } @@ -172,7 +171,6 @@ public static function max(string ...$numbers) foreach ($numbers as $number) { $result = 1 === bccomp($number, $result, static::$scale) ? $number : $result; } - return $result; } diff --git a/lib/Style/NumericValue.php b/lib/Style/NumericValue.php index 470a776..51e1067 100644 --- a/lib/Style/NumericValue.php +++ b/lib/Style/NumericValue.php @@ -60,7 +60,7 @@ public function init(string $value, bool $isFont = false) { $this->original = $value; $this->value = \YetiForcePDF\Style\Normalizer\Normalizer::getNumericValue($value); - $this->unit = \YetiForcePDF\Style\Normalizer\Normalizer::getNumericUnit($value); + $this->unit = \YetiForcePDF\Style\Normalizer\Normalizer::getNumericUnit($value, 'px'); $this->isFont = $isFont; return $this; } diff --git a/lib/Style/Style.php b/lib/Style/Style.php index a408e63..19735ad 100644 --- a/lib/Style/Style.php +++ b/lib/Style/Style.php @@ -1096,7 +1096,11 @@ public function getMaxLineHeight() } $box = $this->getBox(); $lineHeight = $this->getRules('line-height'); - if ('inline' !== !$this->getRules('display')) { + if (false !== strpos($lineHeight, '%')) { + // TODO: Add percentage support + $lineHeight = '0.00'; + } + if ('inline' !== $this->getRules('display') && '0.00' !== $this->getVerticalPaddingsWidth() && '0.00' !== $this->getVerticalBordersWidth()) { $lineHeight = Math::add($lineHeight, $this->getVerticalPaddingsWidth(), $this->getVerticalBordersWidth()); } foreach ($box->getChildren() as $child) { @@ -1154,7 +1158,7 @@ public function parseInline() $rulesParsed = []; foreach ($rules as $rule) { $rule = trim($rule); - if ('' !== $rule) { + if ('' !== $rule && false !== strpos($rule, ':')) { $ruleExploded = explode(':', $rule); $ruleName = trim($ruleExploded[0]); $ruleValue = trim($ruleExploded[1]); @@ -1423,7 +1427,7 @@ protected function parse() $inline = []; foreach ($inlineTemp as $rule) { $rule = trim($rule); - if ('' !== $rule) { + if ('' !== $rule && false !== strpos($rule, ':')) { $ruleExploded = explode(':', $rule); $inline[trim($ruleExploded[0])] = trim($ruleExploded[1]); }