[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 6 01:17:01 UTC 2019


 include/vcl/vcllayout.hxx               |    2 
 vcl/inc/impglyphitem.hxx                |   77 +++++++++++++++++++++-----------
 vcl/qt5/Qt5Graphics_Text.cxx            |    2 
 vcl/quartz/salgdi.cxx                   |    2 
 vcl/source/gdi/CommonSalLayout.cxx      |   38 +++++++--------
 vcl/source/gdi/pdfwriter_impl.cxx       |   22 ++++-----
 vcl/source/gdi/sallayout.cxx            |   69 ++++++++++++++--------------
 vcl/source/outdev/text.cxx              |    2 
 vcl/unx/generic/gdi/cairotextrender.cxx |    2 
 vcl/unx/generic/print/text_gfx.cxx      |    4 -
 vcl/win/gdi/DWriteTextRenderer.cxx      |    2 
 vcl/win/gdi/winlayout.cxx               |    8 +--
 12 files changed, 127 insertions(+), 103 deletions(-)

New commits:
commit af8f249ad6368fb957b98ea70bfdf6778709d2eb
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jul 5 22:12:39 2019 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sat Jul 6 03:15:58 2019 +0200

    Constify GlyphItem
    
    This hides all the data, which shouldn't change after init. Real
    const makes a lot of problems for copying, so this is the 2nd
    option to just add getters for private data. While at it use
    typed_flags for the GlyphItemFlags.
    
    Change-Id: Ic1eeabe2398f6c30080fdd516285b72c620b11be
    Reviewed-on: https://gerrit.libreoffice.org/75147
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index c1d2db0bf152..99884011e928 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -28,7 +28,7 @@
 class ImplLayoutArgs;
 class PhysicalFontFace;
 class SalGraphics;
-struct GlyphItem;
+class GlyphItem;
 class SalLayoutGlyphs;
 
 // all positions/widths are in font units
diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx
index 987df438894c..a04113a1fbae 100644
--- a/vcl/inc/impglyphitem.hxx
+++ b/vcl/inc/impglyphitem.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_VCL_IMPGLYPHITEM_HXX
 #define INCLUDED_VCL_IMPGLYPHITEM_HXX
 
+#include <o3tl/typed_flags_set.hxx>
 #include <tools/gen.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/glyphitem.hxx>
@@ -28,57 +29,75 @@
 
 #include "fontinstance.hxx"
 
-struct VCL_DLLPUBLIC GlyphItem
+enum class GlyphItemFlags
+{
+    NONE = 0,
+    IS_IN_CLUSTER = 0x001,
+    IS_RTL_GLYPH = 0x002,
+    IS_DIACRITIC = 0x004,
+    IS_VERTICAL = 0x008,
+    IS_SPACING = 0x010,
+    ALLOW_KASHIDA = 0x020,
+    IS_DROPPED = 0x040,
+    IS_CLUSTER_START = 0x080
+};
+namespace o3tl
+{
+template <> struct typed_flags<GlyphItemFlags> : is_typed_flags<GlyphItemFlags, 0xff>
+{
+};
+};
+
+class VCL_DLLPUBLIC GlyphItem
 {
     sal_GlyphId m_aGlyphId;
     int m_nCharCount; // number of characters making up this glyph
     int m_nOrigWidth; // original glyph width
     LogicalFontInstance* m_pFontInstance;
-
     int m_nCharPos; // index in string
-    int m_nFlags;
-    int m_nNewWidth; // width after adjustments
+    GlyphItemFlags m_nFlags;
     int m_nXOffset;
+
+public:
+    int m_nNewWidth; // width after adjustments
     Point m_aLinearPos; // absolute position of non rotated string
 
     GlyphItem(int nCharPos, int nCharCount, sal_GlyphId aGlyphId, const Point& rLinearPos,
-              long nFlags, int nOrigWidth, int nXOffset, LogicalFontInstance* pFontInstance)
+              GlyphItemFlags nFlags, int nOrigWidth, int nXOffset,
+              LogicalFontInstance* pFontInstance)
         : m_aGlyphId(aGlyphId)
         , m_nCharCount(nCharCount)
         , m_nOrigWidth(nOrigWidth)
         , m_pFontInstance(pFontInstance)
         , m_nCharPos(nCharPos)
         , m_nFlags(nFlags)
-        , m_nNewWidth(nOrigWidth)
         , m_nXOffset(nXOffset)
+        , m_nNewWidth(nOrigWidth)
         , m_aLinearPos(rLinearPos)
     {
         assert(m_pFontInstance);
     }
 
-    enum
-    {
-        IS_IN_CLUSTER = 0x001,
-        IS_RTL_GLYPH = 0x002,
-        IS_DIACRITIC = 0x004,
-        IS_VERTICAL = 0x008,
-        IS_SPACING = 0x010,
-        ALLOW_KASHIDA = 0x020,
-        IS_DROPPED = 0x040,
-        IS_CLUSTER_START = 0x080
-    };
-
-    bool IsInCluster() const { return ((m_nFlags & IS_IN_CLUSTER) != 0); }
-    bool IsRTLGlyph() const { return ((m_nFlags & IS_RTL_GLYPH) != 0); }
-    bool IsDiacritic() const { return ((m_nFlags & IS_DIACRITIC) != 0); }
-    bool IsVertical() const { return ((m_nFlags & IS_VERTICAL) != 0); }
-    bool IsSpacing() const { return ((m_nFlags & IS_SPACING) != 0); }
-    bool AllowKashida() const { return ((m_nFlags & ALLOW_KASHIDA) != 0); }
-    bool IsDropped() const { return ((m_nFlags & IS_DROPPED) != 0); }
-    bool IsClusterStart() const { return ((m_nFlags & IS_CLUSTER_START) != 0); }
+    bool IsInCluster() const { return bool(m_nFlags & GlyphItemFlags::IS_IN_CLUSTER); }
+    bool IsRTLGlyph() const { return bool(m_nFlags & GlyphItemFlags::IS_RTL_GLYPH); }
+    bool IsDiacritic() const { return bool(m_nFlags & GlyphItemFlags::IS_DIACRITIC); }
+    bool IsVertical() const { return bool(m_nFlags & GlyphItemFlags::IS_VERTICAL); }
+    bool IsSpacing() const { return bool(m_nFlags & GlyphItemFlags::IS_SPACING); }
+    bool AllowKashida() const { return bool(m_nFlags & GlyphItemFlags::ALLOW_KASHIDA); }
+    bool IsDropped() const { return bool(m_nFlags & GlyphItemFlags::IS_DROPPED); }
+    bool IsClusterStart() const { return bool(m_nFlags & GlyphItemFlags::IS_CLUSTER_START); }
 
     inline bool GetGlyphBoundRect(tools::Rectangle&) const;
     inline bool GetGlyphOutline(basegfx::B2DPolyPolygon&) const;
+    inline void dropGlyph();
+
+    sal_GlyphId glyphId() const { return m_aGlyphId; }
+    int charCount() const { return m_nCharCount; }
+    int origWidth() const { return m_nOrigWidth; }
+    LogicalFontInstance* fontInstance() const { return m_pFontInstance; }
+    GlyphItemFlags flags() const { return m_nFlags; }
+    int charPos() const { return m_nCharPos; }
+    int xOffset() const { return m_nXOffset; }
 };
 
 VCL_DLLPUBLIC bool GlyphItem::GetGlyphBoundRect(tools::Rectangle& rRect) const
