r21856 by jghali - #14708: the default font is the first one

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 29 22:16:52 UTC 2017


Author: jghali
Date: Wed Mar 29 22:16:52 2017
New Revision: 21856

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21856
Log:
#14708: the default font is the first one

Modified:
    trunk/Scribus/scribus/prefsmanager.cpp

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21856&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Wed Mar 29 22:16:52 2017
@@ -133,19 +133,29 @@
 void PrefsManager::initDefaults()
 {
 	/** Default font and size **/
-	SCFontsIterator it(appPrefs.fontPrefs.AvailFonts);
+	QStringList defaultFonts;
+	defaultFonts << "Arial Regular";
+	defaultFonts << "Times New Roman Regular";
+	defaultFonts << "DejaVu Sans Book";
+	defaultFonts << "DejaVu Sans Condensed";
+	defaultFonts << "Liberation Sans Regular";
+	defaultFonts << "Helvetica Regular";
+	defaultFonts << "Helvetica Neue Regular";
+
 	bool goodFont = false;
-	for ( SCFontsIterator itf(appPrefs.fontPrefs.AvailFonts); itf.hasNext(); itf.next())
-	{
-		if ((itf.currentKey() == "Arial Regular") || (itf.currentKey() == "Times New Roman Regular"))
-		{
-			appPrefs.itemToolPrefs.textFont = itf.currentKey();
+	SCFonts& availableFonts = appPrefs.fontPrefs.AvailFonts;
+	for (int i = 0; i < defaultFonts.count(); ++i)
+	{
+		QString defCandidate = defaultFonts.at(i);
+		if (availableFonts.contains(defCandidate))
+		{
+			appPrefs.itemToolPrefs.textFont = defCandidate;
 			goodFont = true;
 			break;
 		}
 	}
 	if (!goodFont)
-		appPrefs.itemToolPrefs.textFont = it.currentKey();
+		appPrefs.itemToolPrefs.textFont = availableFonts.firstKey();
 	appPrefs.itemToolPrefs.textSize = 120;
 
 	/** Default colours **/




More information about the scribus-commit mailing list