r22008 by jghali - #14786: Font outlining artefacts in PDF export

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 29 10:51:46 UTC 2017


Author: jghali
Date: Sat Apr 29 10:51:46 2017
New Revision: 22008

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22008
Log:
#14786: Font outlining artefacts in PDF export

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22008&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Sat Apr 29 10:51:46 2017
@@ -1423,6 +1423,13 @@
 	result.method = Use_Type3;
 	result.encoding = Encode_256;
 
+	// TrueType font rasterizers use non-zero winding file rule,
+	// vs even-odd for current Postscript font rasterizers
+	// Note: OTF CFF2 will also use non-zero winding rule, so
+	// change code below when adding CCF2 support to Scribus
+	// ref: https://www.microsoft.com/typography/OTSpec/cff2.htm
+	bool useNonZeroRule = (face.type() == ScFace::TTF);
+
 	uint SubFonts = 0;
 	int glyphCount = 0;
 	double minx =  std::numeric_limits<double>::max();
@@ -1468,7 +1475,7 @@
 				np2 = gly.point(poi+2);
 				fon += FToStr(np.x()) + " " + FToStr(np.y()) + " " + FToStr(np1.x()) + " " + FToStr(np1.y()) + " " + FToStr(np2.x()) + " " + FToStr(np2.y()) + " c\n";
 			}
-			fon += "h f*\n";
+			fon += useNonZeroRule? "h f\n" : "h f*\n";
 			np = getMinClipF(&gly);
 			np1 = getMaxClipF(&gly);
 		}
@@ -1565,6 +1572,13 @@
 	result.method = Use_XForm;
 	result.encoding = Encode_224;
 
+	// TrueType font rasterizers use non-zero winding file rule,
+	// vs even-odd for current Postscript font rasterizers
+	// Note: OTF CFF2 will also use non-zero winding rule, so
+	// change code below when adding CCF2 support to Scribus
+	// ref: https://www.microsoft.com/typography/OTSpec/cff2.htm
+	bool useNonZeroRule = (face.type() == ScFace::TTF);
+
 	QByteArray fon;
 	QMap<uint,FPointArray>::ConstIterator ig;
 	for (ig = RealGlyphs.cbegin(); ig != RealGlyphs.cend(); ++ig)
@@ -1599,7 +1613,7 @@
 				FToStr(np1.x()) + " " + FToStr(-np1.y()) + " " +
 				FToStr(np2.x()) + " " + FToStr(-np2.y()) + " c\n";
 			}
-			fon += "h f*\n";
+			fon += useNonZeroRule? "h f\n" : "h f*\n";
 			np = getMinClipF(&gly);
 			np1 = getMaxClipF(&gly);
 		}




More information about the scribus-commit mailing list