r24427 by jghali - Make PDFLibCore's PDF_EncodeCidFont a bit more readable

scribus-commit scribus-commit at lists.scribus.net
Mon Jan 25 20:44:02 UTC 2021


Author: jghali
Date: Mon Jan 25 20:44:01 2021
New Revision: 24427

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24427
Log:
Make PDFLibCore's PDF_EncodeCidFont a bit more readable

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24427&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Mon Jan 25 20:44:01 2021
@@ -1823,28 +1823,29 @@
 	QList<int> toUnicodeMapsCount;
 	QByteArray toUnicodeMap;
 	int toUnicodeMapCounter = 0;
+
+	QList<uint> keys = gl.uniqueKeys();
+	bool seenNotDef = false;
 	
 	PutDoc("[ ");
-	QList<uint> keys = gl.uniqueKeys();
-	bool seenNotDef = false;
 	for (auto git = keys.begin(); git != keys.end(); ++git)
 	{
-		uint gid = (result.encoding == Encode_Subset) ? glyphmap[*git] : *git;
-		if (gid > 0 || !seenNotDef)
-		{
-			seenNotDef |= (gid == 0);
-			PutDoc(Pdf::toPdf(gid) + " [" + Pdf::toPdf(static_cast<int>(face.glyphWidth(*git) * 1000)) + "] ");
-			QString tmp = QString::asprintf("%04X", gid);
-			QString tmp2 = gl.value(*git).toUnicode;
-			toUnicodeMap += "<" + Pdf::toAscii(tmp) + "> <" + Pdf::toAscii(tmp2) + ">\n";
-			toUnicodeMapCounter++;
-			if (toUnicodeMapCounter == 100)
-			{
-				toUnicodeMaps.append(toUnicodeMap);
-				toUnicodeMapsCount.append(toUnicodeMapCounter);
-				toUnicodeMap.clear();
-				toUnicodeMapCounter = 0;
-			}
+		uint gid = (result.encoding == Encode_Subset) ? glyphmap.value(*git, 0) : *git;
+		if (gid == 0 && seenNotDef)
+			continue;
+		seenNotDef |= (gid == 0);
+
+		PutDoc(Pdf::toPdf(gid) + " [" + Pdf::toPdf(static_cast<int>(face.glyphWidth(*git) * 1000)) + "] ");
+		QString tmp = QString::asprintf("%04X", gid);
+		QString tmp2 = gl.value(*git).toUnicode;
+		toUnicodeMap += "<" + Pdf::toAscii(tmp) + "> <" + Pdf::toAscii(tmp2) + ">\n";
+		toUnicodeMapCounter++;
+		if (toUnicodeMapCounter == 100)
+		{
+			toUnicodeMaps.append(toUnicodeMap);
+			toUnicodeMapsCount.append(toUnicodeMapCounter);
+			toUnicodeMap.clear();
+			toUnicodeMapCounter = 0;
 		}
 	}
 	PutDoc("]");




More information about the scribus-commit mailing list