@@ -91,6 +110,12 @@ VCL_DLLPUBLIC bool GlyphItem::GetGlyphOutline(basegfx::B2DPolyPolygon& rPoly) co
     return m_pFontInstance->GetGlyphOutline(m_aGlyphId, rPoly, IsVertical());
 }
 
+void GlyphItem::dropGlyph()
+{
+    m_nCharPos = -1;
+    m_nFlags |= GlyphItemFlags::IS_DROPPED;
+}
+
 class SalLayoutGlyphsImpl : public std::vector<GlyphItem>
 {
     friend class GenericSalLayout;
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 510aa5053237..04107c2841af 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -196,7 +196,7 @@ void Qt5Graphics::DrawTextLayout(const GenericSalLayout& rLayout)
     int nStart = 0;
     while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
     {
-        glyphIndexes.push_back(pGlyph->m_aGlyphId);
+        glyphIndexes.push_back(pGlyph->glyphId());
         positions.push_back(QPointF(aPos.X(), aPos.Y()));
     }
 
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index f27047a116f4..080cb1adaa11 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -414,7 +414,7 @@ void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
             }
         }
 
-        aGlyphIds.push_back(pGlyph->m_aGlyphId);
+        aGlyphIds.push_back(pGlyph->glyphId());
         aGlyphPos.push_back(aGCPos);
         aGlyphOrientation.push_back(bUprightGlyph);
     }
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 0ecf733a328d..eec3079074e0 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -530,37 +530,37 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, const SalLayoutGlyphs*
                         continue;
                 }
 
