[scribus-dev] Issue with scribusboxes (CTL project)

Khaled Hosny khaledhosny at eglug.org
Tue Mar 29 13:23:24 UTC 2016


On Mon, Mar 28, 2016 at 05:50:56PM +0200, Craig Bradney wrote:
> 
> 
> > On 28 Mar 2016, at 17:34, JLuc <jluc at no-log.org> wrote:
> > 
> > To the OMAN team (in case you dont follow the bug tracker rss) :
> > 
> > i uploaded a SLA document that is not well rendered
> > since boxes merge : https://bugs.scribus.net/view.php?id=13861
> > 
> > justified lines go over frame border.
> > it seems to be related to inter-word spacing and glyph scaling.
> > 
> > 
> 
> Adding Khaled

The attached patch should fix the issue.
-------------- next part --------------
diff --git a/scribus/pageitem_textframe.cpp b/scribus/pageitem_textframe.cpp
index 3725ca7..838c11d 100644
--- a/scribus/pageitem_textframe.cpp
+++ b/scribus/pageitem_textframe.cpp
@@ -1006,22 +1006,15 @@ static void justifyLine(const ParagraphStyle& style, LineControl& curr)
 	if (curr.glyphRuns[startItem].hasFlag(ScLayout_DropCap))
 		startItem++;
 	// distribute whitespace on spaces and glyphs
-
 	for (int i = startItem; i <= curr.line.lastRun; ++i)
 	{
 		GlyphRun& glyphrun = curr.glyphRuns[i];
-		if (i != curr.line.firstRun && glyphrun.hasFlag(ScLayout_ImplicitSpace))
-		{
-			GlyphRun& lastRun = curr.glyphRuns[i-1];
-			lastRun.glyphs().last().xadvance += imSpace;
-		}
 		double wide = glyphrun.width();
 		if (!glyphrun.hasFlag(ScLayout_ExpandingSpace))
 		{
 			for (int j = 0; j < glyphrun.glyphs().count(); ++j)
 			{
 				GlyphLayout& glyph = glyphrun.glyphs()[j];
-				glyph.xadvance += wide * glyphExtension;
 				glyph.xoffset *= glyphScale;
 				glyph.scaleH *= glyphScale;
 			}
@@ -1030,7 +1023,11 @@ static void justifyLine(const ParagraphStyle& style, LineControl& curr)
 		{
 			GlyphLayout& glyph = glyphrun.glyphs().last();
 			glyph.xadvance += wide * spaceExtension;
-
+		}
+		if (i != curr.line.firstRun && glyphrun.hasFlag(ScLayout_ImplicitSpace))
+		{
+			GlyphRun& lastRun = curr.glyphRuns[i - 1];
+			lastRun.glyphs().last().xadvance += imSpace;
 		}
 	}
 }


More information about the scribus-dev mailing list