r23079 by jghali - Refactor ScFonts

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 14 01:19:04 UTC 2019


Author: jghali
Date: Sun Jul 14 01:19:04 2019
New Revision: 23079

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23079
Log:
Refactor ScFonts

Modified:
    trunk/Scribus/scribus/fonts/ftface.cpp
    trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/scfonts.cpp
    trunk/Scribus/scribus/scfonts.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/prefs_fonts.cpp

Modified: trunk/Scribus/scribus/fonts/ftface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23079&path=/trunk/Scribus/scribus/fonts/ftface.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/ftface.cpp	(original)
+++ trunk/Scribus/scribus/fonts/ftface.cpp	Sun Jul 14 01:19:04 2019
@@ -435,13 +435,6 @@
 		bb.resize(0);
 		status = qMax(status, ScFace::BROKENGLYPHS);
 	}
-/*	
-//	 if (showFontInformation)
-	 {
-		 QFile f(fontFile);
-		 qDebug(QObject::tr("RawData for Font %1(%2): size=%3 filesize=%4").arg(fontFile).arg(faceIndex).arg(bb.size()).arg(f.size()));
-	 }
-*/	 
-}
-
-
+}
+
+

Modified: trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23079&path=/trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xps/importxps.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/xps/importxps.cpp	Sun Jul 14 01:19:04 2019
@@ -1939,7 +1939,7 @@
 	{
 		ft.write(fontData);
 		ft.close();
-		t = PrefsManager::instance().appPrefs.fontPrefs.AvailFonts.LoadScalableFont(fname);
+		t = PrefsManager::instance().appPrefs.fontPrefs.AvailFonts.loadScalableFont(fname);
 		loadedFonts.insert(fileName, t);
 		return t;
 	}

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23079&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Sun Jul 14 01:19:04 2019
@@ -1138,7 +1138,7 @@
 //Changed to return false when we have no fonts
 bool PrefsManager::GetAllFonts(bool showFontInfo)
 {
-	appPrefs.fontPrefs.AvailFonts.GetFonts(m_prefsLocation, showFontInfo);
+	appPrefs.fontPrefs.AvailFonts.getFonts(m_prefsLocation, showFontInfo);
 	return !appPrefs.fontPrefs.AvailFonts.isEmpty();
 }
 

Modified: trunk/Scribus/scribus/scfonts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23079&path=/trunk/Scribus/scribus/scfonts.cpp
==============================================================================
--- trunk/Scribus/scribus/scfonts.cpp	(original)
+++ trunk/Scribus/scribus/scfonts.cpp	Sun Jul 14 01:19:04 2019
@@ -77,8 +77,8 @@
 SCFonts::SCFonts()
 {
 //	insert("", ScFace::none()); // Wtf why inserting an empty entry here ????
-	showFontInformation=false;
-	checkedFonts.clear();
+	m_showFontInfo=false;
+	m_checkedFonts.clear();
 }
 
 SCFonts::~SCFonts()
@@ -115,15 +115,15 @@
    Checks to make sure this path is not already present
    before adding.
 */
-void SCFonts::AddPath(QString p)
+void SCFonts::addPath(QString p)
 {
 	if (p.right(1) != "/")
 		p += "/";
-	if (!FontPath.contains(p))
-		FontPath.insert(FontPath.count(),p);
-}
-
-void SCFonts::AddScalableFonts(const QString &path, const QString& DocName)
+	if (!m_fontPaths.contains(p))
+		m_fontPaths.insert(m_fontPaths.count(),p);
+}
+
+void SCFonts::addScalableFonts(const QString &path, const QString& DocName)
 {
 	//Make sure this is not empty or we will scan the whole drive on *nix
 	//QString()+/ is / of course.
@@ -183,7 +183,7 @@
 						continue;
 				}
 				if (DocName.isEmpty())
-					AddScalableFonts(pathfile);
+					addScalableFonts(pathfile);
 				continue;
 			}
 			QString ext = fi.suffix().toLower();
@@ -192,14 +192,14 @@
 				ext = ext2;
 			if ((ext == "ttc") || (ext == "dfont") || (ext == "pfa") || (ext == "pfb") || (ext == "ttf") || (ext == "otf"))
 			{
-				AddScalableFont(pathfile, library, DocName);
+				addScalableFont(pathfile, library, DocName);
 			}
 #ifdef Q_OS_MAC
 			else if (ext.isEmpty() && DocName.isEmpty())
 			{
-				bool error = AddScalableFont(pathfile, library, DocName);
+				bool error = addScalableFont(pathfile, library, DocName);
 				if (error)
-					error = AddScalableFont(pathfile + "/..namedfork/rsrc",library, DocName);
+					error = addScalableFont(pathfile + "/..namedfork/rsrc",library, DocName);
 			}
 #endif				
 		}
@@ -489,7 +489,7 @@
 	return fontFeatures;
 }
 
-ScFace SCFonts::LoadScalableFont(const QString &filename)
+ScFace SCFonts::loadScalableFont(const QString &filename)
 {
 	ScFace t;
 	if (filename.isEmpty())
@@ -628,7 +628,7 @@
 }
 
 // Load a single font into the library from the passed filename. Returns true on error.
-bool SCFonts::AddScalableFont(const QString& filename, FT_Library &library, const QString& DocName)
+bool SCFonts::addScalableFont(const QString& filename, FT_Library &library, const QString& DocName)
 {
 	static bool firstRun;
 	bool Subset = false;
@@ -649,7 +649,7 @@
 	foCache.isOK = false;
 	foCache.isChecked = true;
 	foCache.lastMod = lastMod;
-	if (checkedFonts.count() == 0)
+	if (m_checkedFonts.count() == 0)
 	{
 		firstRun = true;
 		ScCore->setSplashStatus( QObject::tr("Creating Font Cache") );
@@ -659,9 +659,9 @@
 	{
 		if (face != nullptr)
 			FT_Done_Face(face);
-		checkedFonts.insert(filename, foCache);
+		m_checkedFonts.insert(filename, foCache);
 		addRejectedFont(filename, QObject::tr("Font is broken: \"%1\"").arg(getFtError(error)));
-		if (showFontInformation)
+		if (m_showFontInfo)
 			sDebug(QObject::tr("Font %1 is broken, discarding it. Error message: \"%2\"").arg(filename, getFtError(error)));
 		return true;
 	}
@@ -669,10 +669,10 @@
 	if (format == ScFace::UNKNOWN_FORMAT) 
 	{
 		addRejectedFont(filename, QObject::tr("Failed to load font: font type unknown"));
-		if (showFontInformation)
+		if (m_showFontInfo)
 			sDebug(QObject::tr("Failed to load font %1 - font type unknown").arg(filename));
 		FT_Done_Face(face);
-		checkedFonts.insert(filename, foCache);
+		m_checkedFonts.insert(filename, foCache);
 		return true;
 	}
 	// Some fonts such as Noto ColorEmoji are in fact bitmap fonts
@@ -680,15 +680,15 @@
 	if (face->units_per_EM == 0)
 	{
 		addRejectedFont(filename, QObject::tr("Failed to load font: font is not scalable"));
-		if (showFontInformation)
+		if (m_showFontInfo)
 			sDebug(QObject::tr("Failed to load font %1 - font is not scalable").arg(filename));
 		FT_Done_Face(face);
-		checkedFonts.insert(filename, foCache);
+		m_checkedFonts.insert(filename, foCache);
 		return true;
 	}
 	bool HasNames = FT_HAS_GLYPH_NAMES(face);
 
-	if (!checkedFonts.contains(filename))
+	if (!m_checkedFonts.contains(filename))
 	{
 		if (!firstRun)
 			ScCore->setSplashStatus( QObject::tr("New Font found, checking...") );
@@ -705,10 +705,10 @@
 							   .arg(charcode, 4, 16, QChar('0'))
 							   .arg(getFtError(error));
 				addRejectedFont(filename, errorMessage);
-				if (showFontInformation)
+				if (m_showFontInfo)
 					sDebug(errorMessage);
 				FT_Done_Face(face);
-				checkedFonts.insert(filename, foCache);
+				m_checkedFonts.insert(filename, foCache);
 				return true;
 			}
 			FT_Get_Glyph_Name(face, gindex, buf, 50);
@@ -722,17 +722,18 @@
 			charcode = FT_Get_Next_Char( face, charcode, &gindex );
 		}
 		foCache.isOK = true;
-		checkedFonts.insert(filename, foCache);
+		m_checkedFonts.insert(filename, foCache);
 	}
 	else
 	{
-		if (!checkedFonts[filename].isOK)
-		{
-			checkedFonts[filename].isChecked = true;
+		auto& checkedFont = m_checkedFonts[filename];
+		if (!checkedFont.isOK)
+		{
+			checkedFont.isChecked = true;
 			FT_Done_Face(face);
 			return true;
 		}
-		if (checkedFonts[filename].lastMod != foCache.lastMod)
+		if (checkedFont.lastMod != foCache.lastMod)
 		{
 			ScCore->setSplashStatus( QObject::tr("Modified Font found, checking...") );
 			FT_UInt gindex = 0;
@@ -748,10 +749,10 @@
 								   .arg(charcode, 4, 16, QChar('0'))
 								   .arg(getFtError(error));
 					addRejectedFont(filename, errorMessage);
-					if (showFontInformation)
+					if (m_showFontInfo)
 						sDebug(errorMessage);
 					FT_Done_Face(face);
-					checkedFonts.insert(filename, foCache);
+					m_checkedFonts.insert(filename, foCache);
 					return true;
 				}
 				FT_Get_Glyph_Name(face, gindex, buf, 50);
@@ -765,12 +766,12 @@
 				charcode = FT_Get_Next_Char( face, charcode, &gindex );
 			}
 			foCache.isOK = true;
-			checkedFonts[filename] = foCache;
+			checkedFont = foCache;
 		}
 		else
 		{
-			checkedFonts[filename].isOK = true;
-			checkedFonts[filename].isChecked = true;
+			checkedFont.isOK = true;
+			checkedFont.isChecked = true;
 		}
 	}
 
@@ -876,7 +877,7 @@
 				t.subset(true);
 			t.m_m->forDocument = DocName;
 			//setBestEncoding(face); //AV
-			if (showFontInformation)
+			if (m_showFontInfo)
 				sDebug(QObject::tr("Font %1 loaded from %2(%3)").arg(t.psName()).arg(filename).arg(faceIndex+1));
 
 /*
@@ -892,7 +893,7 @@
 		}
 		else 
 		{
-			if (showFontInformation)
+			if (m_showFontInfo)
 				sDebug(QObject::tr("Font %1(%2) is duplicate of %3").arg(filename).arg(faceIndex+1).arg(t.fontPath()));
 			// this is needed since eg. AppleSymbols will happily return a face for *any* face_index
 			if (faceIndex > 0) {
@@ -982,7 +983,7 @@
 
 #ifdef HAVE_FONTCONFIG
 // Use Fontconfig to locate and load fonts.
-void SCFonts::AddFontconfigFonts()
+void SCFonts::addFontconfigFonts()
 {
 	// All-in-one library setup. Perhaps this should be in
 	// the SCFonts constructor.
@@ -998,7 +999,7 @@
 	FcObjectSet* os = FcObjectSetBuild (FC_FILE, (char *) nullptr);
 	if (!os)
 	{
-		qFatal("SCFonts::AddFontconfigFonts() FcObjectSet* os failed to build object set");
+		qFatal("SCFonts::addFontconfigFonts() FcObjectSet* os failed to build object set");
 		return;
 	}
 	// Now ask fontconfig to retrieve info as specified in 'os' about fonts
@@ -1006,7 +1007,7 @@
 	FcFontSet* fs = FcFontList(config, pat, os);
 	if (!fs)
 	{
-		qFatal("SCFonts::AddFontconfigFonts() FcFontSet* fs failed to create font list");
+		qFatal("SCFonts::addFontconfigFonts() FcFontSet* fs failed to create font list");
 		return;
 	}
 	FcConfigDestroy(config);
@@ -1022,12 +1023,12 @@
 		FcChar8 *file = nullptr;
 		if (FcPatternGetString (fs->fonts[i], FC_FILE, 0, &file) == FcResultMatch)
 		{
-			if (showFontInformation)
+			if (m_showFontInfo)
 				sDebug(QObject::tr("Loading font %1 (found using fontconfig)").arg(QString((char*)file)));
-			AddScalableFont(QString((char*)file), library, "");
+			addScalableFont(QString((char*)file), library, "");
 		}
 		else
-			if (showFontInformation)
+			if (m_showFontInfo)
 			{
 				auto errorMessage = QObject::tr("Failed to load a font - freetype2 couldn't find the font file");
 				addRejectedFont(QString((char*)file), errorMessage);
@@ -1040,20 +1041,20 @@
 
 #elif defined(Q_OS_LINUX)
 
-void SCFonts::AddXFontPath()
+void SCFonts::addXFontPath()
 {
 	int pathcount,i;
 	Display *display=XOpenDisplay(nullptr);
 	char **fontpath=XGetFontPath(display,&pathcount);
 	for (i=0; i<pathcount; ++i)
-		AddPath(fontpath[i]);
+		addPath(fontpath[i]);
 	XFreeFontPath(fontpath);
 }
 
-/* replacement for AddXFontServerPath() for correctly parsing
+/* replacement for addXFontServerPath() for correctly parsing
  * RedHad-Style /etc/X11/fs/config files */
 
