r16351 by fschmid - Enabled the use of icc related ghostscript parameters if gs version is above 9.0

scribus-commit scribus-commit at lists.scribus.net
Sun Feb 13 12:02:38 CET 2011


Author: fschmid
Date: Sun Feb 13 11:02:38 2011
New Revision: 16351

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16351
Log:
Enabled the use of icc related ghostscript parameters if gs version is above 9.0

Modified:
    trunk/Scribus/scribus/ui/preview.cpp

Modified: trunk/Scribus/scribus/ui/preview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16351&path=/trunk/Scribus/scribus/ui/preview.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/preview.cpp (original)
+++ trunk/Scribus/scribus/ui/preview.cpp Sun Feb 13 11:02:38 2011
@@ -584,110 +584,7 @@
 		bool useIC = UseICC->isChecked();
 		if (!doc->HasCMS)
 			useIC = false;
-		PrintOptions options;
-		options.pageNumbers.push_back(Seite+1);
-		options.outputSeparations = false;
-		options.separationName = tr("All");
-		options.allSeparations = QStringList();
-		options.useColor = !useGray->isChecked();
-		options.mirrorH = MirrorHor->isChecked();
-		options.mirrorV = MirrorVert->isChecked();
-		options.useICC = useIC;
-		options.doGCR = EnableGCR->isChecked();
-		options.setDevParam = false;
-		options.doClip = ClipMarg->isChecked();
-		options.cropMarks = false;
-		options.bleedMarks = false;
-		options.registrationMarks = false;
-		options.colorMarks = false;
-		options.markOffset = 0.0;
-		options.bleeds.Top = 0.0;
-		options.bleeds.Left = 0.0;
-		options.bleeds.Right = 0.0;
-		options.bleeds.Bottom = 0.0;
-		PSLib *dd = new PSLib(options, true, prefsManager->appPrefs.fontPrefs.AvailFonts, ReallyUsed, doc->PageColors, false, !spotColors->isChecked());
-		if (dd != NULL)
-		{
-			dd->PS_set_file( ScPaths::getTempFileDir() + "/tmp.ps");
-			ret = dd->CreatePS(doc, options);
-			delete dd;
-			if (ret != 0) return 1;
-		}
-		else
-			return ret;
-	}
-	QStringList args;
-	QString tmp, tmp2, tmp3;
-	double b = doc->Pages->at(Seite)->width() * Res / 72.0;
-	double h = doc->Pages->at(Seite)->height() * Res / 72.0;
-	if (doc->Pages->at(Seite)->orientation() == 1)
-		std::swap(b, h);
-	args.append( "-q" );
-	args.append( "-dNOPAUSE" );
-	args.append( "-dPARANOIDSAFER" );
-	args.append( QString("-r%1").arg(tmp.setNum(qRound(Res))) );
-	args.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(b))).arg(tmp3.setNum(qRound(h))) );
-	if (EnableCMYK->isChecked())
-	{
-		if (HaveTiffSep)
-			args.append( "-sDEVICE=tiffsep" );
-		else
-		{
-			args.append( "-sDEVICE=bitcmyk" );
-			args.append( "-dGrayValues=256" ); 
-		}
-	}
-	else
-	{
-		if ((!AliasTr->isChecked()) || (!HavePngAlpha))
-			args.append( "-sDEVICE=png16m" );
-		else
-			args.append( "-sDEVICE=pngalpha" );
-	}
-	if (AntiAlias->isChecked())
-	{
-		args.append( "-dTextAlphaBits=4" );
-		args.append( "-dGraphicsAlphaBits=4" );
-	}
-	// Add any extra font paths being used by Scribus to gs's font search path
-	PrefsContext *pc = prefsManager->prefsFile->getContext("Fonts");
-	PrefsTable *extraFonts = pc->getTable("ExtraFontDirs");
-	const char sep = ScPaths::envPathSeparator;
-	if (extraFonts->getRowCount() >= 1)
-		cmd1 = QString("-sFONTPATH=%1").arg(QDir::convertSeparators(extraFonts->get(0,0)));
-	for (int i = 1; i < extraFonts->getRowCount(); ++i)
-		cmd1 += QString("%1%2").arg(sep).arg(QDir::convertSeparators(extraFonts->get(i,0)));
-	if( !cmd1.isEmpty() )
-		args.append( cmd1 );
-	// then add any final args and call gs
-	if ((EnableCMYK->isChecked()) && HaveTiffSep)
-		args.append( QString("-sOutputFile=%1").arg(QDir::convertSeparators(ScPaths::getTempFileDir()+"/sc.tif")) );
-	else
-		args.append( QString("-sOutputFile=%1").arg(QDir::convertSeparators(ScPaths::getTempFileDir()+"/sc.png")) );
-	args.append( QDir::convertSeparators(ScPaths::getTempFileDir()+"/tmp.ps") );
-	args.append( "-c" );
-	args.append( "showpage" );
-	args.append( "-c" );
-	args.append( "quit" );
-	ret = System(getShortPathName(prefsManager->ghostscriptExecutable()), args);
-	return ret;
-}
-
-int PPreview::RenderPreviewSep(int Seite, int Res)
-{
-	int ret = -1;
-	QString cmd;
-	QStringList args, args1, args2, args3;
-	QMap<QString, QMap<uint, FPointArray> > ReallyUsed;
-	// Recreate Postscript-File only when the actual Page has changed
-	if ((Seite != APage)  || (EnableGCR->isChecked() != GMode) || (useGray->isChecked() != fGray)
-		|| (MirrorHor->isChecked() != mHor) || (MirrorVert->isChecked() != mVer) || (ClipMarg->isChecked() != fClip)
-		|| (UseICC->isChecked() != fICC) || (spotColors->isChecked() != fSpot))
-	{
-		ReallyUsed.clear();
-		doc->getUsedFonts(ReallyUsed);
-		bool useIC = UseICC->isChecked();
-		if (!doc->HasCMS)
+		if ((doc->HasCMS) && (GsMinor >= 0) && (GsMajor >= 9))
 			useIC = false;
 		PrintOptions options;
 		options.pageNumbers.push_back(Seite+1);
@@ -713,6 +610,118 @@
 		PSLib *dd = new PSLib(options, true, prefsManager->appPrefs.fontPrefs.AvailFonts, ReallyUsed, doc->PageColors, false, !spotColors->isChecked());
 		if (dd != NULL)
 		{
+			dd->PS_set_file( ScPaths::getTempFileDir() + "/tmp.ps");
+			ret = dd->CreatePS(doc, options);
+			delete dd;
+			if (ret != 0) return 1;
+		}
+		else
+			return ret;
+	}
+	QStringList args;
+	QString tmp, tmp2, tmp3;
+	double b = doc->Pages->at(Seite)->width() * Res / 72.0;
+	double h = doc->Pages->at(Seite)->height() * Res / 72.0;
+	if (doc->Pages->at(Seite)->orientation() == 1)
+		std::swap(b, h);
+	args.append( "-q" );
+	args.append( "-dNOPAUSE" );
+	args.append( "-dPARANOIDSAFER" );
+	args.append( QString("-r%1").arg(tmp.setNum(qRound(Res))) );
+	args.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(b))).arg(tmp3.setNum(qRound(h))) );
+	if (EnableCMYK->isChecked())
+	{
+		if (HaveTiffSep)
+			args.append( "-sDEVICE=tiffsep" );
+		else
+		{
+			args.append( "-sDEVICE=bitcmyk" );
+			args.append( "-dGrayValues=256" ); 
+		}
+	}
+	else
+	{
+		if ((!AliasTr->isChecked()) || (!HavePngAlpha))
+			args.append( "-sDEVICE=png16m" );
+		else
+			args.append( "-sDEVICE=pngalpha" );
+	}
+	if (AntiAlias->isChecked())
+	{
+		args.append( "-dTextAlphaBits=4" );
+		args.append( "-dGraphicsAlphaBits=4" );
+	}
+	if ((doc->HasCMS) && (GsMinor >= 0) && (GsMajor >= 9) && UseICC->isChecked())
+	{
+		args.append("-sDefaultCMYKProfile="+doc->DocInputCMYKProf.profilePath());
+		args.append("-sOutputICCProfile="+doc->DocPrinterProf.profilePath());
+	}
+	// Add any extra font paths being used by Scribus to gs's font search path
+	PrefsContext *pc = prefsManager->prefsFile->getContext("Fonts");
+	PrefsTable *extraFonts = pc->getTable("ExtraFontDirs");
+	const char sep = ScPaths::envPathSeparator;
+	if (extraFonts->getRowCount() >= 1)
+		cmd1 = QString("-sFONTPATH=%1").arg(QDir::convertSeparators(extraFonts->get(0,0)));
+	for (int i = 1; i < extraFonts->getRowCount(); ++i)
+		cmd1 += QString("%1%2").arg(sep).arg(QDir::convertSeparators(extraFonts->get(i,0)));
+	if( !cmd1.isEmpty() )
+		args.append( cmd1 );
+	// then add any final args and call gs
+	if ((EnableCMYK->isChecked()) && HaveTiffSep)
+		args.append( QString("-sOutputFile=%1").arg(QDir::convertSeparators(ScPaths::getTempFileDir()+"/sc.tif")) );
+	else
+		args.append( QString("-sOutputFile=%1").arg(QDir::convertSeparators(ScPaths::getTempFileDir()+"/sc.png")) );
+	args.append( QDir::convertSeparators(ScPaths::getTempFileDir()+"/tmp.ps") );
+	args.append( "-c" );
+	args.append( "showpage" );
+	args.append( "-c" );
+	args.append( "quit" );
+	ret = System(getShortPathName(prefsManager->ghostscriptExecutable()), args);
+	return ret;
+}
+
+int PPreview::RenderPreviewSep(int Seite, int Res)
+{
+	int ret = -1;
+	QString cmd;
+	QStringList args, args1, args2, args3;
+	QMap<QString, QMap<uint, FPointArray> > ReallyUsed;
+	// Recreate Postscript-File only when the actual Page has changed
+	if ((Seite != APage)  || (EnableGCR->isChecked() != GMode) || (useGray->isChecked() != fGray)
+		|| (MirrorHor->isChecked() != mHor) || (MirrorVert->isChecked() != mVer) || (ClipMarg->isChecked() != fClip)
+		|| (UseICC->isChecked() != fICC) || (spotColors->isChecked() != fSpot))
+	{
+		ReallyUsed.clear();
+		doc->getUsedFonts(ReallyUsed);
+		bool useIC = UseICC->isChecked();
+		if (!doc->HasCMS)
+			useIC = false;
+		if ((doc->HasCMS) && (GsMinor >= 0) && (GsMajor >= 9))
+			useIC = false;
+		PrintOptions options;
+		options.pageNumbers.push_back(Seite+1);
+		options.outputSeparations = false;
+		options.separationName = tr("All");
+		options.allSeparations = QStringList();
+		options.useColor = !useGray->isChecked();
+		options.mirrorH = MirrorHor->isChecked();
+		options.mirrorV = MirrorVert->isChecked();
+		options.useICC = useIC;
+		options.doGCR = EnableGCR->isChecked();
+		options.setDevParam = false;
+		options.doClip = ClipMarg->isChecked();
+		options.cropMarks = false;
+		options.bleedMarks = false;
+		options.registrationMarks = false;
+		options.colorMarks = false;
+		options.markOffset = 0.0;
+		options.bleeds.Top = 0.0;
+		options.bleeds.Left = 0.0;
+		options.bleeds.Right = 0.0;
+		options.bleeds.Bottom = 0.0;
+		PSLib *dd = new PSLib(options, true, prefsManager->appPrefs.fontPrefs.AvailFonts, ReallyUsed, doc->PageColors, false, !spotColors->isChecked());
+		if (dd != NULL)
+		{
 			dd->PS_set_file(ScPaths::getTempFileDir()+"/tmp.ps");
 			ret = dd->CreatePS(doc, options);
 			delete dd;
@@ -736,6 +745,11 @@
 	{
 		args1.append("-dTextAlphaBits=4");
 		args1.append("-dGraphicsAlphaBits=4");
+	}
+	if ((doc->HasCMS) && (GsMinor >= 0) && (GsMajor >= 9) && UseICC->isChecked())
+	{
+		args1.append("-sDefaultCMYKProfile="+doc->DocInputCMYKProf.profilePath());
+		args1.append("-sOutputICCProfile="+doc->DocPrinterProf.profilePath());
 	}
 	// Add any extra font paths being used by Scribus to gs's font search path
 	PrefsContext *pc = prefsManager->prefsFile->getContext("Fonts");




More information about the scribus-commit mailing list