vcl/inc/impglyphitem.hxx        |    8 ++++----
 vcl/qa/cppunit/complextext.cxx  |    2 +-
 vcl/source/gdi/impglyphitem.cxx |    6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 96aa8a8f1c4ec2b038f0eb486c7e5c240c0092a2
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Nov 24 11:08:27 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Nov 24 14:57:34 2022 +0100

    relax glyph assert wrt layout equivalency
    
    as per: https://github.com/harfbuzz/harfbuzz/issues/3888
    
    Change-Id: I6e5a36fd0a5f4a3ceb979372d0f5d53ee5f65b0f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143218
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx
index 87276657e641..87f966bd1676 100644
--- a/vcl/inc/impglyphitem.hxx
+++ b/vcl/inc/impglyphitem.hxx
@@ -105,15 +105,15 @@ public:
     void setLinearPos(const DevicePoint& point) { m_aLinearPos = point; }
     void setLinearPosX(double x) { m_aLinearPos.setX(x); }
     void adjustLinearPosX(double diff) { m_aLinearPos.adjustX(diff); }
-    bool operator==(const GlyphItem& other) const
+    bool isLayoutEquivalent(const GlyphItem& other) const
     {
         return m_aLinearPos == other.m_aLinearPos && m_nOrigWidth == 
other.m_nOrigWidth
                && m_nCharPos == other.m_nCharPos && m_nXOffset == 
other.m_nXOffset
                && m_nYOffset == other.m_nYOffset && m_nNewWidth == 
other.m_nNewWidth
                && m_aGlyphId == other.m_aGlyphId && m_nCharCount == 
other.m_nCharCount
-               && m_nFlags == other.m_nFlags;
+               && (m_nFlags & ~GlyphItemFlags::IS_UNSAFE_TO_BREAK)
+                      == (other.m_nFlags & 
~GlyphItemFlags::IS_UNSAFE_TO_BREAK);
     }
-    bool operator!=(const GlyphItem& other) const { return !(*this == other); }
 };
 
 bool GlyphItem::GetGlyphBoundRect(const LogicalFontInstance* pFontInstance,
@@ -148,7 +148,7 @@ public:
     void SetFlags(SalLayoutFlags flags) { mnFlags = flags; }
     SalLayoutFlags GetFlags() const { return mnFlags; }
 #ifdef DBG_UTIL
-    bool isEqual(const SalLayoutGlyphsImpl* other) const;
+    bool isLayoutEquivalent(const SalLayoutGlyphsImpl* other) const;
 #endif
 
 private:
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 77b9444d1c74..92f537b1b73a 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -147,7 +147,7 @@ static void checkCompareGlyphs( const SalLayoutGlyphs& 
aGlyphs1, const SalLayout
         CPPUNIT_ASSERT_EQUAL_MESSAGE(messageLevel, g1->size(), g2->size());
         for( size_t i = 0; i < g1->size(); ++i )
         {
-            const bool equal = (*g1)[i] == (*g2)[i];
+            const bool equal = (*g1)[i].isLayoutEquivalent((*g2)[i]);
             CPPUNIT_ASSERT_MESSAGE(messageLevel, equal);
         }
     }
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 2ee4938f51d8..6a2c576e1f1a 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -200,7 +200,7 @@ bool SalLayoutGlyphsImpl::isSafeToBreak(const_iterator pos, 
bool rtl) const
 }
 
 #ifdef DBG_UTIL
-bool SalLayoutGlyphsImpl::isEqual(const SalLayoutGlyphsImpl* other) const
+bool SalLayoutGlyphsImpl::isLayoutEquivalent(const SalLayoutGlyphsImpl* other) 
const
 {
     if (!GetFont()->mxFontMetric->CompareDeviceIndependentFontAttributes(
             *other->GetFont()->mxFontMetric))
@@ -213,7 +213,7 @@ bool SalLayoutGlyphsImpl::isEqual(const 
SalLayoutGlyphsImpl* other) const
         return false;
     for (size_t pos = 0; pos < size(); ++pos)
     {
-        if ((*this)[pos] != (*other)[pos])
+        if (!(*this)[pos].isLayoutEquivalent((*other)[pos]))
             return false;
     }
     return true;
@@ -314,7 +314,7 @@ static void checkGlyphsEqual(const SalLayoutGlyphs& g1, 
const SalLayoutGlyphs& g
             assert(l1 == l2);
             break;
         }
-        assert(l1->isEqual(l2));
+        assert(l1->isLayoutEquivalent(l2));
     }
 }
 #endif

Reply via email to