View Issue Details

IDProjectCategoryView StatusLast Update
0015982ScribusBuild Systempublic2019-12-10 10:12
Reporterale Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version1.5.6.svn 
Target VersionFixed in Version 
Summary0015982: [PATCH] remove #elif-ed code that cannot compile in scfonts.cpp
Descriptionthis branch

https://gitlab.com/scribus/scribus/blob/master/scribus/scfonts.cpp#L1193

cannot compile

pos2 = paths.find("\n",pos+1);

QString does not seem to have a find() function.

.... and i don't think that we can have a linux build without fontconfig...
TagsNo tags attached.
PatchYes

Activities

ale

2019-12-02 10:49

manager   ~0047189

the same #elif in can also probably be removed in scfonts.h

ale

2019-12-09 08:15

manager   ~0047224

the "dead branch" is because it's an elif to "if fontconfig"... and i don't think it's possible to have a linux system without fontconfig.

ale

2019-12-10 10:10

manager   ~0047237

Last edited: 2019-12-10 10:10

View 2 revisions

here is the patch



scfonts-no-linux-without-fontconfig.diff (2,531 bytes)
diff --git a/scribus/scfonts.cpp b/scribus/scfonts.cpp
index ac3f87733..ecfac34b2 100644
--- a/scribus/scfonts.cpp
+++ b/scribus/scfonts.cpp
@@ -1190,71 +1190,6 @@ void SCFonts::addType1RegistryFonts()
 	FT_Done_FreeType(library);
 }
 
-#elif defined(Q_OS_LINUX)
-
-void SCFonts::addXFontPath()
-{
-	int pathcount,i;
-	Display *display=XOpenDisplay(nullptr);
-	char **fontpath=XGetFontPath(display,&pathcount);
-	for (i=0; i<pathcount; ++i)
-		addPath(fontpath[i]);
-	XFreeFontPath(fontpath);
-}
-
-/* replacement for addXFontServerPath() for correctly parsing
- * RedHad-Style /etc/X11/fs/config files */
-
-void SCFonts::addXFontServerPath()
-{
-	QFile fs("/etc/X11/fs/config");
-	if (!(fs.exists()))
-	{
-		fs.setName("/usr/X11R6/lib/X11/fs/config");
-		if (!(fs.exists()))
-		{
-			fs.setName("/usr/X11/lib/X11/fs/config");
-			if (!(fs.exists()))
-				return;
-		}
-	}
-
-	if (fs.open(QIODevice::ReadOnly))
-	{
-		QString fsconfig,paths,tmp;
-		QTextStream tsx(&fs);
-		fsconfig = tsx.readAll();
-		fs.close();
-
-		int pos = fsconfig.find("catalogue");
-		paths = fsconfig.mid(pos);
-		paths = paths.mid(paths.find("=")+1);
-
-		pos=0;
-		do {
-			pos = paths.find("\n",pos+1);
-		} while (pos > -1 && paths.mid(pos-1, 1) == ",");
-
-		if (pos<0) pos=paths.length();
-		paths = paths.left(pos);
-		paths = paths.simplified();
-		paths.replace(QRegExp(" "), "");
-		paths.replace(QRegExp(","), "\n");
-		paths += "\n";
-		paths = paths.trimmed();
-
-		pos=-1;
-		do {
-			int pos2;
-			pos2 = paths.find("\n",pos+1);
-			tmp = paths.mid(pos+1,(pos2-pos)-1);
-			pos=pos2;
-
-			addPath(tmp);
-
-		} while (pos > -1);
-	}
-}
 #endif
 
 /* Add an extra path to our font search path,
@@ -1387,12 +1322,7 @@ void SCFonts::getFonts(const QString& pf, bool showFontInfo)
 		addScalableFonts(*fpi);
 	addFontconfigFonts();
 #else
-// on X11 look there:
-#ifdef Q_OS_LINUX
-	addXFontPath();
-	addXFontServerPath();
-#endif
-// add user and X11 fonts:
+	// add user and X11 fonts:
 	QStringList::iterator fpi, fpend = m_fontPaths.end();
 	for (fpi = m_fontPaths.begin() ; fpi != fpend; ++fpi) 
 		addScalableFonts(*fpi);
diff --git a/scribus/scfonts.h b/scribus/scfonts.h
index 09c8b63cf..d4e78ff74 100644
--- a/scribus/scfonts.h
+++ b/scribus/scfonts.h
@@ -73,9 +73,6 @@ class SCRIBUS_API SCFonts : public QMap<QString,ScFace>
 #elif defined(Q_OS_WIN32)
 		void addRegistryFonts();
 		void addType1RegistryFonts();
-#elif defined(Q_OS_LINUX)
-		void addXFontServerPath();
-		void addXFontPath();
 #endif
 		QStringList m_fontPaths;
 

Issue History

Date Modified Username Field Change
2019-12-02 10:45 ale New Issue
2019-12-02 10:49 ale Note Added: 0047189
2019-12-09 08:15 ale Note Added: 0047224
2019-12-10 10:10 ale File Added: scfonts-no-linux-without-fontconfig.diff
2019-12-10 10:10 ale Note Added: 0047237
2019-12-10 10:10 ale Note Edited: 0047237 View Revisions
2019-12-10 10:12 ale Summary remove #elif-ed code that cannot compile in scfonts.cpp => [PATCH] remove #elif-ed code that cannot compile in scfonts.cpp
2019-12-10 10:12 ale Patch No => Yes