-                int nGlyphFlags = 0;
+                GlyphItemFlags nGlyphFlags = GlyphItemFlags::NONE;
                 if (bRightToLeft)
-                    nGlyphFlags |= GlyphItem::IS_RTL_GLYPH;
+                    nGlyphFlags |= GlyphItemFlags::IS_RTL_GLYPH;
 
                 if (bClusterStart)
-                    nGlyphFlags |= GlyphItem::IS_CLUSTER_START;
+                    nGlyphFlags |= GlyphItemFlags::IS_CLUSTER_START;
 
                 if (bInCluster)
-                    nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
+                    nGlyphFlags |= GlyphItemFlags::IS_IN_CLUSTER;
 
                 sal_Int32 indexUtf16 = nCharPos;
                 sal_UCS4 aChar = rArgs.mrStr.iterateCodePoints(&indexUtf16, 0);
 
                 if (u_getIntPropertyValue(aChar, UCHAR_GENERAL_CATEGORY) == U_NON_SPACING_MARK)
-                    nGlyphFlags |= GlyphItem::IS_DIACRITIC;
+                    nGlyphFlags |= GlyphItemFlags::IS_DIACRITIC;
 
                 if (u_isUWhiteSpace(aChar))
-                    nGlyphFlags |= GlyphItem::IS_SPACING;
+                    nGlyphFlags |= GlyphItemFlags::IS_SPACING;
 
                 if (aSubRun.maScript == HB_SCRIPT_ARABIC &&
                     HB_DIRECTION_IS_BACKWARD(aSubRun.maDirection) &&
-                    (nGlyphFlags & GlyphItem::IS_SPACING) == 0)
+                    !(nGlyphFlags & GlyphItemFlags::IS_SPACING))
                 {
-                    nGlyphFlags |= GlyphItem::ALLOW_KASHIDA;
+                    nGlyphFlags |= GlyphItemFlags::ALLOW_KASHIDA;
                     rArgs.mnFlags |= SalLayoutFlags::KashidaJustification;
                 }
 
                 DeviceCoordinate nAdvance, nXOffset, nYOffset;
                 if (aSubRun.maDirection == HB_DIRECTION_TTB)
                 {
-                    nGlyphFlags |= GlyphItem::IS_VERTICAL;
+                    nGlyphFlags |= GlyphItemFlags::IS_VERTICAL;
 
                     // We have glyph offsets that is relative to h origin now,
                     // add the origin back so it is relative to v origin.
@@ -612,7 +612,7 @@ void GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
 
     for (auto const& aGlyphItem : *m_GlyphItems.Impl())
     {
-        const int nIndex = aGlyphItem.m_nCharPos - mnMinCharPos;
+        const int nIndex = aGlyphItem.charPos() - mnMinCharPos;
         if (nIndex >= nCharCount)
             continue;
         pCharWidths[nIndex] += aGlyphItem.m_nNewWidth;
@@ -682,9 +682,9 @@ void GenericSalLayout::ApplyDXArray(const ImplLayoutArgs& rArgs)
     {
         // Accumulate the width difference for all characters corresponding to
         // this glyph.
-        int nCharPos = (*m_GlyphItems.Impl())[i].m_nCharPos - mnMinCharPos;
+        int nCharPos = (*m_GlyphItems.Impl())[i].charPos() - mnMinCharPos;
         DeviceCoordinate nDiff = 0;
-        for (int j = 0; j < (*m_GlyphItems.Impl())[i].m_nCharCount; j++)
+        for (int j = 0; j < (*m_GlyphItems.Impl())[i].charCount(); j++)
             nDiff += pNewCharWidths[nCharPos + j] - pOldCharWidths[nCharPos + j];
 
         if (!(*m_GlyphItems.Impl())[i].IsRTLGlyph())
@@ -731,7 +731,7 @@ void GenericSalLayout::ApplyDXArray(const ImplLayoutArgs& rArgs)
             // last glyph in the cluster not the first as this would be the
             // base glyph.
             if (bKashidaJustify && (*m_GlyphItems.Impl())[i].AllowKashida() &&
-                nDiff > (*m_GlyphItems.Impl())[i].m_nCharCount) // Rounding errors, 1 pixel per character!
+                nDiff > (*m_GlyphItems.Impl())[i].charCount()) // Rounding errors, 1 pixel per character!
             {
                 pKashidas[i] = nDiff;
                 // Move any non-spacing marks attached to this cluster as well.
@@ -782,8 +782,8 @@ void GenericSalLayout::ApplyDXArray(const ImplLayoutArgs& rArgs)
             }
 
             Point aPos(pGlyphIter->m_aLinearPos.getX() - nTotalWidth, 0);
-            int nCharPos = pGlyphIter->m_nCharPos;
-            int const nFlags = GlyphItem::IS_IN_CLUSTER | GlyphItem::IS_RTL_GLYPH;
+            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, &GetFont());
@@ -801,7 +801,7 @@ bool GenericSalLayout::IsKashidaPosValid(int nCharPos) const
 {
     for (auto pIter = m_GlyphItems.Impl()->begin(); pIter != m_GlyphItems.Impl()->end(); ++pIter)
     {
-        if (pIter->m_nCharPos == nCharPos)
+        if (pIter->charPos() == nCharPos)
         {
             // The position is the first glyph, this would happen if we
             // changed the text styling in the middle of a word. Since we don’t
@@ -812,7 +812,7 @@ bool GenericSalLayout::IsKashidaPosValid(int nCharPos) const
 
             // If the character is not supported by this layout, return false
             // so that fallback layouts would be checked for it.
-            if (pIter->m_aGlyphId == 0)
+            if (pIter->glyphId() == 0)
                 break;
 
             // Search backwards for previous glyph belonging to a different
@@ -820,12 +820,12 @@ bool GenericSalLayout::IsKashidaPosValid(int nCharPos) const
             // RTL glyphs, which will be in visual order.
             for (auto pPrev = pIter - 1; pPrev != m_GlyphItems.Impl()->begin(); --pPrev)
             {
-                if (pPrev->m_nCharPos != nCharPos)
+                if (pPrev->charPos() != nCharPos)
                 {
                     // Check if the found glyph belongs to the next character,
                     // otherwise the current glyph will be a ligature which is
                     // invalid kashida position.
-                    if (pPrev->m_nCharPos == (nCharPos + 1))
+                    if (pPrev->charPos() == (nCharPos + 1))
                         return true;
                     break;
                 }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 19773af668b9..f7a619b6f3be 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3943,7 +3943,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(), 0, 0, 0,
+                          Point(), GlyphItemFlags::NONE, 0, 0,
                           const_cast<LogicalFontInstance*>(pFontInstance));
     const std::vector<sal_Ucs> aCodeUnits={ cMark };
     sal_uInt8 nMappedGlyph;
@@ -5829,7 +5829,7 @@ void PDFWriterImpl::registerGlyph(const GlyphItem* pGlyph,
                                   sal_uInt8& nMappedGlyph,
                                   sal_Int32& nMappedFontObject)
 {
-    const int nFontGlyphId = pGlyph->m_aGlyphId;
+    const int nFontGlyphId = pGlyph->glyphId();
     FontSubset& rSubset = m_aSubsets[ pFont ];
     // search for font specific glyphID
     FontMapping::iterator it = rSubset.m_aMapping.find( nFontGlyphId );
@@ -5987,7 +5987,7 @@ void PDFWriterImpl::drawVerticalGlyphs(
             long nOffsetY = rGlyphs[i+1].m_aPos.Y() - rGlyphs[i].m_aPos.Y();
             nXOffset += static_cast<int>(sqrt(double(nOffsetX*nOffsetX + nOffsetY*nOffsetY)));
         }
-        if( ! rGlyphs[i].m_pGlyph->m_aGlyphId )
+        if (!rGlyphs[i].m_pGlyph->glyphId())
             continue;
 
         aDeltaPos = rRotScale.transform( aDeltaPos );
@@ -6282,9 +6282,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
         // * Keep generating (now) redundant ToUnicode entries for
         //   compatibility with old tools not supporting ActualText.
 
-        assert(pGlyph->m_nCharCount >= 0);
-        for (int n = 0; n < pGlyph->m_nCharCount; n++)
-            aCodeUnits.push_back(rText[pGlyph->m_nCharPos + n]);
+        assert(pGlyph->charCount() >= 0);
+        for (int n = 0; n < pGlyph->charCount(); n++)
+            aCodeUnits.push_back(rText[pGlyph->charPos() + n]);
 
         bool bUseActualText = false;
 
@@ -6303,7 +6303,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
         {
             for (const auto& rSubset : m_aSubsets[pFont].m_aSubsets)
             {
-                const auto& it = rSubset.m_aMapping.find(pGlyph->m_aGlyphId);
+                const auto& it = rSubset.m_aMapping.find(pGlyph->glyphId());
                 if (it != rSubset.m_aMapping.cend() && it->second.codes() != aCodeUnits)
                 {
                     bUseActualText = true;
@@ -6322,13 +6322,13 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
         SalGraphics *pGraphics = GetGraphics();
         if (pGraphics)
             nGlyphWidth = m_aFontCache.getGlyphWidth(pFont,
-                                                     pGlyph->m_aGlyphId,
+                                                     pGlyph->glyphId(),
                                                      pGlyph->IsVertical(),
                                                      pGraphics);
 
         int nCharPos = -1;
         if (bUseActualText || pGlyph->IsInCluster())
-            nCharPos = pGlyph->m_nCharPos;
+            nCharPos = pGlyph->charPos();
 
         aGlyphs.emplace_back(aPos,
                              pGlyph,
@@ -6400,12 +6400,12 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
             if (!aRun.front().m_pGlyph->IsRTLGlyph())
             {
                 nCharPos = aRun.front().m_nCharPos;
-                nCharCount = aRun.front().m_pGlyph->m_nCharCount;
+                nCharCount = aRun.front().m_pGlyph->charCount();
             }
             else
             {
                 nCharPos = aRun.back().m_nCharPos;
-                nCharCount = aRun.back().m_pGlyph->m_nCharCount;
+                nCharCount = aRun.back().m_pGlyph->charCount();
             }
 
             if (nCharPos >= 0 && nCharCount)
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 3c197c016b1a..bcd8eaa74a77 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -674,7 +674,7 @@ DeviceCoordinate GenericSalLayout::GetTextWidth() const
         DeviceCoordinate nXPos = aGlyphItem.m_aLinearPos.getX();
         if( nMinPos > nXPos )
             nMinPos = nXPos;
-        nXPos += aGlyphItem.m_nNewWidth - aGlyphItem.m_nXOffset;
+        nXPos += aGlyphItem.m_nNewWidth - aGlyphItem.xOffset();
         if( nMaxPos < nXPos )
             nMaxPos = nXPos;
     }
@@ -705,17 +705,17 @@ void GenericSalLayout::Justify( DeviceCoordinate nNewWidth )
     {
         if( !pGlyphIter->IsDiacritic() )
             ++nStretchable;
-        if( nMaxGlyphWidth < pGlyphIter->m_nOrigWidth )
-            nMaxGlyphWidth = pGlyphIter->m_nOrigWidth;
+        if (nMaxGlyphWidth < pGlyphIter->origWidth())
+            nMaxGlyphWidth = pGlyphIter->origWidth();
     }
 
     // move rightmost glyph to requested position
-    nOldWidth -= pGlyphIterRight->m_nOrigWidth;
+    nOldWidth -= pGlyphIterRight->origWidth();
     if( nOldWidth <= 0 )
         return;
     if( nNewWidth < nMaxGlyphWidth)
         nNewWidth = nMaxGlyphWidth;
-    nNewWidth -= pGlyphIterRight->m_nOrigWidth;
+    nNewWidth -= pGlyphIterRight->origWidth();
     pGlyphIterRight->m_aLinearPos.setX( nNewWidth );
 
     // justify glyph widths and positions
@@ -811,7 +811,7 @@ void GenericSalLayout::ApplyAsianKerning(const OUString& rStr)
                                           pGlyphIterEnd = m_GlyphItems.Impl()->end();
          pGlyphIter != pGlyphIterEnd; ++pGlyphIter)
     {
-        const int n = pGlyphIter->m_nCharPos;
+        const int n = pGlyphIter->charPos();
         if (n < nLength - 1)
         {
             // ignore code ranges that are not affected by asian punctuation compression
@@ -834,7 +834,7 @@ void GenericSalLayout::ApplyAsianKerning(const OUString& rStr)
             int nDelta = (nKernCurrent < nKernNext) ? nKernCurrent : nKernNext;
             if (nDelta < 0)
             {
-                nDelta = (nDelta * pGlyphIter->m_nOrigWidth + 2) / 4;
+                nDelta = (nDelta * pGlyphIter->origWidth() + 2) / 4;
                 if( pGlyphIter+1 == pGlyphIterEnd )
                     pGlyphIter->m_nNewWidth += nDelta;
                 nOffset += nDelta;
@@ -857,8 +857,8 @@ void GenericSalLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) co
     for (auto const& aGlyphItem : *m_GlyphItems.Impl())
     {
         long nXPos = aGlyphItem.m_aLinearPos.getX();
-        long nXRight = nXPos + aGlyphItem.m_nOrigWidth;
-        int n = aGlyphItem.m_nCharPos;
+        long nXRight = nXPos + aGlyphItem.origWidth();
+        int n = aGlyphItem.charPos();
         int nCurrIdx = 2 * (n - mnMinCharPos);
         // tdf#86399 if this is not the start of a cluster, don't overwrite the caret bounds of the cluster start
         if (aGlyphItem.IsInCluster() && pCaretXArray[nCurrIdx] != -1)
@@ -907,7 +907,7 @@ bool GenericSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
     // find next glyph in substring
     for(; pGlyphIter != pGlyphIterEnd; ++nStart, ++pGlyphIter )
     {
-        int n = pGlyphIter->m_nCharPos;
+        int n = pGlyphIter->charPos();
         if( (mnMinCharPos <= n) && (n < mnEndCharPos) )
             break;
     }
@@ -947,7 +947,7 @@ void GenericSalLayout::MoveGlyph( int nStart, long nNewXPos )
     // as RTL-glyphs are right justified in their cell
     // the cell position needs to be adjusted to the glyph position
     if( pGlyphIter->IsRTLGlyph() )
-        nNewXPos += pGlyphIter->m_nNewWidth - pGlyphIter->m_nOrigWidth;
+        nNewXPos += pGlyphIter->m_nNewWidth - pGlyphIter->origWidth();
     // calculate the x-offset to the old position
     long nXDelta = nNewXPos - pGlyphIter->m_aLinearPos.getX();
     // adjust all following glyph positions if needed
@@ -967,8 +967,7 @@ void GenericSalLayout::DropGlyph( int nStart )
 
     std::vector<GlyphItem>::iterator pGlyphIter = m_GlyphItems.Impl()->begin();
     pGlyphIter += nStart;
-    pGlyphIter->m_nCharPos = -1;
-    pGlyphIter->m_nFlags |= GlyphItem::IS_DROPPED;
+    pGlyphIter->dropGlyph();
 }
 
 void GenericSalLayout::Simplify( bool bIsBase )
@@ -979,7 +978,7 @@ void GenericSalLayout::Simplify( bool bIsBase )
     {
         if (bIsBase && (*m_GlyphItems.Impl())[i].IsDropped())
             continue;
-        if (!bIsBase && (*m_GlyphItems.Impl())[i].m_aGlyphId == 0)
+        if (!bIsBase && (*m_GlyphItems.Impl())[i].glyphId() == 0)
             continue;
 
         if( i != j )
@@ -1185,12 +1184,12 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
     assert(nFirstValid >= 0);
 
     // get the next codepoint index that needs fallback
-    int nActiveCharPos = pGlyphs[nFirstValid]->m_nCharPos;
+    int nActiveCharPos = pGlyphs[nFirstValid]->charPos();
     int nActiveCharIndex = nActiveCharPos - mnMinCharPos;
     // get the end index of the active run
     int nLastRunEndChar = (nActiveCharIndex >= 0 && vRtl[nActiveCharIndex]) ?
         rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1;
-    int nRunVisibleEndChar = pGlyphs[nFirstValid]->m_nCharPos;
+    int nRunVisibleEndChar = pGlyphs[nFirstValid]->charPos();
     // merge the fallback levels
     while( bValid[nFirstValid] && (nLevel > 0))
     {
@@ -1219,8 +1218,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
         {
             // drop the NotDef glyphs in the base layout run if a fallback run exists
             while (
-                    (maFallbackRuns[n-1].PosIsInRun(pGlyphs[nFirstValid]->m_nCharPos)) &&
-                    (!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[nFirstValid]->m_nCharPos))
+                    (maFallbackRuns[n-1].PosIsInRun(pGlyphs[nFirstValid]->charPos())) &&
+                    (!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[nFirstValid]->charPos()))
                   )
             {
                 mpLayouts[0]->DropGlyph( nStartOld[0] );
@@ -1241,7 +1240,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
 
             // proceed to next glyph
             nStartOld[n] = nStartNew[n];
-            int nOrigCharPos = pGlyphs[n]->m_nCharPos;
+            int nOrigCharPos = pGlyphs[n]->charPos();
             bValid[n] = mpLayouts[n]->GetNextGlyph(&pGlyphs[n], aPos, nStartNew[n]);
             // break after last glyph of active layout
             if( !bValid[n] )
@@ -1255,16 +1254,16 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
             //If the next character is one which belongs to the next level, then we
             //are finished here for now, and we'll pick up after the next level has
             //been processed
-            if ((n+1 < nLevel) && (pGlyphs[n]->m_nCharPos != nOrigCharPos))
+            if ((n+1 < nLevel) && (pGlyphs[n]->charPos() != nOrigCharPos))
             {
-                if (nOrigCharPos < pGlyphs[n]->m_nCharPos)
+                if (nOrigCharPos < pGlyphs[n]->charPos())
                 {
-                    if (pGlyphs[n+1]->m_nCharPos > nOrigCharPos && (pGlyphs[n+1]->m_nCharPos < pGlyphs[n]->m_nCharPos))
+                    if (pGlyphs[n+1]->charPos() > nOrigCharPos && (pGlyphs[n+1]->charPos() < pGlyphs[n]->charPos()))
                         break;
                 }
-                else if (nOrigCharPos > pGlyphs[n]->m_nCharPos)
+                else if (nOrigCharPos > pGlyphs[n]->charPos())
                 {
-                    if (pGlyphs[n+1]->m_nCharPos > pGlyphs[n]->m_nCharPos && (pGlyphs[n+1]->m_nCharPos < nOrigCharPos))
+                    if (pGlyphs[n+1]->charPos() > pGlyphs[n]->charPos() && (pGlyphs[n+1]->charPos() < nOrigCharPos))
                         break;
                 }
             }
@@ -1273,15 +1272,15 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
             if( n > 0 )
             {
                 // skip until end of fallback run
-                if (!maFallbackRuns[n-1].PosIsInRun(pGlyphs[n]->m_nCharPos))
+                if (!maFallbackRuns[n-1].PosIsInRun(pGlyphs[n]->charPos()))
                     break;
             }
             else
             {
                 // break when a fallback is needed and available
-                bool bNeedFallback = maFallbackRuns[0].PosIsInRun(pGlyphs[nFirstValid]->m_nCharPos);
+                bool bNeedFallback = maFallbackRuns[0].PosIsInRun(pGlyphs[nFirstValid]->charPos());
                 if( bNeedFallback )
-                    if (!maFallbackRuns[nLevel-1].PosIsInRun(pGlyphs[nFirstValid]->m_nCharPos))
+                    if (!maFallbackRuns[nLevel-1].PosIsInRun(pGlyphs[nFirstValid]->charPos()))
                         break;
                 // break when change from resolved to unresolved base layout run
                 if( bKeepNotDef && !bNeedFallback )
@@ -1292,21 +1291,21 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
             if (aMultiArgs.mpDXArray &&
                 nRunVisibleEndChar < mnEndCharPos &&
                 nRunVisibleEndChar >= mnMinCharPos &&
-                pGlyphs[n]->m_nCharPos < mnEndCharPos &&
-                pGlyphs[n]->m_nCharPos >= mnMinCharPos)
+                pGlyphs[n]->charPos() < mnEndCharPos &&
+                pGlyphs[n]->charPos() >= mnMinCharPos)
             {
                 if (vRtl[nActiveCharPos - mnMinCharPos])
                 {
                     if (aMultiArgs.mpDXArray[nRunVisibleEndChar-mnMinCharPos]
-                        >= aMultiArgs.mpDXArray[pGlyphs[n]->m_nCharPos - mnMinCharPos])
+                        >= aMultiArgs.mpDXArray[pGlyphs[n]->charPos() - mnMinCharPos])
                     {
-                        nRunVisibleEndChar = pGlyphs[n]->m_nCharPos;
+                        nRunVisibleEndChar = pGlyphs[n]->charPos();
                     }
                 }
                 else if (aMultiArgs.mpDXArray[nRunVisibleEndChar-mnMinCharPos]
-                         <= aMultiArgs.mpDXArray[pGlyphs[n]->m_nCharPos - mnMinCharPos])
+                         <= aMultiArgs.mpDXArray[pGlyphs[n]->charPos() - mnMinCharPos])
                 {
-                    nRunVisibleEndChar = pGlyphs[n]->m_nCharPos;
+                    nRunVisibleEndChar = pGlyphs[n]->charPos();
                 }
             }
         }
@@ -1334,7 +1333,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
                   nRunAdvance -= aMultiArgs.mpDXArray[nLastRunEndChar - mnMinCharPos];
             }
             nLastRunEndChar = nRunVisibleEndChar;
-            nRunVisibleEndChar = pGlyphs[nFirstValid]->m_nCharPos;
+            nRunVisibleEndChar = pGlyphs[nFirstValid]->charPos();
             // the requested width is still in pixel units
             // => convert it to base level font units
             nRunAdvance *= mnUnitsPerPixel;
@@ -1351,7 +1350,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
         nXPos += nRunAdvance;
 
         // prepare for next fallback run
-        nActiveCharPos = pGlyphs[nFirstValid]->m_nCharPos;
+        nActiveCharPos = pGlyphs[nFirstValid]->charPos();
         // it essential that the runs don't get ahead of themselves and in the
         // if( bKeepNotDef && !bNeedFallback ) statement above, the next run may
         // have already been reached on the base level
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 5fe146448f23..a5ccdb1bd6d5 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2295,7 +2295,7 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c
     SystemGlyphData aSystemGlyph;
     while (pLayout->GetNextGlyph(&pGlyph, aPos, nStart, nullptr, &aSystemGlyph.fallbacklevel))
     {
-        aSystemGlyph.index = pGlyph->m_aGlyphId;
+        aSystemGlyph.index = pGlyph->glyphId();
         aSystemGlyph.x = aPos.X();
         aSystemGlyph.y = aPos.Y();
         aSysLayoutData.rGlyphData.push_back(aSystemGlyph);
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index d6355e65f173..f72664657673 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -184,7 +184,7 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG
     while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
     {
         cairo_glyph_t aGlyph;
-        aGlyph.index = pGlyph->m_aGlyphId;
+        aGlyph.index = pGlyph->glyphId();
         aGlyph.x = aPos.X();
         aGlyph.y = aPos.Y();
         cairo_glyphs.push_back(aGlyph);
diff --git a/vcl/unx/generic/print/text_gfx.cxx b/vcl/unx/generic/print/text_gfx.cxx
index 156f801cb8c9..e7ced7a83c97 100644
--- a/vcl/unx/generic/print/text_gfx.cxx
+++ b/vcl/unx/generic/print/text_gfx.cxx
@@ -123,14 +123,14 @@ void PrinterGfx::DrawGlyph(const Point& rPoint,
             PSTranslate( aPoint );
         PSRotate (900);
         // draw the rotated glyph
-        drawGlyph(aRotPoint, rGlyph.m_aGlyphId);
+        drawGlyph(aRotPoint, rGlyph.glyphId());
 
         // restore previous state
         maVirtualStatus = aSaveStatus;
         PSGRestore();
     }
     else
-        drawGlyph(aPoint, rGlyph.m_aGlyphId);
+        drawGlyph(aPoint, rGlyph.glyphId());
 
     // restore the user coordinate system
     if (nCurrentTextAngle != 0)
diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx
index 93f877d2aea9..734b68b0780a 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -260,7 +260,7 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa
         const GlyphItem* pGlyph;
         while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
         {
-            UINT16 glyphIndices[] = { pGlyph->m_aGlyphId };
+            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,
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 1f0af819f6a1..25949dc0692e 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -260,7 +260,7 @@ bool ExTextOutRenderer::operator ()(GenericSalLayout const &rLayout,
     const GlyphItem* pGlyph;
     while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
     {
-        WORD glyphWStr[] = { pGlyph->m_aGlyphId };
+        WORD glyphWStr[] = { pGlyph->glyphId() };
         if (hAltFont && pGlyph->IsVertical() == bUseAltFont)
         {
             bUseAltFont = !bUseAltFont;
@@ -414,9 +414,9 @@ bool WinSalGraphics::CacheGlyphs(const GenericSalLayout& rLayout)
     const GlyphItem* pGlyph;
     while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
     {
-        if (!rFont.GetOpenGLGlyphCache().IsGlyphCached(pGlyph->m_aGlyphId))
+        if (!rFont.GetOpenGLGlyphCache().IsGlyphCached(pGlyph->glyphId()))
         {
-            if (!rFont.CacheGlyphToAtlas(hDC, hFONT, pGlyph->m_aGlyphId, *this, rLayout))
+            if (!rFont.CacheGlyphToAtlas(hDC, hFONT, pGlyph->glyphId(), *this, rLayout))
                 return false;
         }
     }
@@ -445,7 +445,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout)
     const GlyphItem* pGlyph;
     while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
     {
-        OpenGLGlyphDrawElement& rElement(rFont.GetOpenGLGlyphCache().GetDrawElement(pGlyph->m_aGlyphId));
+        OpenGLGlyphDrawElement& rElement(rFont.GetOpenGLGlyphCache().GetDrawElement(pGlyph->glyphId()));
         OpenGLTexture& rTexture = rElement.maTexture;
 
         if (!rTexture)


More information about the Libreoffice-commits mailing list