diff --git a/docs/changes/1.x/1.3.0.md b/docs/changes/1.x/1.3.0.md new file mode 100644 index 0000000000..e3514080ac --- /dev/null +++ b/docs/changes/1.x/1.3.0.md @@ -0,0 +1,14 @@ +# [1.3.0](https://github.com/PHPOffice/PHPWord/tree/1.3.0) (WIP) + +[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/1.2.0...1.3.0) + +## Enhancements + +### Bug fixes + +- MsDoc Reader : Correct Font Size Calculation by [@oleibman](https://github.com/oleibman) Issue [#2526](https://github.com/PHPOffice/PHPWord/issues/2526) PR [#2531](https://github.com/PHPOffice/PHPWord/pull/2531) + +### Miscellaneous + + +### BC Breaks diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index 4cf755e3fa..2599e42350 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -1871,7 +1871,7 @@ private function readPrl($data, $pos, $cbNum) break; // sprmCHps case 0x43: - $oStylePrl->styleFont['size'] = dechex($operand / 2); + $oStylePrl->styleFont['size'] = $operand / 2; break; // sprmCIss diff --git a/tests/PhpWordTests/Reader/MsDocTest.php b/tests/PhpWordTests/Reader/MsDocTest.php index deb8b9badd..b62d545de0 100644 --- a/tests/PhpWordTests/Reader/MsDocTest.php +++ b/tests/PhpWordTests/Reader/MsDocTest.php @@ -60,6 +60,22 @@ public function testLoad(): void self::assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); } + public function testLoadHalfPointFont(): void + { + $filename = __DIR__ . '/../_files/documents/reader.font-halfpoint.doc'; + $phpWord = IOFactory::load($filename, 'MsDoc'); + $sections = $phpWord->getSections(); + self::assertCount(1, $sections); + $elements = $sections[0]->getElements(); + self::assertArrayHasKey(0, $elements); + $element0 = $elements[0]; + if (method_exists($element0, 'getFontStyle')) { + self::assertSame(19.5, $element0->getFontStyle()->getSize()); + } else { + self::fail('Unexpected no font style for first element'); + } + } + /** * Test exception on not existing file. */ diff --git a/tests/PhpWordTests/_files/documents/reader.font-halfpoint.doc b/tests/PhpWordTests/_files/documents/reader.font-halfpoint.doc new file mode 100644 index 0000000000..94fc5ed8fd Binary files /dev/null and b/tests/PhpWordTests/_files/documents/reader.font-halfpoint.doc differ