r21363 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Sat Jun 4 14:36:27 UTC 2016
Author: jghali
Date: Sat Jun 4 14:36:27 2016
New Revision: 21363
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21363
Log:
#14128: Text centering doesn't work as expected in round text frame shapes
Modified:
trunk/Scribus/scribus/pageitem_textframe.cpp
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21363&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sat Jun 4 14:36:27 2016
@@ -537,7 +537,8 @@
line.lastRun = 0;
line.ascent = 0.0;
line.descent = 0.0;
- line.width = 0.0;
+ line.width = 0.0;
+ line.height = 0.0;
line.naturalWidth = 0.0;
line.colLeft = colLeft;
breakIndex = -1;
@@ -2582,8 +2583,15 @@
tabs.status = TabNONE;
if (SpecialChars::isBreak(itemText.text(a), Cols > 1))
{
- // find end of line
+ // Find end of line
+ // For break characters regionMinY and regionMaxY are usually equal due
+ // to ascent and descent of those characters being 0. So for non rectangular frames,
+ // this may result in current.endOfLine() finding an excessive value and some characters
+ // hanging out of frame, especially when using right alignment. So recompute regionMinY and
+ // regionMaxY based on line ascent and descent.
current.breakLine(style, firstLineOffset(), i);
+ regionMinY = current.line.y - current.line.ascent;
+ regionMaxY = current.line.y + current.line.descent;
EndX = current.endOfLine(m_availableRegion, style.rightMargin(), regionMinY, regionMaxY);
current.finishLine(EndX);
//addLine = true;
@@ -2999,7 +3007,18 @@
{
if (verticalAlign == 1)
hAdjust /= 2;
- textLayout.box()->moveBy(0, hAdjust);
+ if (FrameType == 0) // Rectangular frame
+ textLayout.box()->moveBy(0, hAdjust);
+ else
+ {
+ int vertAlign = verticalAlign;
+ double topDist = m_textDistanceMargins.top();
+ m_textDistanceMargins.setTop(topDist + hAdjust);
+ verticalAlign = 0;
+ layout();
+ verticalAlign = vertAlign;
+ m_textDistanceMargins.setTop(topDist);
+ }
}
}
invalid = false;
More information about the scribus-commit
mailing list