r21684 by jghali - #14517: filling a tab with point does not work correctly

scribus-commit scribus-commit at lists.scribus.net
Thu Dec 29 16:23:40 UTC 2016


Author: jghali
Date: Thu Dec 29 16:23:40 2016
New Revision: 21684

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21684
Log:
#14517: filling a tab with point does not work correctly

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/text/screenpainter.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21684&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Thu Dec 29 16:23:40 2016
@@ -967,14 +967,15 @@
 		for (int i = 0; i < glyphs.count(); ++i)
 		{
 			GlyphCluster& glyphCluster = glyphs[i];
-			CharStyle charStyle(glyphCluster.style());
 			if (glyphCluster.hasFlag(ScLayout_TabLeaders))
 			{
+				const CharStyle& charStyle(glyphCluster.style());
 				GlyphLayout tglyph = glyphCluster.glyphs().last();
 				double width = glyphCluster.width();
 				double wt = charStyle.font().glyphWidth(tglyph.glyph, charStyle.fontSize() * tglyph.scaleV / 10.0);
 				int count = static_cast<int>(width / wt);
-				glyphCluster.glyphs().clear();
+				if (count > 0)
+					glyphCluster.glyphs().clear();
 				for(int cx = 0; cx < count; ++cx)
 				{
 					GlyphLayout more = tglyph;
@@ -983,6 +984,7 @@
 						more.xoffset = (width / count) * cx;
 					glyphCluster.append(more);
 				}
+				glyphCluster.glyphs().last().xadvance = width / glyphCluster.scaleH();
 			}
 		}
 	}

Modified: trunk/Scribus/scribus/text/screenpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21684&path=/trunk/Scribus/scribus/text/screenpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/text/screenpainter.cpp	(original)
+++ trunk/Scribus/scribus/text/screenpainter.cpp	Thu Dec 29 16:23:40 2016
@@ -214,8 +214,9 @@
 	else
 	{
 		m_painter->translate(0, -(fontSize() * gc.scaleV()));
-		double scaleH = gc.scaleH() * fontSize() / 10.0;
-		double scaleV = gc.scaleV() * fontSize() / 10.0;
+		double sizeFactor = fontSize() / 10.0;
+		double scaleH = gc.scaleH() * sizeFactor;
+		double scaleV = gc.scaleV() * sizeFactor;
 		m_painter->scale(scaleH, scaleV);
 
 		QVector<FPointArray> outlines = gc.glyphClusterOutline();
@@ -224,10 +225,11 @@
 		{
 			const FPointArray& outline = outlines.at(i);
 			const GlyphLayout& gl = glyphs.at(i);
+			m_painter->translate(gl.xoffset / sizeFactor, 0);
 			m_painter->setupPolygon(&outline, true);
 			if (outline.size() > 3)
 				m_painter->fillPath();
-			m_painter->translate(gl.xadvance, 0);
+			m_painter->translate(gl.xadvance - gl.xoffset / sizeFactor, 0);
 		}
 	}
 	m_painter->setFillRule(fr);




More information about the scribus-commit mailing list