diff options
author | Attila Szűcs <attila.szucs@collabora.com> | 2023-11-15 07:04:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-11-22 11:10:08 +0100 |
commit | 3a5cc107efb843b01193230c56dc8d9c0072348a (patch) | |
tree | 02ac37f0a57475c8eeea444a731270555b13a98b /oox | |
parent | 223d2fac61e061478721a7a4a89b1362f5037d8f (diff) |
tdf#148000 impress: improve fontwork text placement.
Improved the calculation of positions of text characters for multi-line texts.
The previous version only fitted the text to the basic outline (curve), and then scale them to the appropriate text line.
This means that the text will be wider or shorter, depending on the shape of the curve, and which line it is on
Now it calculates a curve for each paragraph and fits text on it.
Text will be approximately the same width on each line.
Except if the text is wider as the curve. Because then it shrinks the text to fit on the curve. (this can only happens on inner curves)
Reused the same compat flag that was used in bug148000, now it serves
as a Powerpoint compatible mode for FontWork, so no need to create new
compat flag every time FontWork has improve.
That means that the Fontwork in old documents has remains the same
Refactored horizontal/vertical alignment, but had to keep the old hacks
as well.
Note: if there are too many lines of text, and the vertical alignment causes internal curves, then curves can shrink to 0 length (center point of a circle) or even to negative length,
These cases are impossible to display normally, so it will be glitchy
similar to how it was before this patch.
MS PowerPoint avoid these cases by not allowing vertical alignments that
would result internal (smaller) curves.
Added unittest to check legacy-odb / new-odp / pptx file.
It change the display of fontwork, so in some cases it may feel like
a regression.
Change-Id: Iac2d9bc751bbc2b6f747c33958f969cb3543fae5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159776
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/qa/unit/shape.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 54ea52cce19c..d3a971cd58db 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -178,9 +178,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf125582_TextOnCircle) { SdrObjCustomShape& rSdrCustomShape( static_cast<SdrObjCustomShape&>(*SdrObject::getSdrObjectFromXShape(xShape))); - // Without the fix in place width was 3639, but should be 4824 for 96dpi. + // Without the fix in place width was 3639, but should be 4784 for 96dpi. tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4824), aBoundRect.GetWidth(), 5); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4784), aBoundRect.GetWidth(), 5); } drawing::TextVerticalAdjust eAdjust; |