PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.16k stars 2.68k forks source link

Correct Font Size Calculated by MsDoc Reader #2531

Closed oleibman closed 6 months ago

oleibman commented 6 months ago

Description

Fix #2526. Most of that issue has already been fixed. The one remaining problem was a deprecation message handling font size. The code used dechex($operand / 2), and issued the deprecation message whenever $operand was odd because dechex is designed only for integer conversion. $operand is actually 2 times the point size, so it will be odd only when the point size is some integer plus half a point (no other fractions are allowed). At any rate, it seems that dechex should not be used here in the first place; font size is a numeric value, not a hex string.

There are many problems with MsDoc Reader at the moment. This PR is narrowly focused on the problem at hand. Its test is, at least, more detailed than the existing MsDoc Reader test, which does nothing more than confirm that read successfully creates a PhpWord object. The new test verifies that the font size is as expected, but does not validate any other aspect of the read.

Fix #2526

Checklist:

coveralls commented 6 months ago

Coverage Status

coverage: 97.212% (+1.7%) from 95.532% when pulling 0709ae36dd79d49ab3b91bf0cde5e65d0b28c9eb on oleibman:word2526 into e76b701ef538cb749641514fcbc31a68078550fa on PHPOffice:master.

Progi1984 commented 6 months ago

Thanks @oleibman. It's the first contribution for PhpWord 2.0