r24104 by jghali - #15321 (partial fix): Drop caps don't drop

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 25 16:19:16 UTC 2020


Author: jghali
Date: Sun Oct 25 16:19:16 2020
New Revision: 24104

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24104
Log:
#15321 (partial fix): Drop caps don't drop

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24104&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Sun Oct 25 16:19:16 2020
@@ -1835,7 +1835,12 @@
 					if (firstLineOffset() == FLOPRealGlyphHeight)
 						addAsce = realAsce;
 					else if (firstLineOffset() == FLOPLineSpacing)
-						addAsce = style.lineSpacing();
+					{
+						if (DropCmode)
+							addAsce = DropCapDrop + style.lineSpacing();
+						else
+							addAsce = style.lineSpacing();
+					}
 				}
 				maxYAsc = current.yPos - addAsce;
 			}
@@ -1844,17 +1849,14 @@
 			//fix for glyphs with negative realAsce value
 			maxYAsc = qMax(maxYAsc, 0.0);
 			maxYDesc = current.yPos + realDesc;
-
-			if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
-			{
-				regionMinY = static_cast<int>(floor(maxYAsc));
-				regionMaxY = static_cast<int>(floor(maxYDesc));
-			}
-			else // #11727, #11628, etc.
-			{
-				regionMinY = static_cast<int>(qMax(0.0, floor(current.yPos - (asce + offset))));
-				regionMaxY = static_cast<int>(floor(current.yPos + desc));
-			}
+			if (style.lineSpacingMode() != ParagraphStyle::AutomaticLineSpacing)
+			{
+				maxYAsc = qMin(maxYAsc, qMax(0.0, current.yPos - asce));
+				maxYDesc = current.yPos + desc;
+			}
+
+			regionMinY = static_cast<int>(floor(maxYAsc));
+			regionMaxY = static_cast<int>(floor(maxYDesc));
 
 			if (current.isEmpty && !current.afterOverflow)
 			{
@@ -1923,36 +1925,21 @@
 						else
 							current.yPos += (current.startOfCol ? 1 : style.lineSpacing());
 						lastLineY = maxYAsc;
+
 						if (current.startOfCol)
-						{
-//							double addAsce;
-//							if (DropCmode)
-//								addAsce = qMax(realAsce, asce + offset);
-//							else
-//								addAsce = asce + offset;
-//							if (style.lineSpacingMode() != ParagraphStyle::BaselineGridLineSpacing)
-//							{
-//								if (firstLineOffset() == FLOPRealGlyphHeight)
-//									addAsce = realAsce;
-//								else if (firstLineOffset() == FLOPLineSpacing)
-//									addAsce = style.lineSpacing() + offset;
-//							}
 							maxYAsc = current.yPos - addAsce;
-						}
 						else
 							maxYAsc = current.yPos - realAsce;
+						maxYAsc = qMax(maxYAsc, 0.0);
 						maxYDesc = current.yPos + realDesc;
-
-						if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
+						if (style.lineSpacingMode() != ParagraphStyle::AutomaticLineSpacing)
 						{
-							regionMinY = static_cast<int>(floor(maxYAsc));
-							regionMaxY = static_cast<int>(floor(maxYDesc));
+							maxYAsc = qMin(maxYAsc, qMax(0.0, current.yPos - asce));
+							maxYDesc = current.yPos + desc;
 						}
-						else // #11727, #11628, etc.
-						{
-							regionMinY = static_cast<int>(qMax(0.0, floor(current.yPos - (asce + offset))));
-							regionMaxY = static_cast<int>(floor(current.yPos + desc));
-						}
+
+						regionMinY = static_cast<int>(floor(maxYAsc));
+						regionMaxY = static_cast<int>(floor(maxYDesc));
 
 						pt.moveTopLeft(QPoint(static_cast<int>(floor(current.xPos)), regionMinY));
 						done = false;




More information about the scribus-commit mailing list