View Issue Details

IDProjectCategoryView StatusLast Update
0002794ScribusOS-Win32public2005-11-05 12:37
Reporterjghali Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOSWindowsOS Version2000 SP4
Product Version1.3.2cvs 
Fixed in Version1.3.2cvs 
Summary0002794: Add a scribus font directory on win32 plus some scpaths cleanup
Description- add a specific scribus font directory in scribus_install_path/share/fonts to provide users some fonts especially those used in document templates while avoiding to mess with system fonts
- remove some unuseful strdup in scpaths.cpp
- handling of scribus font dir + use of getSystemFontDirs call in scfonts.cpp
TagsNo tags attached.
Patch

Relationships

related to 0002219 closedringerc On Win32, add the ability to locate special directories and sytem fonts folder 

Activities

2005-11-05 01:14

 

scribus_font_dir.diff (5,545 bytes)   
Index: scfonts.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/scfonts.cpp,v
retrieving revision 1.15.2.37
diff -u -r1.15.2.37 scfonts.cpp
--- scfonts.cpp	14 Oct 2005 06:32:26 -0000	1.15.2.37
+++ scfonts.cpp	5 Nov 2005 00:27:14 -0000
@@ -41,6 +41,7 @@
 #include <fontconfig/fontconfig.h>
 #endif
 
+#include "scpaths.h"
 #include "util.h"
 
 #include FT_INTERNAL_STREAM_H
@@ -955,7 +956,7 @@
 }
 
 #else
-#ifndef QT_MAC
+#if !defined(QT_MAC) && !defined(_WIN32)
 
 void SCFonts::AddXFontPath()
 {
@@ -1113,19 +1114,20 @@
 	ReadCacheList(pf);
 	ScApp->setSplashStatus( QObject::tr("Searching for Fonts") );
 	AddUserPath(pf);
+	// Search the system paths
+	QStringList ftDirs = ScPaths::getSystemFontDirs();
+	for (unsigned int i = 0; i < ftDirs.count(); i++)
+		AddScalableFonts( ftDirs[i] );
+	// Search Scribus font path
+	if (QDir(ScPaths::instance().fontDir()).exists())
+		AddScalableFonts( ScPaths::instance().fontDir() );
 // if fontconfig is there, it does all the work
 #if HAVE_FONTCONFIG
+	// Search fontconfig paths
 	for(QStrListIterator fpi(FontPath) ; fpi.current() ; ++fpi)
 		AddScalableFonts(fpi.current());
 	AddFontconfigFonts();
 #else
-// if FreeType thinks we are on Mac, let it search the default paths
-#if FT_MACINTOSH
-	AddScalableFonts(QDir::homeDirPath() + "/Library/Fonts/");
-	AddScalableFonts("/Library/Fonts/");
-	AddScalableFonts("/Network/Library/Fonts/");
-	AddScalableFonts("/System/Library/Fonts/");
-#endif
 // on X11 look there:
 #ifdef Q_WS_X11
 	AddXFontPath();
Index: scpaths.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/Attic/scpaths.cpp,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 scpaths.cpp
--- scpaths.cpp	7 Oct 2005 11:40:39 -0000	1.1.2.9
+++ scpaths.cpp	5 Nov 2005 01:05:47 -0000
@@ -78,14 +78,14 @@
 	}
 
 	qDebug(QString("scpaths: bundle at %1:").arg(pathPtr));
-	m_shareDir = strdup(QString("%1/Contents/share/scribus/").arg(pathPtr));
-	m_docDir = strdup(QString("%1/Contents/share/scribus/doc/").arg(pathPtr));
-	m_iconDir = strdup(QString("%1/Contents/share/scribus/icons/").arg(pathPtr));
-	m_sampleScriptDir = strdup(QString("%1/Contents/share/scribus/samples/").arg(pathPtr));
-	m_scriptDir = strdup(QString("%1/Contents/share/scribus/scripts/").arg(pathPtr));
-	m_templateDir = strdup(QString("%1/Contents/share/scribus/templates/").arg(pathPtr));
-	m_libDir = strdup(QString("%1/Contents/lib/scribus/").arg(pathPtr));
-	m_pluginDir = strdup(QString("%1/Contents/lib/scribus/plugins/").arg(pathPtr));
+	m_shareDir = QString("%1/Contents/share/scribus/").arg(pathPtr);
+	m_docDir = QString("%1/Contents/share/scribus/doc/").arg(pathPtr);
+	m_iconDir = QString("%1/Contents/share/scribus/icons/").arg(pathPtr);
+	m_sampleScriptDir = QString("%1/Contents/share/scribus/samples/").arg(pathPtr);
+	m_scriptDir = QString("%1/Contents/share/scribus/scripts/").arg(pathPtr);
+	m_templateDir = QString("%1/Contents/share/scribus/templates/").arg(pathPtr);
+	m_libDir = QString("%1/Contents/lib/scribus/").arg(pathPtr);
+	m_pluginDir = QString("%1/Contents/lib/scribus/plugins/").arg(pathPtr);
 	QApplication::setLibraryPaths(QString("%1/Contents/lib/qtplugins/").arg(pathPtr));
 	CFRelease(pluginRef);
 	CFRelease(macPath);
