r19292 by jghali - #12440: para styles using "Based On:" character inheritance trigger incorrect text display

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 28 15:39:51 UTC 2014


Author: jghali
Date: Sat Jun 28 15:39:50 2014
New Revision: 19292

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19292
Log:
#12440: para styles using "Based On:" character inheritance trigger incorrect text display

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/ui/fontcombo.cpp
    trunk/Scribus/scribus/ui/smfontcomboh.cpp
    trunk/Scribus/scribus/ui/smtextstyles.cpp

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19292&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sat Jun 28 15:39:50 2014
@@ -1154,7 +1154,11 @@
 
 	static const QString FONT("FONT");
 	if (attrs.hasAttribute(FONT))
-		newStyle.setFont(m_AvailableFonts->findFont(attrs.valueAsString(FONT), doc));
+	{
+		const ScFace& face = m_AvailableFonts->findFont(attrs.valueAsString(FONT), doc);
+		if (!face.isNone())
+			newStyle.setFont(face);
+	}
 	
 	static const QString FONTSIZE("FONTSIZE");
 	if (attrs.hasAttribute(FONTSIZE))

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19292&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Sat Jun 28 15:39:50 2014
@@ -2414,7 +2414,11 @@
 
 	static const QString FONT("FONT");
 	if (attrs.hasAttribute(FONT))
-		newStyle.setFont(m_AvailableFonts->findFont(attrs.valueAsString(FONT), doc));
+	{
+		const ScFace& face = m_AvailableFonts->findFont(attrs.valueAsString(FONT), doc);
+		if (!face.isNone())
+			newStyle.setFont(face);
+	}
 
 	static const QString FONTSIZE("FONTSIZE");
 	if (attrs.hasAttribute(FONTSIZE))

Modified: trunk/Scribus/scribus/ui/fontcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19292&path=/trunk/Scribus/scribus/ui/fontcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/fontcombo.cpp (original)
+++ trunk/Scribus/scribus/ui/fontcombo.cpp Sat Jun 28 15:39:50 2014
@@ -197,8 +197,8 @@
 	// If we already have the correct font+style, nothing to do
 	if ((fontFamily->currentText() == family) && (fontStyle->currentText() == style))
 		return;
-	disconnect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
-	disconnect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
+	bool familySigBlocked = fontFamily->blockSignals(true);
+	bool styleSigBlocked = fontStyle->blockSignals(true);
 	setCurrentComboItem(fontFamily, family);
 	fontStyle->clear();
 	QStringList slist = prefsManager->appPrefs.fontPrefs.AvailFonts.fontMap[family];
@@ -222,8 +222,8 @@
 	else
 		fontStyle->addItems(slist);
 	setCurrentComboItem(fontStyle, style);
-	connect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
-	connect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
+	fontFamily->blockSignals(familySigBlocked);
+	fontStyle->blockSignals(styleSigBlocked);
 }
 
 void FontComboH::RebuildList(ScribusDoc *currentDoc, bool forAnnotation, bool forSubstitute)
@@ -234,8 +234,8 @@
 	currDoc = currentDoc;
 	isForAnnotation = forAnnotation;
 	isForSubstitute = forSubstitute;
-	disconnect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
-	disconnect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
+	bool familySigBlocked = fontFamily->blockSignals(true);
+	bool styleSigBlocked = fontStyle->blockSignals(true);
 	fontFamily->clear();
 	fontStyle->clear();
 	QStringList rlist = prefsManager->appPrefs.fontPrefs.AvailFonts.fontMap.keys();
@@ -316,6 +316,6 @@
 	}
 	else
 		fontStyle->addItems(slist);
-	connect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
-	connect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
-}
+	fontFamily->blockSignals(familySigBlocked);
+	fontStyle->blockSignals(styleSigBlocked);
+}

Modified: trunk/Scribus/scribus/ui/smfontcomboh.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19292&path=/trunk/Scribus/scribus/ui/smfontcomboh.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smfontcomboh.cpp (original)
+++ trunk/Scribus/scribus/ui/smfontcomboh.cpp Sat Jun 28 15:39:50 2014
@@ -51,13 +51,20 @@
 
 	if (useParentValue_ && hasParent_)
 	{
-		ret = fontFamily->currentIndex() == (fontFamily->count() - 1) ||
-				fontStyle->currentIndex() == (fontStyle->count() - 1);
+		ret = fontFamily->currentText() == usePFont_ ||
+			  fontStyle->currentText() == usePFont_;
 
 		if (ret)
 		{
-			fontFamily->removeItem(fontFamily->count() - 1);
-			fontStyle->removeItem(fontStyle->count() - 1);
+			bool familySigBlocked = fontFamily->blockSignals(true);
+			bool styleSigBlocked = fontStyle->blockSignals(true);
+			if (fontFamily->itemText(fontFamily->count() - 1) == usePFont_)
+				fontFamily->removeItem(fontFamily->count() - 1);
+			if (fontStyle->itemText(fontStyle->count() - 1) == usePFont_)
+				fontStyle->removeItem(fontStyle->count() - 1);
+			fontFamily->blockSignals(familySigBlocked);
+			fontStyle->blockSignals(styleSigBlocked);
+
 			setFont(false);
 			setCurrentFont(pFont_, true);
 			useParentValue_ = false;

Modified: trunk/Scribus/scribus/ui/smtextstyles.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19292&path=/trunk/Scribus/scribus/ui/smtextstyles.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.cpp (original)
+++ trunk/Scribus/scribus/ui/smtextstyles.cpp Sat Jun 28 15:39:50 2014
@@ -570,7 +570,6 @@
 	connect(m_pwidget->cpage->tracking_, SIGNAL(valueChanged(double)), this, SLOT(slotTracking()));
 	connect(m_pwidget->cpage->widthSpaceSpin, SIGNAL(valueChanged(double)), this, SLOT(slotWordTracking()));
 	connect(m_pwidget->cpage->baselineOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotBaselineOffset()));
-	connect(m_pwidget->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
 	connect(m_pwidget->cpage->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotCharParentChanged(const QString&)));
 }
 
@@ -653,7 +652,6 @@
 	disconnect(m_pwidget->cpage->tracking_, SIGNAL(valueChanged(double)), this, SLOT(slotTracking()));
 	disconnect(m_pwidget->cpage->widthSpaceSpin, SIGNAL(valueChanged(double)), this, SLOT(slotWordTracking()));
 	disconnect(m_pwidget->cpage->baselineOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotBaselineOffset()));
-	disconnect(m_pwidget->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
 	disconnect(m_pwidget->cpage->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotCharParentChanged(const QString&)));
 }
 
@@ -2266,7 +2264,6 @@
 	connect(m_page->tracking_, SIGNAL(valueChanged(double)), this, SLOT(slotTracking()));
 	connect(m_page->widthSpaceSpin, SIGNAL(valueChanged(double)), this, SLOT(slotWordTracking()));
 	connect(m_page->baselineOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotBaselineOffset()));
-	connect(m_page->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
 	connect(m_page->parentCombo, SIGNAL(activated(const QString&)),
 	        this, SLOT(slotParentChanged(const QString&)));
 }
@@ -2303,7 +2300,6 @@
 	disconnect(m_page->tracking_, SIGNAL(valueChanged(double)), this, SLOT(slotTracking()));
 	disconnect(m_page->widthSpaceSpin, SIGNAL(valueChanged(double)), this, SLOT(slotWordTracking()));
 	disconnect(m_page->baselineOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotBaselineOffset()));
-	disconnect(m_page->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
 	disconnect(m_page->parentCombo, SIGNAL(activated(const QString&)),
 			this, SLOT(slotParentChanged(const QString&)));
 }
@@ -2659,12 +2655,11 @@
 
 void SMCharacterStyle::slotFont(QString s)
 {
-	ScFace sf;
 	if (m_page->fontFace_->useParentFont())
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->resetFont();
 	else {
-		sf = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts[s];
+		ScFace sf = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts[s];
 
 		for (int i = 0; i < m_selection.count(); ++i)
 			m_selection[i]->setFont(sf);




More information about the scribus-commit mailing list