Skip to content
Permalink
Browse files

Wrap text-on-path beyond end on closed paths

  • Loading branch information
eudoxos committed Jul 8, 2017
1 parent 61e2c10 commit 4aba5e1b8890d742c953570805fd223e8350a4b8
Showing with 14 additions and 3 deletions.
  1. +14 −3 scribus/pageitem_pathtext.cpp
@@ -172,6 +172,9 @@ void PageItem_PathText::DrawObj_Item(ScPainter *p, QRectF cullingArea)
if (glyphRuns.isEmpty())
return;

// enable seamless crossing past the endpoint for closed curve
bool curveClosed=PoLine.isBezierClosed();

foreach (const GlyphCluster& run, glyphRuns)
{
totalTextLen += run.width();
@@ -209,7 +212,7 @@ void PageItem_PathText::DrawObj_Item(ScPainter *p, QRectF cullingArea)
extraOffset = (totalCurveLen - m_textDistanceMargins.left() - totalTextLen) / static_cast<double>(itemText.length());
}
int firstRun = 0;
if (totalTextLen + m_textDistanceMargins.left() > totalCurveLen && itemText.paragraphStyle(0).direction() == ParagraphStyle::RTL)
if (!curveClosed && totalTextLen + m_textDistanceMargins.left() > totalCurveLen && itemText.paragraphStyle(0).direction() == ParagraphStyle::RTL)
{
double totalLenDiff = totalTextLen + m_textDistanceMargins.left() - totalCurveLen;
while (firstRun < glyphRuns.count())
@@ -233,13 +236,21 @@ void PageItem_PathText::DrawObj_Item(ScPainter *p, QRectF cullingArea)
CurX += dx;
CurY = 0;
double currPerc = currPath.percentAtLength(CurX);
// sticks out to the next segment
if (currPerc >= 0.9999999)
{
currPathIndex++;
if (currPathIndex == pathList.count())
{
MaxChars = run.firstChar();
break;
if (curveClosed)
{
currPathIndex=0; // start from beginning again
}
else
{
MaxChars = run.firstChar();
break;
}
}
currPath = pathList[currPathIndex];
CurX = dx;

0 comments on commit 4aba5e1

Please sign in to comment.
You can’t perform that action at this time.