Author: jghali
Date: Sat Dec 17 00:05:33 2016
New Revision: 21661

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21661
Log:
#14445, second round: Arabic single word wrongly justified to the left with 
"Forced Justified" alignment

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=21661&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp        (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp        Sat Dec 17 00:05:33 2016
@@ -809,7 +809,7 @@
 
                for (int i = 0; i < glyphsCount; ++i)
                {
-                       GlyphCluster glyphCluster = glyphs[i];
+                       const GlyphCluster& glyphCluster = glyphs.at(i);
                        if (!glyphCluster.hasFlag(ScLayout_ExpandingSpace))
                        {
                                glyphNatural += glyphCluster.width();
@@ -928,6 +928,25 @@
                                glyphCluster.extraWidth += trackingAmount;
                        }
 
+               }
+
+               if ((style.alignment() == ParagraphStyle::Extended) &&
+                       (style.direction() == ParagraphStyle::RTL) &&
+                       (!trackingInsertion && (spaceExtension == 0)))
+               {
+                       double naturalWidth = line.naturalWidth;
+                       if (glyphScale != 1.0)
+                       {
+                               naturalWidth = 0;
+                               for (int i = 0; i < glyphsCount; ++i)
+                               {
+                                       const GlyphCluster& glyphCluster = 
glyphs.at(i);
+                                       naturalWidth += glyphCluster.width();
+                               }
+                       }
+                       double offset = line.width - naturalWidth;
+                       if (offset > 0)
+                               indentLine(style, offset);
                }
        }
 
@@ -2528,8 +2547,8 @@
                                if (SpecialChars::isBreak(itemText.text(a), 
Cols > 1))
                                {
                                        // find end of line
-//                    qDebug() << "breakline isBreak @" << i;
-                    current.breakLine(i);
+//                                     qDebug() << "breakline isBreak @" << i;
+                                       current.breakLine(i);
                                        regionMinY = qMax(0.0, current.line.y - 
current.line.ascent);
                                        regionMaxY = current.line.y + 
current.line.descent;
                                        EndX = 
current.endOfLine(m_availableRegion, style.rightMargin(), regionMinY, 
regionMaxY);


_______________________________________________
scribus-commit mailing list
[email protected]
http://lists.scribus.net/mailman/listinfo/scribus-commit

Reply via email to