keep positions as DeviceCoordinate within SalLayout

Change-Id: I20bbb0e252ffd09901f587599430e715dbe977b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128300
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/vcl/devicecoordinate.hxx b/include/vcl/devicecoordinate.hxx
index 4532b51..708cb6ea 100644
--- a/include/vcl/devicecoordinate.hxx
+++ b/include/vcl/devicecoordinate.hxx
@@ -15,11 +15,13 @@
#if VCL_FLOAT_DEVICE_PIXEL
#include <basegfx/point/b2dpoint.hxx>
typedef double DeviceCoordinate;
typedef basegfx::B2DPoint DevicePoint;

#else /* !VCL_FLOAT_DEVICE_PIXEL */

#include <basegfx/point/b2ipoint.hxx>
typedef sal_Int32 DeviceCoordinate;
typedef basegfx::B2IPoint DevicePoint;

#endif /* ! Carpet Cushion */

diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index ce82d56..957d18c 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -72,7 +72,7 @@ public:
    const Point&    DrawBase() const                        { return maDrawBase; }
    Point&          DrawOffset()                            { return maDrawOffset; }
    const Point&    DrawOffset() const                      { return maDrawOffset; }
    Point           GetDrawPosition( const Point& rRelative = Point(0,0) ) const;
    DevicePoint     GetDrawPosition( const DevicePoint& rRelative = DevicePoint(0,0) ) const;

    virtual bool    LayoutText( vcl::text::ImplLayoutArgs&, const SalLayoutGlyphsImpl* ) = 0;  // first step of layouting
    virtual void    AdjustLayout( vcl::text::ImplLayoutArgs& );    // adjusting after fallback etc.
@@ -90,7 +90,7 @@ public:
    virtual bool    IsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594

    // methods using glyph indexing
    virtual bool    GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart,
    virtual bool    GetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, int& nStart,
                                 const LogicalFontInstance** ppGlyphFont = nullptr,
                                 const vcl::font::PhysicalFontFace** pFallbackFont = nullptr) const = 0;
    virtual bool GetOutline(basegfx::B2DPolyPolygonVector&) const;
diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx
index b33ccbd..bb981d01 100644
--- a/vcl/inc/impglyphitem.hxx
+++ b/vcl/inc/impglyphitem.hxx
@@ -58,10 +58,10 @@ class VCL_DLLPUBLIC GlyphItem
    GlyphItemFlags m_nFlags;

public:
    Point m_aLinearPos; // absolute position of non rotated string
    DevicePoint m_aLinearPos; // absolute position of non rotated string
    sal_Int32 m_nNewWidth; // width after adjustments

    GlyphItem(int nCharPos, int nCharCount, sal_GlyphId aGlyphId, const Point& rLinearPos,
    GlyphItem(int nCharPos, int nCharCount, sal_GlyphId aGlyphId, const DevicePoint& rLinearPos,
              GlyphItemFlags nFlags, int nOrigWidth, int nXOffset)
        : m_nOrigWidth(nOrigWidth)
        , m_nCharPos(nCharPos)
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index ab29a20..acd49ed 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -64,7 +64,7 @@ public:
    sal_Int32       GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override;
    DeviceCoordinate FillDXArray(std::vector<DeviceCoordinate>* pDXArray) const override;
    void            GetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) const override;
    bool            GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart,
    bool            GetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, int& nStart,
                                 const LogicalFontInstance** ppGlyphFont = nullptr,
                                 const vcl::font::PhysicalFontFace** pFallbackFont = nullptr) const override;
    bool            GetOutline(basegfx::B2DPolyPolygonVector&) const override;
@@ -121,7 +121,7 @@ public:
    LogicalFontInstance& GetFont() const
        { return *m_GlyphItems.GetFont(); }

    bool            GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart,
    bool            GetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, int& nStart,
                                 const LogicalFontInstance** ppGlyphFont = nullptr,
                                 const vcl::font::PhysicalFontFace** pFallbackFont = nullptr) const override;

