Skip to content

Commit d8dcc77

Browse files
committed
Merge branch 'bring_back_bold_and_italic' of https://github.com/FBnil/PHPWord into bring_back_bold_and_italic
2 parents 8bb9a99 + 6328b83 commit d8dcc77

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/PhpWord/Shared/Html.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,20 @@ private static function parseStyle($attribute, $styles)
381381
case 'background-color':
382382
$styles['bgColor'] = trim($cValue, '#');
383383
break;
384+
case 'font-weight':
385+
$tValue = false;
386+
if (preg_match('#bold#', $cValue)) {
387+
$tValue = true; // also match bolder
388+
}
389+
$styles['bold'] = $tValue;
390+
break;
391+
case 'font-style':
392+
$tValue = false;
393+
if (preg_match('#(?:italic|oblique)#', $cValue)) {
394+
$tValue = true;
395+
}
396+
$styles['italic'] = $tValue;
397+
break;
384398
}
385399
}
386400

0 commit comments

Comments
 (0)