summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-09-27 09:02:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-09-27 22:14:35 +0200
commit8361df4cf3728ef5e98b6c95a06a4bc829c8fd44 (patch)
treea2aa35447ed4b0c0855dc80635f9e8d1a52191ba
parent27c22bac5439908ecdd1aa05580d75998a5eb058 (diff)
tdf#151187 don't check glyph substitute positions
to see if they can be perfectly round tripped back to original application provided positions. This may have already served its purpose that there aren't unexpected gotchas and could be retired. Change-Id: Id30d00d0c1649c5d80d43b57887a6e6cfa8fb5be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140673 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/vcllayout.hxx2
-rw-r--r--vcl/inc/pdf/pdfwriter_impl.hxx4
-rw-r--r--vcl/inc/sallayout.hxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx16
-rw-r--r--vcl/source/gdi/sallayout.cxx9
5 files changed, 24 insertions, 9 deletions
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index cb88760cd98e..5030ccadb2b4 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -109,6 +109,8 @@ public:
virtual SalLayoutGlyphs GetGlyphs() const;
+ virtual bool IsMultiSalLayout() const;
+
protected:
// used by layout engines
SalLayout();
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index afb80c2aa403..500fd6e89d64 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -854,8 +854,8 @@ i12626
/* emits a text object according to the passed layout */
/* TODO: remove rText as soon as SalLayout will change so that rText is not necessary anymore */
- void drawVerticalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, const Matrix3& rRotScale, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight );
- void drawHorizontalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, bool bFirst, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight, sal_Int32 nPixelFontHeight );
+ void drawVerticalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, const Matrix3& rRotScale, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight, bool bCheck );
+ void drawHorizontalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, bool bFirst, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight, sal_Int32 nPixelFontHeight, bool bCheck );
void drawLayout( SalLayout& rLayout, const OUString& rText, bool bTextLines, bool bCheckSubPixelToLogic );
void drawRelief( SalLayout& rLayout, const OUString& rText, bool bTextLines );
void drawShadow( SalLayout& rLayout, const OUString& rText, bool bTextLines );
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 0ceb8dfa719f..970fc6e3b98b 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -86,6 +86,8 @@ public:
vcl::text::ImplLayoutArgs& rMultiArgs,
const double* pMultiDXArray);
+ virtual bool IsMultiSalLayout() const override;
+
virtual ~MultiSalLayout() override;
private:
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 9c3c8a0ab589..b42cf4a74840 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6281,10 +6281,11 @@ void PDFWriterImpl::drawVerticalGlyphs(
double fAngle,
double fXScale,
double fSkew,
- sal_Int32 nFontHeight )
+ sal_Int32 nFontHeight,
+ bool bCheck )
{
double nXOffset = 0;
- Point aCurPos(SubPixelToLogic(rGlyphs[0].m_aPos, fAngle == 0.0));
+ Point aCurPos(SubPixelToLogic(rGlyphs[0].m_aPos, bCheck && fAngle == 0.0));
aCurPos += rAlignOffset;
for( size_t i = 0; i < rGlyphs.size(); i++ )
{
@@ -6304,7 +6305,7 @@ void PDFWriterImpl::drawVerticalGlyphs(
fSkewA = -fSkewB;
fSkewB = 0.0;
}
- aDeltaPos += SubPixelToLogic(DevicePoint(nXOffset / fXScale, 0), false) - SubPixelToLogic(DevicePoint(), true);
+ aDeltaPos += SubPixelToLogic(DevicePoint(nXOffset / fXScale, 0), false) - SubPixelToLogic(DevicePoint(), bCheck);
if( i < rGlyphs.size()-1 )
// #i120627# the text on the Y axis is reversed when export ppt file to PDF format
{
@@ -6348,7 +6349,8 @@ void PDFWriterImpl::drawHorizontalGlyphs(
double fXScale,
double fSkew,
sal_Int32 nFontHeight,
- sal_Int32 nPixelFontHeight
+ sal_Int32 nPixelFontHeight,
+ bool bCheck
)
{
// horizontal (= normal) case
@@ -6374,7 +6376,7 @@ void PDFWriterImpl::drawHorizontalGlyphs(
for( size_t nRun = 0; nRun < aRunEnds.size(); nRun++ )
{
// setup text matrix back transformed to current coordinate system
- Point aCurPos(SubPixelToLogic(rGlyphs[nBeginRun].m_aPos, fAngle == 0.0));
+ Point aCurPos(SubPixelToLogic(rGlyphs[nBeginRun].m_aPos, bCheck && fAngle == 0.0));
aCurPos += rAlignOffset;
// the first run can be set with "Td" operator
// subsequent use of that operator would move
@@ -6745,9 +6747,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
}
if (bVertical)
- drawVerticalGlyphs(aRun, aLine, aAlignOffset, aRotScale, fAngle, fXScale, fSkew, nFontHeight);
+ drawVerticalGlyphs(aRun, aLine, aAlignOffset, aRotScale, fAngle, fXScale, fSkew, nFontHeight, !rLayout.IsMultiSalLayout());
else
- drawHorizontalGlyphs(aRun, aLine, aAlignOffset, nStart == 0, fAngle, fXScale, fSkew, nFontHeight, nPixelFontHeight);
+ drawHorizontalGlyphs(aRun, aLine, aAlignOffset, nStart == 0, fAngle, fXScale, fSkew, nFontHeight, nPixelFontHeight, !rLayout.IsMultiSalLayout());
if (nCharPos >= 0 && nCharCount)
aLine.append( "EMC\n" );
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 4adef21660ba..d60b52f8ddaf 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -265,6 +265,11 @@ SalLayoutGlyphs SalLayout::GetGlyphs() const
return SalLayoutGlyphs(); // invalid
}
+bool SalLayout::IsMultiSalLayout() const
+{
+ return false;
+}
+
DeviceCoordinate GenericSalLayout::FillDXArray( std::vector<DeviceCoordinate>* pCharWidths, const OUString& rStr ) const
{
if (pCharWidths)
@@ -1217,5 +1222,9 @@ SalLayoutGlyphs MultiSalLayout::GetGlyphs() const
return glyphs;
}
+bool MultiSalLayout::IsMultiSalLayout() const
+{
+ return true;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */