r23468 by jghali - Backport r23078: do not remove from cache fonts located in another local Scribus font folder (due to user having multiple versions installed for eg.)

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 20 15:01:29 UTC 2020


Author: jghali
Date: Thu Feb 20 15:01:29 2020
New Revision: 23468

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23468
Log:
Backport r23078: do not remove from cache fonts located in another local Scribus font folder (due to user having multiple versions installed for eg.)

Modified:
    branches/Version14x/Scribus/scribus/scfonts.cpp

Modified: branches/Version14x/Scribus/scribus/scfonts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23468&path=/branches/Version14x/Scribus/scribus/scfonts.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scfonts.cpp	(original)
+++ branches/Version14x/Scribus/scribus/scfonts.cpp	Thu Feb 20 15:01:29 2020
@@ -817,23 +817,31 @@
 {
 	QDomDocument docu("fontcacherc");
 	QString st="<CachedFonts></CachedFonts>";
+	
 	docu.setContent(st);
 	QDomElement elem = docu.documentElement();
 	QMap<QString, testCache>::Iterator it;
 	for (it = checkedFonts.begin(); it != checkedFonts.end(); ++it)
 	{
-		if (it.value().isChecked)
-		{
-			QDomElement fosu = docu.createElement("Font");
-			fosu.setAttribute("File",it.key());
-			fosu.setAttribute("Status",static_cast<int>(it.value().isOK));
-			fosu.setAttribute("Modified",it.value().lastMod.toString(Qt::ISODate));
-			elem.appendChild(fosu);
-		}
-	}
+		const testCache& checkedFont = it.value();
+		
+		bool saveItem = checkedFont.isChecked;
+		if (!checkedFont.isChecked) // Font might be located in another local Scribus font folder
+			saveItem = QFile::exists(it.key());
+		if (!saveItem)
+			continue;
+		
+		QDomElement fosu = docu.createElement("Font");
+		fosu.setAttribute("File",it.key());
+		fosu.setAttribute("Status", static_cast<int>(it.value().isOK));
+		fosu.setAttribute("Modified", it.value().lastMod.toString(Qt::ISODate));
+		elem.appendChild(fosu);
+	}
+	
 	ScCore->setSplashStatus( QObject::tr("Writing updated Font Cache") );
+	
 	QFile f(pf + "/checkfonts.xml");
-	if(f.open(QIODevice::WriteOnly))
+	if (f.open(QIODevice::WriteOnly))
 	{
 		QTextStream s(&f);
 		s.setCodec("UTF-8");




More information about the scribus-commit mailing list