r23072 by jghali - #15736: Modifying character horizontal scale produces bad result on Malayalam text

scribus-commit scribus-commit at lists.scribus.net
Sat Jul 13 21:05:38 UTC 2019


Author: jghali
Date: Sat Jul 13 21:05:38 2019
New Revision: 23072

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23072
Log:
#15736: Modifying character horizontal scale produces bad result on Malayalam text

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
    trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scpageoutput.cpp
    trunk/Scribus/scribus/text/screenpainter.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23072&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Sat Jul 13 21:05:38 2019
@@ -154,7 +154,7 @@
 		{
 			if (gl.glyph >= ScFace::CONTROL_GLYPHS)
 			{
-				current_x += gl.xadvance;
+				current_x += gl.xadvance * gl.scaleH;
 				continue;
 			}
 
@@ -175,10 +175,10 @@
 
 				m_pathBuffer += "q\n";
 				m_pathBuffer += transformToStr(transform) + " cm\n";
-				m_pathBuffer += FToStr(fontSize()) + " 0 0 " + FToStr(fontSize()) + " " + FToStr(x() + gl.xoffset + current_x) + " " + FToStr((y() - fontSize() + gl.yoffset) * -1) + " cm\n";
+				m_pathBuffer += FToStr(fontSize()) + " 0 0 " + FToStr(fontSize()) + " " + FToStr(x() + gl.xoffset + current_x) + " " + FToStr(-y() + fontSize() - gl.yoffset) + " cm\n";
 
 				if (gl.scaleV != 1.0)
-					m_pathBuffer += "1 0 0 1 0 " + FToStr(((fontSize() - fontSize() * gl.scaleV) / fontSize()) * -1) + " cm\n";
+					m_pathBuffer += "1 0 0 1 0 " + FToStr(gl.scaleV - 1.0) + " cm\n";
 				m_pathBuffer += FToStr(qMax(gl.scaleH, 0.1)) + " 0 0 " + FToStr(qMax(gl.scaleV, 0.1)) + " 0 0 cm\n";
 
 				if (!FillColor.isEmpty())
@@ -249,7 +249,7 @@
 					}
 				}
 			}
-			current_x += gl.xadvance;
+			current_x += gl.xadvance * gl.scaleH;
 		}
 	}
 
