vcl/source/gdi/impglyphitem.cxx |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit bd568b360450b348ff0e6813862a49892df81140
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Apr 28 06:57:18 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Thu Apr 28 08:10:33 2022 +0200

    check kashida only if the flag is set
    
    Change-Id: Ie508863c670e4b691bd30ac4d20ce479a569f793
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133531
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 8ea80293ee08..d6cd36ab1b5c 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -192,18 +192,25 @@ static SalLayoutGlyphs makeGlyphsSubset(const 
SalLayoutGlyphs& source,
                          | outputDevice->GetBiDiLayoutFlags(text, index, index 
+ len));
         // SalLayoutFlags::KashidaJustification is set only if any glyph
         // in the range has GlyphItemFlags::ALLOW_KASHIDA (otherwise unset it).
-        bool hasKashida = false;
-        for (const GlyphItem& item : *cloned)
+        if (cloned->GetFlags() & SalLayoutFlags::KashidaJustification)
         {
-            if (item.AllowKashida())
+            bool hasKashida = false;
+            for (const GlyphItem& item : *cloned)
             {
-                assert(cloned->GetFlags() & 
SalLayoutFlags::KashidaJustification);
-                hasKashida = true;
-                break;
+                if (item.AllowKashida())
+                {
+                    hasKashida = true;
+                    break;
+                }
             }
+            if (!hasKashida)
+                cloned->SetFlags(cloned->GetFlags() & 
~SalLayoutFlags::KashidaJustification);
         }
-        if (!hasKashida)
-            cloned->SetFlags(cloned->GetFlags() & 
~SalLayoutFlags::KashidaJustification);
+#ifdef DBG_UTIL
+        else
+            for (const GlyphItem& item : *cloned)
+                assert(!item.AllowKashida());
+#endif
         ret.AppendImpl(cloned);
     }
     return ret;

Reply via email to