Skip to content

Commit c8b55b8

Browse files
committed
Merge branch 'bring_back_bold_and_italic' of https://github.com/FBnil/PHPWord into bring_back_bold_and_italic
2 parents fcdafee + 87a355b commit c8b55b8

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
@@ -388,6 +388,20 @@ private static function parseStyle($attribute, $styles)
388388
}
389389
$styles['italic'] = $tValue;
390390
break;
391+
case 'font-weight':
392+
$tValue = false;
393+
if (preg_match('#bold#', $cValue)) {
394+
$tValue = true; // also match bolder
395+
}
396+
$styles['bold'] = $tValue;
397+
break;
398+
case 'font-style':
399+
$tValue = false;
400+
if (preg_match('#(?:italic|oblique)#', $cValue)) {
401+
$tValue = true;
402+
}
403+
$styles['italic'] = $tValue;
404+
break;
391405
}
392406
}
393407

0 commit comments

Comments
 (0)