@@ -263,7 +263,7 @@
 		{
 			if (gl.glyph >= ScFace::CONTROL_GLYPHS)
 			{
-				current_x += gl.xadvance;
+				current_x += gl.xadvance * gl.scaleH;
 				continue;
 			}
 
@@ -279,30 +279,32 @@
 
 			if (pdfFont.method == Use_XForm)
 			{
+				m_pathBuffer += "q\n";
 				if (!StrokeColor.isEmpty())
 				{
-					m_pathBuffer += FToStr(strokeWidth() / fontSize()) + " w\n[] 0 d\n0 J\n0 j\n";
+					m_pathBuffer += FToStr(strokeWidth()) + " w\n[] 0 d\n0 J\n0 j\n";
 					m_pathBuffer += StrokeColor;
 				}
+				m_pathBuffer += transformToStr(transform) + " cm\n";
 
 				if (!FillColor.isEmpty())
+				{
+					m_pathBuffer += "q\n";
 					m_pathBuffer += FillColor;
-
-				m_pathBuffer += "q\n";
-				m_pathBuffer += transformToStr(transform) + " cm\n";
-				m_pathBuffer += FToStr(fontSize()) + " 0 0 " + FToStr(fontSize()) + " " + FToStr(x() + gl.xoffset) + " " + FToStr((y() - fontSize() + gl.yoffset) * -1) + " cm\n";
-
-				if (gc.scaleV() != 1.0)
-					m_pathBuffer += "1 0 0 1 0 " + FToStr(((fontSize() - fontSize() * (gc.scaleV())) / fontSize()) * -1) + " cm\n";
-
-				m_pathBuffer += FToStr(qMax(gc.scaleH(), 0.1)) + " 0 0 " + FToStr(qMax(gc.scaleV(), 0.1)) + " 0 0 cm\n";
-
-				if (!FillColor.isEmpty())
+					m_pathBuffer += FToStr(fontSize()) + " 0 0 " + FToStr(fontSize()) + " " + FToStr(x() + gl.xoffset + current_x) + " " + FToStr(-y() + fontSize() - gl.yoffset) + " cm\n";
+					if (gc.scaleV() != 1.0)
+						m_pathBuffer += "1 0 0 1 0 " + FToStr(gl.scaleV - 1.0) + " cm\n";
+					m_pathBuffer += FToStr(qMax(gc.scaleH(), 0.1)) + " 0 0 " + FToStr(qMax(gc.scaleV(), 0.1)) + " 0 0 cm\n";
 					m_pathBuffer += pdfFont.name + "_gl" + Pdf::toPdf(gl.glyph) + " Do\n";
+					m_pathBuffer += "Q\n";
+				}
+
+				m_pathBuffer += "1.0 0 0 1.0 " + FToStr(x()) + " " + FToStr(fontSize() - y()) + " cm\n";
+				m_pathBuffer += "1.0 0 0 1.0 " + FToStr(gl.xoffset + current_x) + " " + FToStr(gc.scaleV() * fontSize() - fontSize() - gl.yoffset) + " cm\n";
 
 				FPointArray outline = font().glyphOutline(gl.glyph);
 				QTransform mat;
-				mat.scale(0.1, 0.1);
+				mat.scale((fontSize() * gc.scaleH()) / 10.0, (fontSize() * gc.scaleV()) / 10.0);
 				outline.map(mat);
 				bool nPath = true;
 				FPoint np;
@@ -385,17 +387,14 @@
 					m_pathBuffer += "q\n";
 					m_pathBuffer += FToStr(strokeWidth()) + " w\n[] 0 d\n0 J\n0 j\n";
 
-					transform.scale(fontSize(), fontSize());
-					transform.translate(x() + gl.xoffset + current_x, y() + gl.yoffset);
-					if (gc.scaleV() != 1.0)
-						transform.translate(0, ((fontSize() - fontSize() * gc.scaleV()) / fontSize()) * -1);
-					transform.scale(qMax(gc.scaleH(), 0.1), qMax(gc.scaleV(), 0.1));
 					m_pathBuffer += transformToStr(transform) + " cm\n";
+					m_pathBuffer += "1.0 0 0 1.0 " + FToStr(x()) + " " + FToStr(fontSize() - y()) + " cm\n";
+					m_pathBuffer += "1.0 0 0 1.0 " + FToStr(gl.xoffset + current_x) + " " + FToStr(gc.scaleV() * fontSize() - fontSize() - gl.yoffset) + " cm\n";
 
 					/* paint outline */
 					FPointArray outline = font().glyphOutline(gl.glyph);
 					QTransform mat;
-					mat.scale(0.1, 0.1);
+					mat.scale((fontSize() * gc.scaleH()) / 10.0, (fontSize() * gc.scaleV()) / 10.0);
 					outline.map(mat);
 					bool nPath = true;
 					FPoint np;
@@ -456,7 +455,7 @@
 					}
 				}
 			}
-			current_x += gl.xadvance;
+			current_x += gl.xadvance * gl.scaleH;
 		}
 	}
 

Modified: trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23072&path=/trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp	Sat Jul 13 21:05:38 2019
@@ -1163,7 +1163,7 @@
 		{
 			if (gl.glyph >= ScFace::CONTROL_GLYPHS)
 			{
-				current_x += gl.xadvance;
+				current_x += gl.xadvance * gl.scaleH;
 				continue;
 			}
 
@@ -1178,7 +1178,7 @@
 			glyph.setAttribute("style", fill + stroke);
 			m_elem.appendChild(glyph);
 
-			current_x += gl.xadvance;
+			current_x += gl.xadvance * gl.scaleH;
 		}
 	}
 