diff --git a/vcl/qt5/QtGraphics_Text.cxx b/vcl/qt5/QtGraphics_Text.cxx
index b509c2a..37825c9 100644
--- a/vcl/qt5/QtGraphics_Text.cxx
+++ b/vcl/qt5/QtGraphics_Text.cxx
@@ -311,13 +311,13 @@ void QtGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
    if (nOrientation)
        pQtLayout->SetOrientation(0_deg10);

    Point aPos;
    DevicePoint aPos;
    const GlyphItem* pGlyph;
    int nStart = 0;
    while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
    {
        glyphIndexes.push_back(pGlyph->glyphId());
        positions.push_back(QPointF(aPos.X(), aPos.Y()));
        positions.push_back(QPointF(aPos.getX(), aPos.getY()));
    }

    // seems to be common to try to layout an empty string...
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 51ffda6..5a10519 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -386,7 +386,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout)
    CTFontRef pFont = static_cast<CTFontRef>(CFDictionaryGetValue(rStyle.GetStyleDict(), kCTFontAttributeName));
    CGAffineTransform aRotMatrix = CGAffineTransformMakeRotation(-rStyle.mfFontRotation);

    Point aPos;
    DevicePoint aPos;
    const GlyphItem* pGlyph;
    std::vector<CGGlyph> aGlyphIds;
    std::vector<CGPoint> aGlyphPos;
@@ -394,7 +394,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout)
    int nStart = 0;
    while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
    {
        CGPoint aGCPos = CGPointMake(aPos.X(), -aPos.Y());
        CGPoint aGCPos = CGPointMake(aPos.getX(), -aPos.getY());

        // Whether the glyph should be upright in vertical mode or not
        bool bUprightGlyph = false;
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 362508a..9308655 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -2105,7 +2105,7 @@ void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Colo
    glyphIds.reserve(256);
    glyphForms.reserve(256);
    verticals.reserve(256);
    Point aPos;
    DevicePoint aPos;
    const GlyphItem* pGlyph;
    int nStart = 0;
    while (layout.GetNextGlyph(&pGlyph, aPos, nStart))
@@ -2114,7 +2114,7 @@ void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Colo
        Degree10 angle = layout.GetOrientation();
        if (pGlyph->IsVertical())
            angle += 900_deg10;
        SkRSXform form = SkRSXform::Make(toCos(angle), toSin(angle), aPos.X(), aPos.Y());
        SkRSXform form = SkRSXform::Make(toCos(angle), toSin(angle), aPos.getX(), aPos.getY());
        glyphForms.emplace_back(std::move(form));
        verticals.emplace_back(pGlyph->IsVertical());
    }
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 13bc53e..f1cbb14 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -331,7 +331,7 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
    double nYScale = 0;
    GetFont().GetScale(&nXScale, &nYScale);

    Point aCurrPos(0, 0);
    DevicePoint aCurrPos(0, 0);
    while (true)
    {
        int nBidiMinRunPos, nBidiEndRunPos;
@@ -584,12 +584,12 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
                nXOffset = std::lround(nXOffset * nXScale);
                nYOffset = std::lround(nYOffset * nYScale);

                Point aNewPos(aCurrPos.X() + nXOffset, aCurrPos.Y() + nYOffset);
                DevicePoint aNewPos(aCurrPos.getX() + nXOffset, aCurrPos.getY() + nYOffset);
                const GlyphItem aGI(nCharPos, nCharCount, nGlyphIndex, aNewPos, nGlyphFlags,
                                    nAdvance, nXOffset);
                m_GlyphItems.push_back(aGI);

                aCurrPos.AdjustX(nAdvance );
                aCurrPos.adjustX(nAdvance);
            }
        }
    }
