r21237 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 24 10:41:53 UTC 2016


Author: jghali
Date: Sun Apr 24 10:41:53 2016
New Revision: 21237

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21237
Log:
fix ugly hack used to make "underline word" effect work

Modified:
    trunk/Scribus/scribus/pageitem_pathtext.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/sctextstruct.h
    trunk/Scribus/scribus/styles/charstyle.h
    trunk/Scribus/scribus/text/boxes.cpp

Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21237&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp	Sun Apr 24 10:41:53 2016
@@ -309,6 +309,15 @@
 		GlyphRun run(&itemRenderText.charStyle(a), itemRenderText.flags(a), a, a, itemRenderText.object(a));
 		run.glyphs().append(glyphs);
 
+		const StyleFlag& effects = itemRenderText.charStyle(a).effects();
+		if (effects & ScStyle_UnderlineWords)
+		{
+			if (itemRenderText.text(a).isSpace())
+				run.clearFlag(ScLayout_Underlined);
+			else
+				run.setFlag(ScLayout_Underlined);
+		}
+
 		const CharStyle& cStyle(run.style());
 		double scaleV = cStyle.scaleV() / 1000.0;
 		double offset = (cStyle.fontSize() / 10) * (cStyle.baselineOffset() / 1000.0);

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21237&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Sun Apr 24 10:41:53 2016
@@ -1465,15 +1465,13 @@
 			PageItem* currentObject = itemText.object(a);
 			bool HasMark = itemText.hasMark(a);
 
-			if (itemText.charStyle(a).effects() & ScStyle_UnderlineWords)
-			{
-				CharStyle tmp(itemText.charStyle(a));
-				StyleFlag effects = tmp.effects();
-				if (!itemText.text(a).isSpace())
-					effects |= ScStyle_Underline;
-				effects &= ~ScStyle_UnderlineWords;
-				tmp.setFeatures(effects.featureList());
-				itemText.applyCharStyle(a, 1, tmp);
+			const StyleFlag& effects = itemText.charStyle(a).effects();
+			if (effects & ScStyle_UnderlineWords)
+			{
+				if (itemText.text(a).isSpace())
+					glyphRuns[i].clearFlag(ScLayout_Underlined);
+				else
+					glyphRuns[i].setFlag(ScLayout_Underlined);
 			}
 
 			if (HasMark)

Modified: trunk/Scribus/scribus/sctextstruct.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21237&path=/trunk/Scribus/scribus/sctextstruct.h
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.h	(original)
+++ trunk/Scribus/scribus/sctextstruct.h	Sun Apr 24 10:41:53 2016
@@ -44,11 +44,12 @@
 	ScLayout_ExpandingSpace= 4,       // new: marks an expanding space
 	ScLayout_ImplicitSpace = 8,       // new: marks an implicit space
 	ScLayout_TabLeaders    = 16,      // new: marks a tab with fillchar
-	ScLayout_HyphenationPossible=128, //Hyphenation possible here (Soft Hyphen)
+	ScLayout_HyphenationPossible=128, // Hyphenation possible here (Soft Hyphen)
 	ScLayout_DropCap       = 2048,
-	ScLayout_SuppressSpace = 4096,    //internal use in PageItem (Suppresses spaces when in Block alignment)
-	ScLayout_SoftHyphenVisible=8192,  //Soft Hyphen visible at line end
-	ScLayout_StartOfLine   = 16384    //set for start of line
+	ScLayout_SuppressSpace = 4096,    // internal use in PageItem (Suppresses spaces when in Block alignment)
+	ScLayout_SoftHyphenVisible=8192,  // Soft Hyphen visible at line end
+	ScLayout_StartOfLine   = 16384,   // set for start of line
+	ScLayout_Underlined    = 32768    // chararcter should be underlined
 };
 
 

Modified: trunk/Scribus/scribus/styles/charstyle.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21237&path=/trunk/Scribus/scribus/styles/charstyle.h
==============================================================================
--- trunk/Scribus/scribus/styles/charstyle.h	(original)
+++ trunk/Scribus/scribus/styles/charstyle.h	Sun Apr 24 10:41:53 2016
@@ -145,7 +145,7 @@
 	QString asString() const;
 	
 	/** This property will be evaluated at runtime and is not stored. See 'updateFeatures()' */
-	const StyleFlag effects() const { validate(); return m_Effects; }
+	const StyleFlag& effects() const { validate(); return m_Effects; }
 	void setEffects(StyleFlag flags) { m_Effects = flags; }
 	
 	

Modified: trunk/Scribus/scribus/text/boxes.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21237&path=/trunk/Scribus/scribus/text/boxes.cpp
==============================================================================
--- trunk/Scribus/scribus/text/boxes.cpp	(original)
+++ trunk/Scribus/scribus/text/boxes.cpp	Sun Apr 24 10:41:53 2016
@@ -503,7 +503,8 @@
 
 		// Do underlining first so you can get typographically correct
 		// underlines when drawing a white outline
-		if (m_effects & ScStyle_Underline && hasStrokeColor)
+		bool isUnderlined = ((m_effects & ScStyle_Underline) || m_glyphRun.hasFlag(ScLayout_Underlined));
+		if (isUnderlined && hasStrokeColor)
 		{
 			double st, lw;
 			if ((charStyle.underlineOffset() != -1) || (charStyle.underlineWidth() != -1))




More information about the scribus-commit mailing list