-void SCFonts::AddXFontServerPath()
+void SCFonts::addXFontServerPath()
 {
 	QFile fs("/etc/X11/fs/config");
 	if (!(fs.exists()))
@@ -1098,7 +1099,7 @@
 			tmp = paths.mid(pos+1,(pos2-pos)-1);
 			pos=pos2;
 
-			AddPath(tmp);
+			addPath(tmp);
 
 		} while (pos > -1);
 	}
@@ -1109,21 +1110,21 @@
  * allowing a user to have extra fonts installed
  * only for this user. Can also be used also as an emergency
  * fallback if no suitable fonts are found elsewere */
-void SCFonts::AddUserPath(const QString& pf)
+void SCFonts::addUserPath(const QString& pf)
 {
 	PrefsContext *pc = PrefsManager::instance().prefsFile->getContext("Fonts");
 	PrefsTable *extraDirs = pc->getTable("ExtraFontDirs");
 	for (int i = 0; i < extraDirs->getRowCount(); ++i)
-		AddPath(extraDirs->get(i, 0));
-}
-
-void SCFonts::ReadCacheList(const QString& pf)
+		addPath(extraDirs->get(i, 0));
+}
+
+void SCFonts::readFontCache(const QString& pf)
 {
 	QFile fr(pf + "/cfonts.xml");
 	QFileInfo fir(fr);
 	if (fir.exists())
 		fr.remove();
-	checkedFonts.clear();
+	m_checkedFonts.clear();
 	struct testCache foCache;
 	QDomDocument docu("fontcacherc");
 	QFile f(pf + "/checkfonts150.xml");
@@ -1152,26 +1153,26 @@
 			foCache.isChecked = false;
 			foCache.isOK = static_cast<bool>(dc.attribute("Status", "1").toInt());
 			foCache.lastMod = QDateTime::fromString(dc.attribute("Modified"), Qt::ISODate);
-			checkedFonts.insert(dc.attribute("File"), foCache);
+			m_checkedFonts.insert(dc.attribute("File"), foCache);
 		}
 		DOC = DOC.nextSibling();
 	}
 }
 
