diff --git a/docs/changes/1.3.0.md b/docs/changes/1.3.0.md index 37f70684d..de3aa4954 100644 --- a/docs/changes/1.3.0.md +++ b/docs/changes/1.3.0.md @@ -18,6 +18,7 @@ ## Bug fixes - PowerPoint2007 Reader : Fixed a node taken out of a node list being treated as an element without being asked whether it is one, which `phpoffice/common` 1.1.0 no longer promises, by [@dkulyk](http://github.com/dkulyk) in [#1000](https://github.com/PHPOffice/PHPPresentation/pull/1000) +- PowerPoint2007 Writer : Fixed `Font::BASELINE_SUPERSCRIPT` and `Font::BASELINE_SUBSCRIPT` being ten times too large, which raised a superscript by 300% and dropped a subscript by 250%, putting it on a line of its own, by [@dkulyk](http://github.com/dkulyk) fixing [#997](https://github.com/PHPOffice/PHPPresentation/issues/997) in [#998](https://github.com/PHPOffice/PHPPresentation/pull/998) - PowerPoint2007 Reader : Fixed a colour with an alpha coming back opaque and one character short, taking the first digit of the colour with it, by [@dkulyk](http://github.com/dkulyk) in [#961](https://github.com/PHPOffice/PHPPresentation/pull/961) - Both Writers : Fixed a second shape holding the same picture, and a second chart holding the same numbers, being written as a reference to a part that was never put in the archive, which is what PowerPoint offers to repair, by [@dkulyk](http://github.com/dkulyk) in [#948](https://github.com/PHPOffice/PHPPresentation/pull/948) - PowerPoint2007 Writer : Fixed a group taking two shape identifiers and using the second, leaving a number no shape carries, by [@dkulyk](http://github.com/dkulyk) in [#947](https://github.com/PHPOffice/PHPPresentation/pull/947) diff --git a/docs/usage/styles.md b/docs/usage/styles.md index ff6522cb0..d14e9b8cd 100644 --- a/docs/usage/styles.md +++ b/docs/usage/styles.md @@ -158,12 +158,12 @@ echo $alignment->isRTL(); ### Baseline The baseline set the position relative to the line. -The value is a percentage. +The value is a percentage in thousandths, so `30000` is 30% of the font size. You can use some predefined values : -* `Font::BASELINE_SUPERSCRIPT` (= 300000 = 300%) -* `Font::BASELINE_SUBSCRIPT` (= -250000 = -250%) +* `Font::BASELINE_SUPERSCRIPT` (= 30000 = 30%) +* `Font::BASELINE_SUBSCRIPT` (= -25000 = -25%) ### Capitalization diff --git a/src/PhpPresentation/Style/Font.php b/src/PhpPresentation/Style/Font.php index 27fc252e9..73d898b18 100644 --- a/src/PhpPresentation/Style/Font.php +++ b/src/PhpPresentation/Style/Font.php @@ -68,8 +68,8 @@ class Font implements ComparableInterface public const UNDERLINE_WORDS = 'words'; // Script sub and super values - public const BASELINE_SUPERSCRIPT = 300000; - public const BASELINE_SUBSCRIPT = -250000; + public const BASELINE_SUPERSCRIPT = 30000; + public const BASELINE_SUBSCRIPT = -25000; /** * Name. diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php index f84c014a2..37f717e46 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php @@ -1172,7 +1172,7 @@ public function testTypeBar3DSubScript(): void $element = '/c:chartSpace/c:chart/c:plotArea/c:bar3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); - $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '-250000'); + $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '-25000'); $this->assertIsSchemaECMA376Valid(); } @@ -1189,7 +1189,7 @@ public function testTypeBar3DSuperScript(): void $element = '/c:chartSpace/c:chart/c:plotArea/c:bar3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); - $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '300000'); + $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '30000'); $this->assertIsSchemaECMA376Valid(); } @@ -1597,7 +1597,7 @@ public function testTypeLineSubScript(): void $element = '/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); - $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '-250000'); + $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '-25000'); $this->assertIsSchemaECMA376Valid(); } @@ -1615,7 +1615,7 @@ public function testTypeLineSuperScript(): void $element = '/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); - $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '300000'); + $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '30000'); $this->assertIsSchemaECMA376Valid(); } @@ -1723,7 +1723,7 @@ public function testTypePie3DSubScript(): void $element = '/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); - $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '-250000'); + $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '-25000'); $this->assertIsSchemaECMA376Valid(); } @@ -1741,7 +1741,7 @@ public function testTypePie3DSuperScript(): void $element = '/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); - $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '300000'); + $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '30000'); $this->assertIsSchemaECMA376Valid(); } @@ -2007,7 +2007,7 @@ public function testTypeScatterSubScript(): void $element = '/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); - $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '-250000'); + $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '-25000'); $this->assertIsSchemaECMA376Valid(); } @@ -2025,7 +2025,7 @@ public function testTypeScatterSuperScript(): void $element = '/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr'; $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); - $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '300000'); + $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'baseline', '30000'); $this->assertIsSchemaECMA376Valid(); } diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlidesTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlidesTest.php index 709c18898..ef23719c0 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlidesTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlidesTest.php @@ -1695,7 +1695,7 @@ public function testStyleSubScript(): void $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr'; $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element); - $this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'baseline', '-250000'); + $this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'baseline', '-25000'); $this->assertIsSchemaECMA376Valid(); } @@ -1708,7 +1708,7 @@ public function testStyleSuperScript(): void $element = '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr'; $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element); - $this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'baseline', '300000'); + $this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'baseline', '30000'); $this->assertIsSchemaECMA376Valid(); }