@@ -1192,7 +1192,7 @@
 		{
 			if (gl.glyph >= ScFace::CONTROL_GLYPHS)
 			{
-				current_x += gl.xadvance;
+				current_x += gl.xadvance * gl.scaleH;
 				continue;
 			}
 
@@ -1210,7 +1210,7 @@
 			glyph.setAttribute("style", fill + stroke);
 			m_elem.appendChild(glyph);
 
-			current_x += gl.xadvance;
+			current_x += gl.xadvance * gl.scaleH;
 		}
 	}
 

Modified: trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23072&path=/trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp	Sat Jul 13 21:05:38 2019
@@ -803,6 +803,15 @@
 	QMap<QString, QString> &m_fontMap;
 	QDomElement &m_relRoot;
 
+	bool    m_restart { true };
+	double  m_current_x { 0.0 };
+	double  m_current_y { 0.0 };
+	double  m_fontSize { 0.0 };
+	QString m_fontUri;
+	TextLayoutColor m_fillColor;
+	QTransform  m_transform;
+	QDomElement m_glyphElem;
+
 public:
 	XPSPainter(PageItem *item, QDomElement &group, XPSExPlug *xps, QMap<QString, QString> &XPSfontMap, QDomElement &rel_root):
 //		m_item(item),
@@ -820,37 +829,61 @@
 		if (!m_fontMap.contains(font().replacementName()))
 			m_fontMap.insert(font().replacementName(), m_xps->embedFont(font(), m_relRoot));
 		QTransform transform = matrix();
-		QDomElement glyph = m_xps->p_docu.createElement("Glyphs");
 		double size = fontSize() * qMax(gc.scaleV(), gc.scaleH()) * m_xps->conversionFactor;
-		glyph.setAttribute("RenderTransform", m_xps->MatrixToStr(transform, m_xps->conversionFactor));
-		glyph.setAttribute("BidiLevel", "0");
-		glyph.setAttribute("StyleSimulations", "None");
-		glyph.setAttribute("FontRenderingEmSize", m_xps->FToStr(size));
-		glyph.setAttribute("FontUri", m_fontMap[font().replacementName()]);
-		glyph.setAttribute("Fill", m_xps->SetColor(fillColor().color,fillColor().shade, 0));
-		glyph.setAttribute("OriginX", m_xps->FToStr(x() * m_xps->conversionFactor));
-		glyph.setAttribute("OriginY", m_xps->FToStr(y() * m_xps->conversionFactor));
-		glyph.setAttribute("UnicodeString", gc.getText());
+		QString fontUri = m_fontMap[font().replacementName()];
+
+		if (m_restart || (size != m_fontSize) || (m_fillColor != fillColor()) || (m_fontUri != fontUri) ||
+			(qAbs(m_current_x - x()) > 1e-6) || (m_current_y != y()) || (m_transform != transform))
+		{
+			m_glyphElem = m_xps->p_docu.createElement("Glyphs");
+			m_glyphElem.setAttribute("RenderTransform", m_xps->MatrixToStr(transform, m_xps->conversionFactor));
+			m_glyphElem.setAttribute("BidiLevel", "0");
+			m_glyphElem.setAttribute("StyleSimulations", "None");
+			m_glyphElem.setAttribute("FontRenderingEmSize", m_xps->FToStr(size));
+			m_glyphElem.setAttribute("FontUri", fontUri);
+			m_glyphElem.setAttribute("Fill", m_xps->SetColor(fillColor().color,fillColor().shade, 0));
+			m_glyphElem.setAttribute("OriginX", m_xps->FToStr(x() * m_xps->conversionFactor));
+			m_glyphElem.setAttribute("OriginY", m_xps->FToStr(y() * m_xps->conversionFactor));
+			m_glyphElem.setAttribute("UnicodeString", QString());
+			m_group.appendChild(m_glyphElem);
+		}
+
+		QString unicodeString = m_glyphElem.attribute("UnicodeString");
+		unicodeString += gc.getText();
+		m_glyphElem.setAttribute("UnicodeString", unicodeString);
+
+		QString indices, allIndices = m_glyphElem.attribute("Indices");
 		QString gcMap = QString("(%1:%2)").arg(gc.getText().size()).arg(gc.glyphs().size());