@@ -102,14 +102,15 @@
 
 #elif defined(_WIN32)
 	QString appPath = qApp->applicationDirPath();
-	m_shareDir = strdup(QString("%1/share/").arg(appPath));
-	m_docDir = strdup(QString("%1/share/doc/").arg(appPath));
-	m_iconDir = strdup(QString("%1/share/icons/").arg(appPath));
-	m_sampleScriptDir = strdup(QString("%1/share/samples/").arg(appPath));
-	m_scriptDir = strdup(QString("%1/share/scripts/").arg(appPath));
-	m_templateDir = strdup(QString("%1/share/templates/").arg(appPath));
-	m_libDir = strdup(QString("%1/libs/").arg(appPath));
-	m_pluginDir = strdup(QString("%1/plugins/").arg(appPath));
+	m_shareDir = QString("%1/share/").arg(appPath);
+	m_docDir = QString("%1/share/doc/").arg(appPath);
+	m_fontDir = QString("%1/share/fonts/").arg(appPath);
+	m_iconDir = QString("%1/share/icons/").arg(appPath);
+	m_sampleScriptDir = QString("%1/share/samples/").arg(appPath);
+	m_scriptDir = QString("%1/share/scripts/").arg(appPath);
+	m_templateDir = QString("%1/share/templates/").arg(appPath);
+	m_libDir = QString("%1/libs/").arg(appPath);
+	m_pluginDir = QString("%1/plugins/").arg(appPath);
 #endif
 }
 
@@ -125,6 +126,11 @@
 	return m_iconDir;
 }
 
+const QString&  ScPaths::fontDir() const
+{
+	return m_fontDir;
+}
+
 const QString&  ScPaths::libDir() const
 {
 	return m_libDir;
Index: scpaths.h
===================================================================
RCS file: /cvs/Scribus/scribus/Attic/scpaths.h,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 scpaths.h
--- scpaths.h	3 Oct 2005 09:48:27 -0000	1.1.2.5
+++ scpaths.h	4 Nov 2005 23:24:16 -0000
@@ -24,6 +24,8 @@
 	const QString& docDir() const;
 	/** @brief Return path to icons directory*/
 	const QString& iconDir() const;
+	/** @brief Return path to the Scribus font directory */
+	const QString& fontDir() const;
 	/** @brief Return path to lib directory containing translations,
 	 *         keysets, etc. */
 	const QString& libDir() const;
@@ -58,6 +60,7 @@
 	// Members to hold system paths
 	QString m_docDir;
 	QString m_iconDir;
+	QString m_fontDir;
 	QString m_libDir;
 	QString m_pluginDir;
 	QString m_sampleScriptDir;
scribus_font_dir.diff (5,545 bytes)   

Issue History

Date Modified Username Field Change
2005-11-05 01:14 jghali New Issue
2005-11-05 01:14 jghali File Added: scribus_font_dir.diff
2005-11-05 01:15 cbradney Status new => assigned
2005-11-05 01:15 cbradney Assigned To => cbradney
2005-11-05 01:19 cbradney Status assigned => resolved
2005-11-05 01:19 cbradney Fixed in Version => 1.3.2cvs
2005-11-05 01:19 cbradney Resolution open => fixed
2005-11-05 12:37 cbradney Status resolved => closed
2005-11-05 13:01 jghali Relationship added related to 0002219
2014-10-08 18:38 Kunda Category Win32 => OS-Win32