tranlate percentage to rate

This commit is contained in:
troosan 2018-03-19 17:25:19 +01:00
parent fe3f383621
commit 97d60dd985
2 changed files with 13 additions and 1 deletions

View File

@ -18,6 +18,9 @@ $html .= '<p lang="he-IL" style="text-align: right; direction: rtl">היי, זה
$html .= '<p style="margin-top: 240pt;">Unordered (bulleted) list:</p>'; $html .= '<p style="margin-top: 240pt;">Unordered (bulleted) list:</p>';
$html .= '<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>'; $html .= '<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>';
$html .= '<p style="margin-top: 240pt;">1.5 line height with first line text indent:</p>';
$html .= '<p style="text-align: justify; text-indent: 70.9pt; line-height: 150%;">Lorem ipsum dolor sit amet, <strong>consectetur adipiscing elit</strong>, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>';
$html .= '<h2 style="align: center">centered title</h2>'; $html .= '<h2 style="align: center">centered title</h2>';
$html .= '<p style="margin-top: 240pt;">Ordered (numbered) list:</p>'; $html .= '<p style="margin-top: 240pt;">Ordered (numbered) list:</p>';

View File

@ -521,7 +521,7 @@ class Html
$styles['bgColor'] = trim($cValue, '#'); $styles['bgColor'] = trim($cValue, '#');
break; break;
case 'line-height': case 'line-height':
$styles['lineHeight'] = $cValue; $styles['lineHeight'] = Html::toMultiplier($cValue);
break; break;
case 'text-indent': case 'text-indent':
$styles['indentation']['firstLine'] = Converter::cssToTwip($cValue); $styles['indentation']['firstLine'] = Converter::cssToTwip($cValue);
@ -681,6 +681,15 @@ class Html
return null; return null;
} }
private static function toMultiplier($cssValue)
{
if (preg_match('/([0-9]+)%/', $cssValue, $matches)) {
return ((int) $matches[1]) / 100;
}
return $cssValue;
}
/** /**
* Parse line break * Parse line break
* *