r20176 by avox - fix ttf subsetting for accented chars

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 18 23:57:58 UTC 2015


Author: avox
Date: Thu Jun 18 23:57:57 2015
New Revision: 20176

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20176
Log:
fix ttf subsetting for accented chars

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

Modified: trunk/Scribus/scribus/fonts/sfnt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20176&path=/trunk/Scribus/scribus/fonts/sfnt.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/sfnt.cpp (original)
+++ trunk/Scribus/scribus/fonts/sfnt.cpp Thu Jun 18 23:57:57 2015
@@ -944,16 +944,12 @@
 			/* glyphindex */
 			uint glyphIndex = word16(srcGlyf, pos);
 			pos += 2;
-			if (newForOldGid.contains(glyphIndex))
-			{
-				glyphIndex = newForOldGid[glyphIndex];
-			}
-			else
-			{
-				glyphIndex = nextFreeGid++;
+			if (!newForOldGid.contains(glyphIndex))
+			{
 				result.append(glyphIndex);
-				newForOldGid[glyphIndex] = glyphIndex;
-			}
+				newForOldGid[glyphIndex] = nextFreeGid++;
+			}
+			glyphIndex = newForOldGid[glyphIndex];
 			appendWord16(destGlyf, glyphIndex);
 			
 			/* args */
@@ -1015,7 +1011,7 @@
 		if (glyphLength > 0)
 		{
 			uint nrOfContours = word16(srcGlyf, glyphStart);
-			if (nrOfContours > 0)
+			if (nrOfContours <= ttf_glyf_Max_numberOfContours)
 			{
 				// simple glyph
 				uint destStart = destGlyf.size();

Modified: trunk/Scribus/scribus/fonts/sfnt_format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20176&path=/trunk/Scribus/scribus/fonts/sfnt_format.h
==============================================================================
--- trunk/Scribus/scribus/fonts/sfnt_format.h (original)
+++ trunk/Scribus/scribus/fonts/sfnt_format.h Thu Jun 18 23:57:57 2015
@@ -93,6 +93,8 @@
 
 enum TTF_glyf_Format {
     ttf_glyf_numberOfContours = 0,
+    ttf_glyf_Max_numberOfContours = 0x7fff,
+
     ttf_glyf_xMin = 2,
     ttf_glyf_yMin = 4,
     ttf_glyf_xMax = 6,




More information about the scribus-commit mailing list