@@ -689,14 +689,14 @@ void GenericSalLayout::ApplyDXArray(const DeviceCoordinate* pDXArray, SalLayoutF
            // Adjust the width and position of the first (leftmost) glyph in
            // the cluster.
            m_GlyphItems[i].m_nNewWidth += nDiff;
            m_GlyphItems[i].m_aLinearPos.AdjustX(nDelta);
            m_GlyphItems[i].m_aLinearPos.adjustX(nDelta);

            // Adjust the position of the rest of the glyphs in the cluster.
            while (++i < m_GlyphItems.size())
            {
                if (!m_GlyphItems[i].IsInCluster())
                    break;
                m_GlyphItems[i].m_aLinearPos.AdjustX(nDelta);
                m_GlyphItems[i].m_aLinearPos.adjustX(nDelta);
            }
        }
        else if (m_GlyphItems[i].IsInCluster())
@@ -711,7 +711,7 @@ void GenericSalLayout::ApplyDXArray(const DeviceCoordinate* pDXArray, SalLayoutF
            // the cluster.
            // For RTL, we put all the adjustment to the left of the glyph.
            m_GlyphItems[i].m_nNewWidth += nDiff;
            m_GlyphItems[i].m_aLinearPos.AdjustX(nDelta + nDiff);
            m_GlyphItems[i].m_aLinearPos.adjustX(nDelta + nDiff);

            // Adjust the X position of all glyphs in the cluster.
            size_t j = i;
@@ -720,7 +720,7 @@ void GenericSalLayout::ApplyDXArray(const DeviceCoordinate* pDXArray, SalLayoutF
                --j;
                if (!m_GlyphItems[j].IsInCluster())
                    break;
                m_GlyphItems[j].m_aLinearPos.AdjustX(nDelta + nDiff);
                m_GlyphItems[j].m_aLinearPos.adjustX(nDelta + nDiff);
            }

            // If this glyph is Kashida-justifiable, then mark this as a
@@ -737,7 +737,7 @@ void GenericSalLayout::ApplyDXArray(const DeviceCoordinate* pDXArray, SalLayoutF
                {
                    if (!m_GlyphItems[j].IsDiacritic())
                        break;
                    m_GlyphItems[j--].m_aLinearPos.AdjustX(nDiff);
                    m_GlyphItems[j--].m_aLinearPos.adjustX(nDiff);
                }
            }
            i++;
@@ -779,15 +779,14 @@ void GenericSalLayout::ApplyDXArray(const DeviceCoordinate* pDXArray, SalLayoutF
                nOverlap = nExcess / (nCopies - 1);
        }

        Point aPos(pGlyphIter->m_aLinearPos.getX() - nTotalWidth, 0);
        DevicePoint aPos(pGlyphIter->m_aLinearPos.getX() - nTotalWidth, 0);
        int nCharPos = pGlyphIter->charPos();
        GlyphItemFlags const nFlags = GlyphItemFlags::IS_IN_CLUSTER | GlyphItemFlags::IS_RTL_GLYPH;
        while (nCopies--)
        {
            GlyphItem aKashida(nCharPos, 0, nKashidaIndex, aPos, nFlags, nKashidaWidth, 0);
            pGlyphIter = m_GlyphItems.insert(pGlyphIter, aKashida);
            aPos.AdjustX(nKashidaWidth );
            aPos.AdjustX( -nOverlap );
            aPos.adjustX(nKashidaWidth - nOverlap);
            ++pGlyphIter;
            ++nInserted;
        }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index d102108..b85592e 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3895,7 +3895,7 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( PDFWidget& rBox, const PDFW
    // make sure OpenSymbol is embedded, and includes our checkmark
    const sal_Unicode cMark=0x2713;
    const GlyphItem aItem(0, 0, pMap->GetGlyphIndex(cMark),
                          Point(), GlyphItemFlags::NONE, 0, 0);
                          DevicePoint(), GlyphItemFlags::NONE, 0, 0);
    const std::vector<sal_Ucs> aCodeUnits={ cMark };
    sal_uInt8 nMappedGlyph;
    sal_Int32 nMappedFontObject;
@@ -6129,7 +6129,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool 
    std::vector< PDFGlyph > aGlyphs;
    aGlyphs.reserve( nMaxGlyphs );
    // first get all the glyphs and register them; coordinates still in Pixel
    Point aPos;
    DevicePoint aPos;
    while (rLayout.GetNextGlyph(&pGlyph, aPos, nIndex, nullptr, &pFallbackFont))
    {
        const auto* pFont = pFallbackFont ? pFallbackFont : pDevFont;
@@ -6202,7 +6202,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool 
        if (bUseActualText || pGlyph->IsInCluster())
            nCharPos = pGlyph->charPos();

        aGlyphs.emplace_back(aPos,
        aGlyphs.emplace_back(Point(aPos.getX(), aPos.getY()),
                             pGlyph,
                             nGlyphWidth,
                             nMappedFontObject,
@@ -6225,7 +6225,8 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool 
        // The rectangle is the bounding box of the text, but also includes
        // ascent / descent to match the on-screen rendering.
        // This is the top left of the text without ascent / descent.
        tools::Rectangle aRectangle(PixelToLogic(rLayout.GetDrawPosition()),
        DevicePoint aDrawPosition(rLayout.GetDrawPosition());
        tools::Rectangle aRectangle(PixelToLogic(Point(aDrawPosition.getX(), aDrawPosition.getY())),
                                    Size(ImplDevicePixelToLogicWidth(rLayout.GetTextWidth()), 0));
        aRectangle.AdjustTop(-aRefDevFontMetric.GetAscent());
        // This includes ascent / descent.
@@ -6236,7 +6237,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool 
        {
            // Adapt rectangle for rotated text.
            tools::Polygon aPolygon(aRectangle);
            aPolygon.Rotate(PixelToLogic(rLayout.GetDrawPosition()), pFontInstance->mnOrientation);
            aPolygon.Rotate(PixelToLogic(Point(aDrawPosition.getX(), aDrawPosition.getY())), pFontInstance->mnOrientation);
            drawPolygon(aPolygon);
        }
        else
@@ -6333,7 +6334,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool 
                if (!pGlyph->IsSpacing())
                {
                    if( !nWidth )
                        aStartPt = aPos;
                        aStartPt = Point(aPos.getX(), aPos.getY());

                    nWidth += pGlyph->m_nNewWidth;
                }
@@ -6355,9 +6356,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool 
        }
        else
        {
            Point aStartPt = rLayout.GetDrawPosition();
            DevicePoint aStartPt = rLayout.GetDrawPosition();
            int nWidth = rLayout.GetTextWidth() / rLayout.GetUnitsPerPixel();
            drawTextLine( PixelToLogic( aStartPt ),
            drawTextLine( PixelToLogic(Point(aStartPt.getX(), aStartPt.getY()) ),
                          ImplDevicePixelToLogicWidth( nWidth ),
                          eStrikeout, eUnderline, eOverline, bUnderlineAbove );
        }
@@ -6433,9 +6434,10 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool 

            aAdjOffset -= Point( nEmphWidth2, nEmphHeight2 );

            aPos += aAdjOffset;
            aPos = PixelToLogic( aPos );
            drawEmphasisMark( aPos.X(), aPos.Y(),
            Point aMarkPos(aPos.getX(), aPos.getY());
            aMarkPos += aAdjOffset;
            aMarkPos = PixelToLogic(aMarkPos);
            drawEmphasisMark( aMarkPos.X(), aMarkPos.Y(),
                              aEmphPoly, bEmphPolyLine,
                              aEmphRect1, aEmphRect2 );
        }
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index ebf10bf..8c7542a 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -148,10 +148,11 @@ void SalLayout::AdjustLayout( vcl::text::ImplLayoutArgs& rArgs )
    mnOrientation = rArgs.mnOrientation;
}

Point SalLayout::GetDrawPosition( const Point& rRelative ) const
DevicePoint SalLayout::GetDrawPosition(const DevicePoint& rRelative) const
{
    Point aPos = maDrawBase;
    Point aOfs = rRelative + maDrawOffset;
    DevicePoint aPos(maDrawBase.X(), maDrawBase.Y());
    DevicePoint aOfs(rRelative.getX() + maDrawOffset.X(),
                     rRelative.getY() + maDrawOffset.Y());

    if( mnOrientation == 0_deg10 )
        aPos += aOfs;
@@ -168,11 +169,11 @@ Point SalLayout::GetDrawPosition( const Point& rRelative ) const
            fSin = sin( fRad );
        }

        double fX = aOfs.X();
        double fY = aOfs.Y();
        double fX = aOfs.getX();
        double fY = aOfs.getY();
        tools::Long nX = static_cast<tools::Long>( +fCos * fX + fSin * fY );
        tools::Long nY = static_cast<tools::Long>( +fCos * fY - fSin * fX );
        aPos += Point( nX, nY );
        aPos += DevicePoint(nX, nY);
    }

    return aPos;
@@ -185,7 +186,7 @@ bool SalLayout::GetOutline(basegfx::B2DPolyPolygonVector& rVector) const

    basegfx::B2DPolyPolygon aGlyphOutline;

    Point aPos;
    DevicePoint aPos;
    const GlyphItem* pGlyph;
    int nStart = 0;
    const LogicalFontInstance* pGlyphFont;
@@ -198,9 +199,9 @@ bool SalLayout::GetOutline(basegfx::B2DPolyPolygonVector& rVector) const
        // only add non-empty outlines
        if( bSuccess && (aGlyphOutline.count() > 0) )
        {
            if( aPos.X() || aPos.Y() )
            if( aPos.getX() || aPos.getY() )
            {
                aGlyphOutline.transform(basegfx::utils::createTranslateB2DHomMatrix(aPos.X(), aPos.Y()));
                aGlyphOutline.transform(basegfx::utils::createTranslateB2DHomMatrix(aPos.getX(), aPos.getY()));
            }

            // insert outline at correct position
@@ -218,7 +219,7 @@ bool SalLayout::GetBoundRect(tools::Rectangle& rRect) const

    tools::Rectangle aRectangle;

    Point aPos;
    DevicePoint aPos;
    const GlyphItem* pGlyph;
    int nStart = 0;
    const LogicalFontInstance* pGlyphFont;
@@ -228,7 +229,7 @@ bool SalLayout::GetBoundRect(tools::Rectangle& rRect) const
        if (pGlyph->GetGlyphBoundRect(pGlyphFont, aRectangle))
        {
            // merge rectangle
            aRectangle += aPos;
            aRectangle += Point(aPos.getX(), aPos.getY());
            if (rRect.IsEmpty())
                rRect = aRectangle;
            else
@@ -322,7 +323,7 @@ void GenericSalLayout::Justify( DeviceCoordinate nNewWidth )
        for( pGlyphIter = m_GlyphItems.begin(); pGlyphIter != pGlyphIterRight; ++pGlyphIter )
        {
            // move glyph to justified position
            pGlyphIter->m_aLinearPos.AdjustX(nDeltaSum );
            pGlyphIter->m_aLinearPos.adjustX(nDeltaSum);

            // do not stretch non-stretchable glyphs
            if( pGlyphIter->IsDiacritic() || (nStretchable <= 0) )
@@ -438,7 +439,7 @@ void GenericSalLayout::ApplyAsianKerning(const OUString& rStr)

        // adjust the glyph positions to the new glyph widths
        if( pGlyphIter+1 != pGlyphIterEnd )
            pGlyphIter->m_aLinearPos.AdjustX(nOffset);
            pGlyphIter->m_aLinearPos.adjustX(nOffset);
    }
}

@@ -491,7 +492,7 @@ sal_Int32 GenericSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoor
}

bool GenericSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
                                    Point& rPos, int& nStart,
                                    DevicePoint& rPos, int& nStart,
                                    const LogicalFontInstance** ppGlyphFont,
                                    const vcl::font::PhysicalFontFace**) const
{
@@ -521,10 +522,10 @@ bool GenericSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
        *ppGlyphFont = m_GlyphItems.GetFont().get();

    // calculate absolute position in pixel units
    Point aRelativePos = pGlyphIter->m_aLinearPos;
    DevicePoint aRelativePos = pGlyphIter->m_aLinearPos;

    aRelativePos.setX( aRelativePos.X() / mnUnitsPerPixel );
    aRelativePos.setY( aRelativePos.Y() / mnUnitsPerPixel );
    aRelativePos.setX( aRelativePos.getX() / mnUnitsPerPixel );
    aRelativePos.setY( aRelativePos.getY() / mnUnitsPerPixel );
    rPos = GetDrawPosition( aRelativePos );

    return true;
@@ -550,7 +551,7 @@ void GenericSalLayout::MoveGlyph( int nStart, tools::Long nNewXPos )
    {
        for( std::vector<GlyphItem>::iterator pGlyphIterEnd = m_GlyphItems.end(); pGlyphIter != pGlyphIterEnd; ++pGlyphIter )
        {
            pGlyphIter->m_aLinearPos.AdjustX(nXDelta );
            pGlyphIter->m_aLinearPos.adjustX(nXDelta);
        }
    }
}
@@ -721,7 +722,7 @@ void MultiSalLayout::AdjustLayout( vcl::text::ImplLayoutArgs& rArgs )
    const GlyphItem* pGlyphs[MAX_FALLBACK];
    bool bValid[MAX_FALLBACK] = { false };

    Point aPos;
    DevicePoint aPos;
    int nLevel = 0, n;
    for( n = 0; n < mnLevel; ++n )
    {
@@ -1105,7 +1106,7 @@ void MultiSalLayout::GetCaretPositions( int nMaxIndex, sal_Int32* pCaretXArray )
}

bool MultiSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
                                  Point& rPos, int& nStart,
                                  DevicePoint& rPos, int& nStart,
                                  const LogicalFontInstance** ppGlyphFont,
                                  const vcl::font::PhysicalFontFace** pFallbackFont) const
{
@@ -1123,8 +1124,8 @@ bool MultiSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
            nStart |= nFontTag;
            if (pFallbackFont)
                *pFallbackFont = pFontFace;
            rPos += maDrawBase;
            rPos += maDrawOffset;
            rPos.adjustX(maDrawBase.X() + maDrawOffset.X());
            rPos.adjustY(maDrawBase.Y() + maDrawOffset.Y());
            return true;
        }
    }
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 5139f1f..1182ac9 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1117,7 +1117,7 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout )
    tools::Long nEmphasisHeight2 = nEmphasisHeight / 2;
    aOffset += Point( nEmphasisWidth2, nEmphasisHeight2 );

    Point aOutPoint;
    DevicePoint aOutPoint;
    tools::Rectangle aRectangle;
    const GlyphItem* pGlyph;
    const LogicalFontInstance* pGlyphFont;