-		QString indices;
+
 		double current_x = 0.0;
 		for (const GlyphLayout& gl : gc.glyphs()) 
 		{
 			if (gl.glyph >= ScFace::CONTROL_GLYPHS)
 			{
-				current_x += gl.xadvance;
+				current_x += gl.xadvance * gl.scaleH;
 				continue;
 			}
 
 			indices += QString("%1,%2,%3,%4;").arg(gl.glyph)
-					.arg(((gl.xadvance + current_x) * m_xps->conversionFactor) / size * 100)
+					.arg(((gl.xadvance  * gl.scaleH) * m_xps->conversionFactor) / size * 100)
 					.arg((-gl.xoffset * m_xps->conversionFactor) / size * 100)
 					.arg((-gl.yoffset * m_xps->conversionFactor) / size * 100);
-			current_x += gl.xadvance;
+			current_x += gl.xadvance * gl.scaleH;
 		}
 		indices.chop(1);
-		glyph.setAttribute("Indices", QString("%1%2").arg(gcMap, indices));
-		m_group.appendChild(glyph);
+		
+		if (!allIndices.isEmpty())
+			allIndices += ";";
+		allIndices += QString("%1%2").arg(gcMap, indices);
+		m_glyphElem.setAttribute("Indices", allIndices);
+
+		m_restart = false;
+		m_current_x = x() + current_x;
+		m_current_y = y();
+		m_fontSize = size;
+		m_fontUri = fontUri;
+		m_fillColor = fillColor();
+		m_transform = transform;
 	}
 
 	void drawGlyphOutline(const GlyphCluster& gc, bool fill)
@@ -863,7 +896,7 @@
 		{
 			if (gl.glyph >= ScFace::CONTROL_GLYPHS)
 			{
-				current_x += gl.xadvance;
+				current_x += gl.xadvance * gl.scaleH;
 				continue;
 			}
 
@@ -886,10 +919,12 @@
 				glyph.setAttribute("StrokeThickness", m_xps->FToStr(strokeWidth() * m_xps->conversionFactor));
 				glyph.setAttribute("Stroke", m_xps->SetColor(strokeColor().color, strokeColor().shade, 0));
 				m_group.appendChild(glyph);
-				qDebug() << "StrokeWidth XPS" << strokeWidth();
-			}
-			current_x += gl.xadvance;
-		}
+				//qDebug() << "StrokeWidth XPS" << strokeWidth();
+			}
+			current_x += gl.xadvance * gl.scaleH;
+		}
+
+		m_restart = true;
 	}
 
 	void drawLine(QPointF start, QPointF end)
@@ -901,6 +936,7 @@
 		path.setAttribute("Stroke", m_xps->SetColor(strokeColor().color, strokeColor().shade, 0));
 		path.setAttribute("StrokeThickness", m_xps->FToStr(strokeWidth() * m_xps->conversionFactor));
 		m_group.appendChild(path);
+		m_restart = true;
 	}
 
 	void drawRect(QRectF rect)
@@ -922,6 +958,7 @@
 		path.setAttribute("StrokeThickness", m_xps->FToStr(strokeWidth() * m_xps->conversionFactor));
 		path.setAttribute("Stroke", m_xps->SetColor(strokeColor().color, strokeColor().shade, 0));
 		m_group.appendChild(path);
+		m_restart = true;
 	}
 
 	void drawObject(PageItem* item)
@@ -936,6 +973,7 @@
 		canvas.setAttribute("RenderTransform", m_xps->MatrixToStr(matrix));
 		m_xps->writeItemOnPage(item->gXpos, item->gYpos, item, canvas, m_relRoot);
 		m_group.appendChild(canvas);
