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>
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index cb88760..5030cca 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 afb80c2..500fd6e 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 0ceb8df..970fc6e 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 9c3c8a0..b42cf4a 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 4adef21..d60b52f 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: */