r21217 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Tue Apr 19 18:49:59 UTC 2016


Author: jghali
Date: Tue Apr 19 18:49:59 2016
New Revision: 21217

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21217
Log:
#13964: Text on path not correct with increased distance of letters

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem_pathtext.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21217&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Tue Apr 19 18:49:59 2016
@@ -2647,8 +2647,13 @@
 		gl.xadvance = font.glyphWidth(gl.glyph, style.fontSize() / 10);
 		gl.yadvance = font.glyphBBox(gl.glyph, style.fontSize() / 10).ascent;
 	}
+	if (gl.scaleH == 0.0)
+	{
+		gl.xadvance = 0.0;
+		gl.scaleH = 1.0;
+	}
 	if (gl.xadvance > 0)
-		gl.xadvance += tracking;
+		gl.xadvance += tracking / gl.scaleH;
 
 	return gl;
 }

Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21217&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp	Tue Apr 19 18:49:59 2016
@@ -207,7 +207,7 @@
 		if (itemRenderText.hasObject(a))
 			totalTextLen += (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * glyphs.scaleH;
 		else
-			totalTextLen += glyphs.xadvance+itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0;
+			totalTextLen += glyphs.xadvance * glyphs.scaleH + itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0;
 	}
 	for (int segs = 0; segs < PoLine.size()-3; segs += 4)
 	{
@@ -255,13 +255,11 @@
 			chstr += itemRenderText.text(a+1, 1);
 
 		GlyphLayout glyphs = layoutGlyphs(itemRenderText.charStyle(a), chstr, itemRenderText.flags(a));
-		GlyphRun run(&itemRenderText.charStyle(a), itemRenderText.flags(a), a, a, itemRenderText.object(a));
-		run.glyphs().append(glyphs);
 
 		if (itemRenderText.hasObject(a))
 			dx = (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * glyphs.scaleH / 2.0;
 		else
-			dx = glyphs.xadvance / 2.0;
+			dx = glyphs.xadvance * glyphs.scaleH / 2.0;
 		CurX += dx;
 		double currPerc = currPath.percentAtLength(CurX);
 		if (currPerc >= 0.9999999)
@@ -308,6 +306,9 @@
 		}
 		trafo.translate(0, BaseOffs);
 
+		GlyphRun run(&itemRenderText.charStyle(a), itemRenderText.flags(a), a, a, itemRenderText.object(a));
+		run.glyphs().append(glyphs);
+
 		const CharStyle& cStyle(run.style());
 		double scaleV = cStyle.scaleV() / 1000.0;
 		double offset = (cStyle.fontSize() / 10) * (cStyle.baselineOffset() / 1000.0);
@@ -337,9 +338,9 @@
 		if (itemRenderText.hasObject(a))
 			CurX += (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * glyphs.scaleH + extraOffset;
 		else if (chstr[0] == SpecialChars::BLANK)
-			CurX += glyphs.xadvance+itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0 + wordExtra + extraOffset;
-		else
-			CurX += glyphs.xadvance+itemRenderText.charStyle(a).fontSize() *itemRenderText.charStyle(a).tracking() / 10000.0 + extraOffset;
+			CurX += glyphs.xadvance * glyphs.scaleH + itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0 + wordExtra + extraOffset;
+		else
+			CurX += glyphs.xadvance * glyphs.scaleH + itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0 + extraOffset;
 	}
 
 	textLayout.addColumn(0, 0);




More information about the scribus-commit mailing list