+		m_restart = true;
 	}
 };
 
@@ -1059,9 +1097,6 @@
 //	parentElem.appendChild(grp);
 	if (Item->itemText.length() != 0)
 	{
-		XPSPainter p(Item, grp, this, xps_fontMap, rel_root);
-		Item->textLayout.renderBackground(&p);
-		Item->textLayout.render(&p);
 		QDomElement grp2 = p_docu.createElement("Canvas");
 		if (grp.hasAttribute("RenderTransform"))
 			grp2.setAttribute("RenderTransform", grp.attribute("RenderTransform"));
@@ -1069,95 +1104,9 @@
 			grp2.setAttribute("Name", grp.attribute("Name"));
 		if (grp.hasAttribute("Opacity"))
 			grp2.setAttribute("Opacity", grp.attribute("Opacity"));
-		bool first = true;
-		QString RenderTransform = "";
-		QString FontRenderingEmSize = "";
-		QString FontUri = "";
-		QString Fill = "";
-		QString OriginX = "";
-		QString OriginY = "";
-		QString Indices = "";
-		QString UnicodeString = "";
-		QDomElement glyph;
-		for (QDomElement txtGrp = grp.firstChildElement(); !txtGrp.isNull(); txtGrp = txtGrp.nextSiblingElement())
-		{
-			if (txtGrp.tagName() != "Glyphs")
-			{
-				if (!first)
-				{
-					glyph.setAttribute("Indices", Indices);
-					glyph.setAttribute("UnicodeString", UnicodeString);
-					first = true;
-				}
-				grp2.appendChild(txtGrp.cloneNode(true));
-			}
-			else
-			{
-				if (first)
-				{
-					RenderTransform = txtGrp.attribute("RenderTransform");
-					FontRenderingEmSize = txtGrp.attribute("FontRenderingEmSize");
-					FontUri = txtGrp.attribute("FontUri");
-					Fill = txtGrp.attribute("Fill");
-					OriginX = txtGrp.attribute("OriginX");
-					OriginY = txtGrp.attribute("OriginY");
-					Indices = txtGrp.attribute("Indices");
-					UnicodeString = txtGrp.attribute("UnicodeString");
-					glyph = p_docu.createElement("Glyphs");
-					glyph.setAttribute("RenderTransform", RenderTransform);
-					glyph.setAttribute("BidiLevel", "0");
-					glyph.setAttribute("StyleSimulations", "None");
-					glyph.setAttribute("FontRenderingEmSize", FontRenderingEmSize);
-					glyph.setAttribute("FontUri", FontUri);
-					glyph.setAttribute("Fill", Fill);
-					glyph.setAttribute("OriginX", OriginX);
-					glyph.setAttribute("OriginY", OriginY);
-					glyph.setAttribute("Indices", Indices);
-					glyph.setAttribute("UnicodeString", UnicodeString);
-					grp2.appendChild(glyph);
-					first = false;
-				}
-				else
-				{
-					if ((RenderTransform == txtGrp.attribute("RenderTransform")) && (FontRenderingEmSize == txtGrp.attribute("FontRenderingEmSize")) && (FontUri == txtGrp.attribute("FontUri")) && (OriginY == txtGrp.attribute("OriginY")) && (Fill == txtGrp.attribute("Fill")))
-					{
-						Indices.append(";" + txtGrp.attribute("Indices"));
-						UnicodeString.append(txtGrp.attribute("UnicodeString"));
-					}
-					else
-					{
-						glyph.setAttribute("Indices", Indices);
-						glyph.setAttribute("UnicodeString", UnicodeString);
-						RenderTransform = txtGrp.attribute("RenderTransform");
-						FontRenderingEmSize = txtGrp.attribute("FontRenderingEmSize");
-						FontUri = txtGrp.attribute("FontUri");
-						Fill = txtGrp.attribute("Fill");
-						OriginX = txtGrp.attribute("OriginX");
-						OriginY = txtGrp.attribute("OriginY");
-						Indices = txtGrp.attribute("Indices");
-						UnicodeString = txtGrp.attribute("UnicodeString");
-						glyph = p_docu.createElement("Glyphs");
-						glyph.setAttribute("RenderTransform", RenderTransform);
-						glyph.setAttribute("BidiLevel", "0");
-						glyph.setAttribute("StyleSimulations", "None");
-						glyph.setAttribute("FontRenderingEmSize", FontRenderingEmSize);
-						glyph.setAttribute("FontUri", FontUri);
-						glyph.setAttribute("Fill", Fill);
-						glyph.setAttribute("OriginX", OriginX);
-						glyph.setAttribute("OriginY", OriginY);
-						glyph.setAttribute("Indices", Indices);
-						glyph.setAttribute("UnicodeString", UnicodeString);
-						grp2.appendChild(glyph);
-						first = false;
-					}
-				}
-				if (txtGrp == grp.lastChildElement())
-				{
-					glyph.setAttribute("Indices", Indices);
-					glyph.setAttribute("UnicodeString", UnicodeString);
-				}
-			}
-		}
+		XPSPainter p(Item, grp2, this, xps_fontMap, rel_root);
+		Item->textLayout.renderBackground(&p);
+		Item->textLayout.render(&p);
 		parentElem.appendChild(grp2);
 	}
 	if (Item->isTextFrame())

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23072&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp	(original)
+++ trunk/Scribus/scribus/pslib.cpp	Sat Jul 13 21:05:38 2019
@@ -115,7 +115,7 @@
 	{
 		if (gl.glyph >= ScFace::CONTROL_GLYPHS)
 		{
-			current_x += gl.xadvance;
+			current_x += gl.xadvance * gl.scaleH;
 			continue;
 		}
 
@@ -129,7 +129,7 @@
 		m_ps->PS_showSub(gl.glyph, m_ps->FontSubsetMap[font().scName()], fontSize(), false);
 		m_ps->PS_restore();
 
-		current_x += gl.xadvance;
+		current_x += gl.xadvance * gl.scaleH;
 	}
 	m_ps->PS_restore();
 }
