r23075 by jghali - Fix corrupted XPS export caused by glyph cluster being associated with incorrect text string

scribus-commit scribus-commit at lists.scribus.net
Sat Jul 13 23:12:50 UTC 2019


Author: jghali
Date: Sat Jul 13 23:12:50 2019
New Revision: 23075

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23075
Log:
Fix corrupted XPS export caused by glyph cluster being associated with incorrect text string

Modified:
    trunk/Scribus/scribus/text/textshaper.cpp

Modified: trunk/Scribus/scribus/text/textshaper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23075&path=/trunk/Scribus/scribus/text/textshaper.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textshaper.cpp	(original)
+++ trunk/Scribus/scribus/text/textshaper.cpp	Sat Jul 13 23:12:50 2019
@@ -31,6 +31,7 @@
 	m_firstChar(firstChar),
 	m_singlePar(false)
 {
+	m_text.reserve(m_story.length() - m_firstChar + 1);
 	for (int i = m_firstChar; i < m_story.length(); ++i)
 	{
 		QChar ch = m_story.text(i);
@@ -169,7 +170,7 @@
 
 void TextShaper::buildText(int fromPos, int toPos, QVector<int>& smallCaps)
 {
-	m_text = "";
+	m_text.clear();
 	
 	if (toPos > m_story.length() || toPos < 0)
 		toPos = m_story.length();
@@ -421,7 +422,7 @@
 			const CharStyle& charStyle(m_story.charStyle(firstChar));
 			const StyleFlag& effects = charStyle.effects();
 
-			QString str = m_text.mid(firstChar, lastChar-firstChar+1);
+			QString str = m_text.mid(firstChar - fromPos, lastChar-firstChar+1);
 			GlyphCluster run(&charStyle, flags, firstChar, lastChar, m_story.object(firstChar), result.glyphs().length(), str);
 
 			run.clearFlag(ScLayout_HyphenationPossible);




More information about the scribus-commit mailing list