r21092 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sat Mar 19 13:27:04 UTC 2016


Author: jghali
Date: Sat Mar 19 13:27:03 2016
New Revision: 21092

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21092
Log:
#13823: Export to PDF with subsetted Wingding font crashes scribus

Modified:
    trunk/Scribus/scribus/fonts/sfnt.cpp

Modified: trunk/Scribus/scribus/fonts/sfnt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21092&path=/trunk/Scribus/scribus/fonts/sfnt.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/sfnt.cpp	(original)
+++ trunk/Scribus/scribus/fonts/sfnt.cpp	Sat Mar 19 13:27:03 2016
@@ -674,14 +674,15 @@
 		
 		uint numSubtables = word16(cmaps, ttf_cmap_numberSubtables);
 		uint startOfUnicodeTable = 0;
-		uint format = 0;
+		uint startOfSymbolTable = 0;
+		uint unicodeFormat = 0, symbolFormat = 0;
 		uint pos = ttf_cmap_encodings;
 		for (uint i = 0; i < numSubtables; ++i)
 		{
 			uint platform = word16(cmaps, pos + ttf_cmap_encoding_platformID);
 			uint encoding = word16(cmaps, pos + ttf_cmap_encoding_platformSpecificID);
 			uint offset = word(cmaps, pos + ttf_cmap_encoding_offset);
-			format = word16(cmaps, offset + ttf_cmapx_format);
+			uint format = word16(cmaps, offset + ttf_cmapx_format);
 			pos += ttf_cmap_encoding_Size;
 			
 			if (format < 4 || format > 12)
@@ -689,9 +690,23 @@
 			if (platform == 0 || (platform == 3 && encoding == 1))
 			{
 				startOfUnicodeTable = offset;
+				unicodeFormat = format;
 				break;
 			}
+			if (platform == 3 && encoding == 0) // MS Symbol cmap
+			{
+				startOfSymbolTable = offset;
+				symbolFormat = format;
+				continue;
+			}
 			format = 1; // no such format
+		}
+		// If no unicode cmap was found, fallback on ms symbol cmap
+		uint format = unicodeFormat;
+		if ((unicodeFormat <= 0) && (symbolFormat > 0))
+		{
+			startOfUnicodeTable = startOfSymbolTable;
+			format = symbolFormat;
 		}
 		qDebug() << "reading cmap format" << format;
 		switch(format)




More information about the scribus-commit mailing list