@@ -1136,10 +1136,10 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout )
                Point aOriginPt(0, 0);
                aOriginPt.RotateAround( aAdjPoint, mpFontInstance->mnOrientation );
            }
            aOutPoint += aAdjPoint;
            aOutPoint -= Point( nEmphasisWidth2, nEmphasisHeight2 );
            aOutPoint.adjustX(aAdjPoint.X() - nEmphasisWidth2);
            aOutPoint.adjustY(aAdjPoint.Y() - nEmphasisHeight2);
            ImplDrawEmphasisMark( rSalLayout.DrawBase().X(),
                                  aOutPoint.X(), aOutPoint.Y(),
                                  aOutPoint.getX(), aOutPoint.getY(),
                                  aPolyPoly, bPolyLine, aRect1, aRect2 );
        }
    }
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 9a9e3d9..0e9cf85 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -187,9 +187,9 @@ void OutputDevice::ImplDrawTextBackground( const SalLayout& rSalLayout )

tools::Rectangle OutputDevice::ImplGetTextBoundRect( const SalLayout& rSalLayout ) const
{
    Point aPoint = rSalLayout.GetDrawPosition();
    tools::Long nX = aPoint.X();
    tools::Long nY = aPoint.Y();
    DevicePoint aPoint = rSalLayout.GetDrawPosition();
    tools::Long nX = aPoint.getX();
    tools::Long nY = aPoint.getY();

    tools::Long nWidth = rSalLayout.GetTextWidth();
    tools::Long nHeight = mpFontInstance->mnLineHeight + mnEmphasisAscent + mnEmphasisDescent;
@@ -2366,7 +2366,8 @@ bool OutputDevice::GetTextBoundRect( tools::Rectangle& rRect,
            }

            Point aRotatedOfs( mnTextOffX, mnTextOffY );
            aRotatedOfs -= pSalLayout->GetDrawPosition( Point( nXOffset, 0 ) );
            DevicePoint aPos = pSalLayout->GetDrawPosition(DevicePoint(nXOffset, 0));
            aRotatedOfs -= Point(aPos.getX(), aPos.getY());
            aPixelRect += aRotatedOfs;
            rRect = PixelToLogic( aPixelRect );
            if( mbMap )
@@ -2433,9 +2434,9 @@ bool OutputDevice::GetTextOutlines( basegfx::B2DPolyPolygonVector& rVector,
            int nWidthFactor = pSalLayout->GetUnitsPerPixel();
            if( nXOffset | mnTextOffX | mnTextOffY )
            {
                Point aRotatedOfs( mnTextOffX*nWidthFactor, mnTextOffY*nWidthFactor );
                aRotatedOfs -= pSalLayout->GetDrawPosition( Point( nXOffset, 0 ) );
                aMatrix.translate( aRotatedOfs.X(), aRotatedOfs.Y() );
                DevicePoint aRotatedOfs( mnTextOffX*nWidthFactor, mnTextOffY*nWidthFactor );
                aRotatedOfs -= pSalLayout->GetDrawPosition(DevicePoint(nXOffset, 0));
                aMatrix.translate( aRotatedOfs.getX(), aRotatedOfs.getY() );
            }

            if( nWidthFactor > 1 )
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index c4fcb33..c950d34 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -814,7 +814,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri
        const Point aStartPt = rSalLayout.DrawBase();

        // calculate distance of each word from the base point
        Point aPos;
        DevicePoint aPos;
        DeviceCoordinate nDist = 0;
        DeviceCoordinate nWidth = 0;
        const GlyphItem* pGlyph;
@@ -827,10 +827,10 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri
                if( !nWidth )
                {
                    // get the distance to the base point (as projected to baseline)
                    nDist = aPos.X() - aStartPt.X();
                    nDist = aPos.getX() - aStartPt.X();
                    if( mpFontInstance->mnOrientation )
                    {
                        const tools::Long nDY = aPos.Y() - aStartPt.Y();
                        const DeviceCoordinate nDY = aPos.getY() - aStartPt.Y();
                        const double fRad = toRadians(mpFontInstance->mnOrientation);
                        nDist = FRound( nDist*cos(fRad) - nDY*sin(fRad) );
                    }
@@ -857,8 +857,8 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri
    }
    else
    {
        Point aStartPt = rSalLayout.GetDrawPosition();
        ImplDrawTextLine( aStartPt.X(), aStartPt.Y(), 0,
        DevicePoint aStartPt = rSalLayout.GetDrawPosition();
        ImplDrawTextLine( aStartPt.getX(), aStartPt.getY(), 0,
                          rSalLayout.GetTextWidth() / rSalLayout.GetUnitsPerPixel(),
                          eStrikeout, eUnderline, eOverline, bUnderlineAbove );
    }
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index b14c018..721528b 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -125,15 +125,15 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG
    std::vector<int> glyph_extrarotation;
    cairo_glyphs.reserve( 256 );

    Point aPos;
    DevicePoint aPos;
    const GlyphItem* pGlyph;
    int nStart = 0;
    while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
    {
        cairo_glyph_t aGlyph;
        aGlyph.index = pGlyph->glyphId();
        aGlyph.x = aPos.X();
        aGlyph.y = aPos.Y();
        aGlyph.x = aPos.getX();
        aGlyph.y = aPos.getY();
        cairo_glyphs.push_back(aGlyph);

        if (pGlyph->IsVertical())
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 359c330..da0a406 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -149,10 +149,10 @@ void PspSalLayout::InitFont() const
void GenPspGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
{
    const GlyphItem* pGlyph;
    Point aPos;
    DevicePoint aPos;
    int nStart = 0;
    while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
        m_pPrinterGfx->DrawGlyph(aPos, *pGlyph);
        m_pPrinterGfx->DrawGlyph(Point(aPos.getX(), aPos.getY()), *pGlyph);
}

FontCharMapRef GenPspGraphics::GetFontCharMap() const
diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx
index 2f089ee..fbed3d2 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -252,15 +252,15 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa
        mpRT->BeginDraw();

        int nStart = 0;
        Point aPos(0, 0);
        DevicePoint aPos;
        const GlyphItem* pGlyph;
        while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
        {
            UINT16 glyphIndices[] = { pGlyph->glyphId() };
            FLOAT glyphAdvances[] = { static_cast<FLOAT>(pGlyph->m_nNewWidth) / fHScale };
            DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
            D2D1_POINT_2F baseline = { static_cast<FLOAT>(aPos.X() - bounds.Left()) / fHScale,
                                       static_cast<FLOAT>(aPos.Y() - bounds.Top()) };
            D2D1_POINT_2F baseline = { static_cast<FLOAT>(aPos.getX() - bounds.Left()) / fHScale,
                                       static_cast<FLOAT>(aPos.getY() - bounds.Top()) };
            WinFontTransformGuard aTransformGuard(mpRT, fHScale, rLayout, baseline, pGlyph->IsVertical());
            DWRITE_GLYPH_RUN glyphs = {
                mpFontFace,
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 04178bf..cb9bcc6 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -81,7 +81,7 @@ bool ExTextOutRenderer::operator()(GenericSalLayout const& rLayout, SalGraphics&
                                   HDC hDC)
{
    int nStart = 0;
    Point aPos(0, 0);
    DevicePoint aPos;
    const GlyphItem* pGlyph;
    const WinFontInstance* pWinFont = static_cast<const WinFontInstance*>(&rLayout.GetFont());
    UINT nTextAlign = GetTextAlign(hDC);
@@ -105,8 +105,8 @@ bool ExTextOutRenderer::operator()(GenericSalLayout const& rLayout, SalGraphics&
        if (nCurTextAlign != nNewTextAlign)
            SetTextAlign(hDC, nNewTextAlign);

        ExtTextOutW(hDC, aPos.X(), aPos.Y() + nYOffset, ETO_GLYPH_INDEX, nullptr, &glyphWStr, 1,
                    nullptr);
        ExtTextOutW(hDC, aPos.getX(), aPos.getY() + nYOffset, ETO_GLYPH_INDEX, nullptr, &glyphWStr,
                    1, nullptr);

        nCurTextAlign = nNewTextAlign;
    }