-void SCFonts::WriteCacheList()
+void SCFonts::writeFontCache()
 {
 	QString prefsLocation = PrefsManager::instance().preferencesLocation();
-	WriteCacheList(prefsLocation);
-}
-
-void SCFonts::WriteCacheList(const QString& pf)
+	writeFontCache(prefsLocation);
+}
+
+void SCFonts::writeFontCache(const QString& pf)
 {
 	QDomDocument docu("fontcacherc");
 	QString st="<CachedFonts></CachedFonts>";
 
 	docu.setContent(st);
 	QDomElement elem = docu.documentElement();
-	for (auto it = checkedFonts.cbegin(); it != checkedFonts.cend(); ++it)
+	for (auto it = m_checkedFonts.cbegin(); it != m_checkedFonts.cend(); ++it)
 	{
 		const auto& checkedFont = it.value();
 
@@ -1199,44 +1200,44 @@
 	file.close();
 }
 
-void SCFonts::GetFonts(const QString& pf, bool showFontInfo)
-{
-	showFontInformation=showFontInfo;
-	FontPath.clear();
-	ReadCacheList(pf);
+void SCFonts::getFonts(const QString& pf, bool showFontInfo)
+{
+	m_showFontInfo=showFontInfo;
+	m_fontPaths.clear();
+	readFontCache(pf);
 	ScCore->setSplashStatus( QObject::tr("Searching for Fonts") );
-	AddUserPath(pf);
+	addUserPath(pf);
 	// Search the system paths
 	QStringList ftDirs = ScPaths::systemFontDirs();
 	for (int i = 0; i < ftDirs.count(); i++)
-		AddScalableFonts( ftDirs[i] );
+		addScalableFonts( ftDirs[i] );
 	// Search Scribus font path
 	if (!ScPaths::instance().fontDir().isEmpty() && QDir(ScPaths::instance().fontDir()).exists())
-		AddScalableFonts( ScPaths::instance().fontDir() );
+		addScalableFonts( ScPaths::instance().fontDir() );
 	//Add downloaded user fonts
 	QString userFontDir(ScPaths::instance().userFontDir(false));
 	if (QDir(userFontDir).exists())
-		AddScalableFonts( userFontDir );
+		addScalableFonts( userFontDir );
 // if fontconfig is there, it does all the work
 #if HAVE_FONTCONFIG
 	// Search fontconfig paths
-	QStringList::iterator fpi, fpend = FontPath.end();
-	for (fpi = FontPath.begin() ; fpi != fpend; ++fpi) 
-		AddScalableFonts(*fpi);
-	AddFontconfigFonts();
+	QStringList::iterator fpi, fpend = m_fontPaths.end();
+	for (fpi = m_fontPaths.begin() ; fpi != fpend; ++fpi) 
+		addScalableFonts(*fpi);
+	addFontconfigFonts();
 #else
 // on X11 look there:
 #ifdef Q_OS_LINUX
-	AddXFontPath();
-	AddXFontServerPath();
+	addXFontPath();
+	addXFontServerPath();
 #endif
 // add user and X11 fonts:
-	QStringList::iterator fpi, fpend = FontPath.end();
-	for (fpi = FontPath.begin() ; fpi != fpend; ++fpi) 
-		AddScalableFonts(*fpi);
+	QStringList::iterator fpi, fpend = m_fontPaths.end();
+	for (fpi = m_fontPaths.begin() ; fpi != fpend; ++fpi) 
+		addScalableFonts(*fpi);
 #endif
 	updateFontMap();
-	WriteCacheList(pf);
+	writeFontCache(pf);
 }
 
 void SCFonts::addRejectedFont(QString fontPath, QString message)

Modified: trunk/Scribus/scribus/scfonts.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23079&path=/trunk/Scribus/scribus/scfonts.h
==============================================================================
--- trunk/Scribus/scribus/scfonts.h	(original)
+++ trunk/Scribus/scribus/scfonts.h	Sun Jul 14 01:19:04 2019
@@ -42,9 +42,9 @@
 		~SCFonts();
 
 		void updateFontMap();
-		void GetFonts(const QString& pf, bool showFontInfo=false);
-		ScFace LoadScalableFont(const QString &filename);
-		void AddScalableFonts(const QString& path, const QString& DocName = "");
+		void getFonts(const QString& pf, bool showFontInfo=false);
+		ScFace loadScalableFont(const QString &filename);
+		void addScalableFonts(const QString& path, const QString& DocName = "");
 		/// Returns a font with that name; creates a replacement font if not found
 		const ScFace& findFont(const QString& fontName, ScribusDoc* doc = nullptr);
 		const ScFace& findFont(const QString& fontFamily, const QString& fontStyle, ScribusDoc* doc = nullptr);
@@ -54,37 +54,39 @@
 		void setSubstitutions(const QMap<QString,QString>& substitutes, ScribusDoc* doc = nullptr);
 		void removeFont(const QString& name);
 		/// Write checked fonts file
-		void WriteCacheList();
+		void writeFontCache();
+
 		/// maps family name to face variants
 		QMap<QString, QStringList> fontMap;
 		QMap<QString, QString>     rejectedFonts;
 
 	private:
-		void ReadCacheList(const QString& pf);
-		void WriteCacheList(const QString& pf);
-		void AddPath(QString p);
-		bool AddScalableFont(const QString& filename, FT_Library &library, const QString& DocName);
-		void AddUserPath(const QString& pf);
+		void readFontCache(const QString& pf);
+		void writeFontCache(const QString& pf);
+		void addPath(QString p);
+		bool addScalableFont(const QString& filename, FT_Library &library, const QString& DocName);
+		void addRejectedFont(QString fontPath, QString message);
+		void addUserPath(const QString& pf);
 #ifdef HAVE_FONTCONFIG
-		void AddFontconfigFonts();
+		void addFontconfigFonts();
 #else
 #ifndef Q_OS_MAC
-		void AddXFontServerPath();
-		void AddXFontPath();
+		void addXFontServerPath();
+		void addXFontPath();
 #endif
 #endif
-		QStringList FontPath;
-		QString ExtraPath;
+		QStringList m_fontPaths;
+
 		struct testCache
 		{
 			bool isOK;
 			bool isChecked;
 			QDateTime lastMod;
 		};
-		QMap<QString, testCache> checkedFonts;
-		void addRejectedFont(QString fontPath, QString message);
+		QMap<QString, testCache> m_checkedFonts;
+
 	protected:
-		bool showFontInformation;
+		bool m_showFontInfo;
 };
 
 struct SCFontsIterator

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23079&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sun Jul 14 01:19:04 2019
@@ -3522,16 +3522,16 @@
 		if (docProfileDir.exists())
 			ScCore->getCMSProfilesDir(fi.absolutePath()+"/profiles", false, false);
 
-		m_prefsManager.appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/", filename);
+		m_prefsManager.appPrefs.fontPrefs.AvailFonts.addScalableFonts(fi.absolutePath()+"/", filename);
 		QDir docFontDir(fi.absolutePath() + "/fonts");
 		if (docFontDir.exists())
-			m_prefsManager.appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/fonts", filename);
+			m_prefsManager.appPrefs.fontPrefs.AvailFonts.addScalableFonts(fi.absolutePath()+"/fonts", filename);
 		QDir docFontDir2(fi.absolutePath() + "/Fonts");
 		if (docFontDir2.exists())
-			m_prefsManager.appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/Fonts", filename);
+			m_prefsManager.appPrefs.fontPrefs.AvailFonts.addScalableFonts(fi.absolutePath()+"/Fonts", filename);
 		QDir docFontDir3(fi.absolutePath() + "/Document fonts");
 		if (docFontDir3.exists())
-			m_prefsManager.appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/Document fonts", filename);
+			m_prefsManager.appPrefs.fontPrefs.AvailFonts.addScalableFonts(fi.absolutePath()+"/Document fonts", filename);
 		m_prefsManager.appPrefs.fontPrefs.AvailFonts.updateFontMap();
 		if (view != nullptr)
 		{

Modified: trunk/Scribus/scribus/ui/prefs_fonts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23079&path=/trunk/Scribus/scribus/ui/prefs_fonts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_fonts.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_fonts.cpp	Sun Jul 14 01:19:04 2019
@@ -132,7 +132,7 @@
 	It's just a performance vs. functionality test.
 	availFonts->clear();
 	// FIXME: This is main preformance issue. It's about 90% of all preference reads! - PV
-	availFonts->GetFonts(HomeP); */
+	availFonts->getFonts(HomeP); */
 	/* Are you wondering why this condition? See the comment at
 	line #102 (or somewhere near) as reference. Hint: PathList
 	is not initialized for example... - PV */
@@ -141,7 +141,7 @@
 		for (uint a = 0; a < PathList->count(); ++a)
 		{
 			QString dir = ScPaths::separatorsToSlashes(PathList->text(a));
-			availFonts->AddScalableFonts(dir +"/"); //, docc->DocName);
+			availFonts->addScalableFonts(dir +"/"); //, docc->DocName);
 			availFonts->updateFontMap();
 		}
 	} */
@@ -360,9 +360,9 @@
 	removeButton->setEnabled(false);
 	CurrentPath = s;
 	QString dir(QDir::fromNativeSeparators(s2));
-	m_availFonts.AddScalableFonts(dir +"/");
+	m_availFonts.addScalableFonts(dir +"/");
 	m_availFonts.updateFontMap();
-	m_availFonts.WriteCacheList();
+	m_availFonts.writeFontCache();
 
 	updateFontList();
 	updateRejectedFontList();
@@ -394,7 +394,7 @@
 	//writePaths();
 	CurrentPath = s;
 	QString dir = QDir::fromNativeSeparators(s2);
-	m_availFonts.AddScalableFonts(dir +"/");
+	m_availFonts.addScalableFonts(dir +"/");
 	m_availFonts.updateFontMap();
 	updateFontList();
 	updateRejectedFontList();




More information about the scribus-commit mailing list