[scribus-dev] Overflowing problem

Elvis Stansvik elvstone at gmail.com
Tue Aug 9 07:31:49 UTC 2011


Hi all,

So while working on the table cell contents, I've hit a problem with
overflowing of the text frames that I so far haven't solved.

I decided to do a little test case to illustrate the behavior,
completely separate from my table code.

The attached screenshot shows two sets of text frames. The frames to
the left in the screenshot are painted by the following loop, which
I've simply put right before painter->end() in
Canvas::drawContents(...):

// DEBUG
// Create a text frame containing the text "Debug".
PageItem* f = new PageItem_TextFrame(m_doc,
	200.0, 100.0, 200.0, 20.0, 0.0,
	CommonStrings::None, CommonStrings::None);
f->itemText.insertChars("Debug");

for (int i = 0; i < 15; ++i)
{
	// Invalidate frame layout.
	f->invalidateLayout();

	// Draw frame.
	f->DrawObj(painter, QRectF());
	f->DrawObj_Decoration(painter);

	// Draw a rect around frame for debugging.
	painter->save();
	painter->setPen(Qt::red);
	painter->setLineWidth(0.5);
	painter->setFillMode(ScPainter::None);
	painter->drawRect(f->xPos(), f->yPos(), f->width(), f->height());
	painter->restore();

	// Print frame size and frameOverflows() return value.
	qDebug() << QString("frameOverflows() on %1,%2, %3x%4 returns ")
		.arg(f->xPos()).arg(f->yPos())
		.arg(f->width()).arg(f->height()) << f->frameOverflows();

	// Decrease height by 1 point and move the frame down by 25 points.
	f->setHeight(f->height() - 1.0);
	f->setYPos(f->yPos() + 25.0);
}
delete f;
// END DEBUG

The ones to the right in the screenshot I've created manually through
Scribus UI, and they have exactly the same dimensions as the ones to
the left.

As you can see there's a discrepancy between the two sets when it
comes to overflowing -- the ones created manually through UI will
overflow correctly when the frame gets too small, while the ones
painted by the above loop will not.

If _anyone_ has a good idea on why this might be happinging, I'm idle
ears. Because frankly I'm running out of ideas here :/

It's very simply to try this out, simply paste the snipped above right
before painter->end() in Canvas::drawContents() to test it.

Cheers,
Elvis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: overflow_behavior.png
Type: image/png
Size: 221265 bytes
Desc: not available
URL: <http://lists.scribus.net/pipermail/scribus-dev/attachments/20110809/110cf8d3/attachment-0001.png>


More information about the scribus-dev mailing list