@@ -156,7 +156,7 @@
 	{
 		if (gl.glyph >= ScFace::CONTROL_GLYPHS)
 		{
-			current_x += gl.xadvance;
+			current_x += gl.xadvance * gl.scaleH;
 			continue;
 		}
 
@@ -166,11 +166,17 @@
 		chma.scale((fontSize() * gc.scaleH()) / 10.0, (fontSize() * gc.scaleV()) / 10.0);
 		gly.map(chma);
 		m_ps->PS_translate(gl.xoffset + current_x, -(fontSize() - fontSize() * gc.scaleV()) - gl.yoffset);
-		if (gc.scaleH() != 1.0 || gc.scaleV() != 1.0)
-			m_ps->PS_scale(gc.scaleH(), gc.scaleV());
+
 		if (fill)
+		{
+			m_ps->PS_save();
+			if (gc.scaleH() != 1.0 || gc.scaleV() != 1.0)
+				m_ps->PS_scale(gc.scaleH(), gc.scaleV());
 			m_ps->putColorNoDraw(fillColor().color, fillColor().shade);
-		m_ps->PS_showSub(gl.glyph, m_ps->FontSubsetMap[font().scName()], fontSize(), false);
+			m_ps->PS_showSub(gl.glyph, m_ps->FontSubsetMap[font().scName()], fontSize(), false);
+			m_ps->PS_restore();
+		}
+
 		m_ps->SetColor(strokeColor().color, strokeColor().shade, &h, &s, &v, &k);
 		m_ps->PS_setcmykcolor_stroke(h, s, v, k);
 		m_ps->SetClipPath(gly, true);
@@ -178,7 +184,7 @@
 		m_ps->putColor(strokeColor().color, strokeColor().shade, false);
 		m_ps->PS_restore();
 
-		current_x += gl.xadvance;
+		current_x += gl.xadvance * gl.scaleH;
 	}
 
 	m_ps->PS_restore();

Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23072&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp	(original)
+++ trunk/Scribus/scribus/scpageoutput.cpp	Sat Jul 13 21:05:38 2019
@@ -1002,7 +1002,7 @@
 			if (outline.size() > 3)
 				m_painter->fillPath();
 			m_painter->restore();
