r24175 by jghali - #16289: Certain fonts produce weird space characters when copy/pasting from PDF

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 4 17:05:22 UTC 2020


Author: jghali
Date: Wed Nov  4 17:05:22 2020
New Revision: 24175

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24175
Log:
#16289: Certain fonts produce weird space characters when copy/pasting from PDF

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

Modified: trunk/Scribus/scribus/fonts/scface_ttf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24175&path=/trunk/Scribus/scribus/fonts/scface_ttf.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scface_ttf.cpp	(original)
+++ trunk/Scribus/scribus/fonts/scface_ttf.cpp	Wed Nov  4 17:05:22 2020
@@ -86,9 +86,21 @@
 		return FtFace::glyphNames(glyphList);
 	
 //	qDebug() << "reading metrics for" << face->family_name << face->style_name;
+	int spaceGlyphIndex = -1;
+
 	charcode = FT_Get_First_Char(face, &gindex);
 	while (gindex != 0)
 	{
+		// #16289 : Protect space character in case several characters are
+		// mapped to same glyph as space
+		if (charcode == ' ')
+			spaceGlyphIndex = gindex;
+		if ((gindex == spaceGlyphIndex) && (charcode != ' '))
+		{
+			charcode = FT_Get_Next_Char(face, charcode, &gindex);
+			continue;
+		}
+
 		ScFace::GlyphEncoding glEncoding;
 		glEncoding.charcode  = charcode;
 		glEncoding.glyphName = adobeGlyphName(charcode);




More information about the scribus-commit mailing list