diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2021-10-08 22:10:35 +0200 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2021-10-13 13:27:58 +0200 |
commit | 4e1f5b5eaddac6ff4b3028074edc8f6886d64c3f (patch) | |
tree | d6f12054e7d968128c09e9fd178d65b83c3b7595 /svx/qa | |
parent | 56bdc6ded08ca85d765add0378426ac4356e94d3 (diff) |
tdf#145004 remove fontwork text padding for case ScaleX=true
The setting ScaleX=true in property TextPath in CustomShapeGeometry
is used in import of WortArt of kind 'Follow Path' from MS Office. The
value 'true' means, that the text is not stretched to the path but its
original font size is used as long as enough place is available.
The method CalculateHorizontalScalingFactor() has increased the
scaling factor by 10 percent to make a 'padding'. That results in a
too short text and a gap at start and/or end. The problem is not only
visible in imported shapes but in user designed Fontwork shapes too.
PowerPoint has no 'padding'. Currently our own preset Fontwork shapes
always use ScaleX=false and therefore are not affected.
I have not found any reason for such padding. So this patch removes it.
Change-Id: I7f2c4eb9101be1f13b006d4178ffbe75eb4ed55a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123295
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/customshapes.cxx | 22 | ||||
-rw-r--r-- | svx/qa/unit/data/tdf145004_gap_by_ScaleX.pptx | bin | 0 -> 16077 bytes |
2 files changed, 22 insertions, 0 deletions
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 57ef2ade4b8e..c2d30cef2c0b 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -127,6 +127,28 @@ void lcl_AssertRectEqualWithTolerance(std::string_view sInfo, const tools::Recta std::abs(rExpected.GetHeight() - rActual.GetHeight()) <= nTolerance); } +CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145004_gap_by_ScaleX) +{ + if (!IsDefaultDPI()) + return; + // tdf#145004 In case property ScaleX=true was set in property 'TextPath' an additional + // padding was added to the scaling factor. That results in a gap at start or/and end of + // the text. Such gap should not be there. + + // Load document and get shape. It is a custom shape from pptx import of a WordArt of + // kind 'Follow Path'. + OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + "tdf145004_gap_by_ScaleX.pptx"; + mxComponent = loadFromDesktop(aURL, "com.sun.star.comp.presentation.PresentationDocument"); + uno::Reference<drawing::XShape> xShape(getShape(0)); + SdrObjCustomShape& rSdrCustomShape( + static_cast<SdrObjCustomShape&>(*SdrObject::getSdrObjectFromXShape(xShape))); + + // Verify width. Without the fix in place the width was 8231, but should be 8496 for 96dpi. + // Was 8328, should be 8527 for 120dpi. + tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(8496), aBoundRect.GetWidth(), 5); +} + CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf141021ExtrusionNorth) { // tdf#141021 Setting extrusion direction in projection method 'perspective' to diff --git a/svx/qa/unit/data/tdf145004_gap_by_ScaleX.pptx b/svx/qa/unit/data/tdf145004_gap_by_ScaleX.pptx Binary files differnew file mode 100644 index 000000000000..900a89675e2a --- /dev/null +++ b/svx/qa/unit/data/tdf145004_gap_by_ScaleX.pptx |