-			m_painter->translate(gl.xadvance, 0.0);
+			m_painter->translate(gl.xadvance * gl.scaleH, 0.0);
 		}
 
 		m_painter->setFillMode(fm);
@@ -1030,9 +1030,11 @@
 			m_painter->translate(gl.xoffset + current_x, -(fontSize() * gc.scaleV()) + gl.yoffset);
 
 			FPointArray outline = font().glyphOutline(gl.glyph);
-			double scaleH = gc.scaleH() * fontSize() / 10.0;
-			double scaleV = gc.scaleV() * fontSize() / 10.0;
-			m_painter->scale(scaleH, scaleV);
+			double scaleH = gl.scaleH * fontSize() / 10.0;
+			double scaleV = gl.scaleV * fontSize() / 10.0;
+			QTransform trans;
+			trans.scale(scaleH, scaleV);
+			outline.map(trans);
 			m_painter->setupPolygon(&outline, true);
 			if (outline.size() > 3)
 			{
@@ -1040,7 +1042,7 @@
 				m_painter->strokePath();
 			}
 			m_painter->restore();
-			current_x += gl.xadvance;
+			current_x += gl.xadvance * gl.scaleH;
 		}
 
 		m_painter->setFillRule(fr);

Modified: trunk/Scribus/scribus/text/screenpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23072&path=/trunk/Scribus/scribus/text/screenpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/text/screenpainter.cpp	(original)
+++ trunk/Scribus/scribus/text/screenpainter.cpp	Sat Jul 13 21:05:38 2019
@@ -82,8 +82,8 @@
 		cairo_set_font_size(cr, fontSize());
 
 		double current_x = 0.0;
+		cairo_scale(cr, gc.scaleH(), gc.scaleV());
 		for (const GlyphLayout& gl : gc.glyphs()) {
-			cairo_scale(cr, gl.scaleH, gl.scaleV);
 			cairo_glyph_t glyph = { gl.glyph, gl.xoffset + current_x, gl.yoffset };
 			cairo_show_glyphs(cr, &glyph, 1);
 			current_x += gl.xadvance;
@@ -227,7 +227,7 @@
 			if (outline.size() > 3)
 				m_painter->fillPath();
 			m_painter->restore();
-			m_painter->translate(gl.xadvance, 0.0);
+			m_painter->translate(gl.xadvance * gl.scaleH, 0.0);
 		}
 	}
 	m_painter->setFillRule(fr);
@@ -239,6 +239,7 @@
 {
 	if (fill)
 		drawGlyph(gc);
+
 	m_painter->save();
 	bool fr = m_painter->fillRule();
 	m_painter->setFillRule(false);
@@ -249,6 +250,7 @@
 	{
 		m_painter->save();
 		m_painter->translate(gl.xoffset + current_x, - (fontSize() * gl.scaleV) + gl.yoffset );
+
 		FPointArray outline = font().glyphOutline(gl.glyph);
 		double scaleHv = gl.scaleH * fontSize() / 10.0;
 		double scaleVv = gl.scaleV * fontSize() / 10.0;
@@ -262,12 +264,11 @@
 			m_painter->strokePath();
 		}
 		m_painter->restore();
-		current_x += gl.xadvance;
+		current_x += gl.xadvance * gl.scaleH;
 	}
 
 	m_painter->setFillRule(fr);
 	m_painter->restore();
-
 }
 
 void ScreenPainter::drawLine(QPointF start, QPointF end)




More information about the scribus-commit mailing list