r21346 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Sun May 22 13:56:27 UTC 2016
Author: jghali
Date: Sun May 22 13:56:27 2016
New Revision: 21346
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21346
Log:
fix excessive line spacing when using dropcaps in combination with fixed linespacing by restoring pre-boxes behavior
Modified:
trunk/Scribus/scribus/pageitem_textframe.cpp
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21346&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sun May 22 13:56:27 2016
@@ -734,11 +734,31 @@
// Can happen when inserting a new line at end of text, WTF!
if (line.firstRun >= glyphRuns.length())
return;
- const CharStyle& cStyle(glyphRuns.at(line.firstRun).style());
- double scaleV = cStyle.scaleV() / 1000.0;
- double offset = (cStyle.fontSize() / 10) * (cStyle.baselineOffset() / 1000.0);
- line.ascent = cStyle.font().ascent(cStyle.fontSize()/10.00) * scaleV + offset;
- line.descent = cStyle.font().descent(cStyle.fontSize()/10.00) * scaleV - offset;
+
+ for (int i = line.firstRun; i <= breakIndex; ++i)
+ {
+ const GlyphRun &glyphRun = glyphRuns.at(i);
+ const CharStyle& cStyle(glyphRuns.at(line.firstRun).style());
+ double scaleV = cStyle.scaleV() / 1000.0;
+ double offset = (cStyle.fontSize() / 10) * (cStyle.baselineOffset() / 1000.0);
+
+ if (glyphRun.object())
+ {
+ QRectF bbox = glyphRun.object()->getVisualBoundingRect();
+ line.ascent = qMax(line.ascent, bbox.height() * scaleV + offset);
+ line.descent = qMax(line.descent, 0.0);
+ continue;
+ }
+
+ const QList<GlyphLayout>& glyphs = glyphRun.glyphs();
+ for (int j = 0; j < glyphs.count(); ++j)
+ {
+ const GlyphLayout& layout = glyphs.at(j);
+ GlyphMetrics metrics = cStyle.font().glyphBBox(layout.glyph, cStyle.fontSize()/10.00);
+ line.ascent = qMax(line.ascent, metrics.ascent * scaleV + offset);
+ line.descent = qMax(line.descent, metrics.descent * scaleV - offset);
+ }
+ }
}
// yPos should not be changed when all line is already calculated - at new y position there can be overflow!!!
@@ -2758,10 +2778,7 @@
current.restartIndex = current.line.lastRun + 1;
i = current.line.lastRun;
a = glyphRuns[i].firstChar();
- // if (glyphRuns[current.line.firstRun].hasFlag(ScLayout_DropCap))
- // current.rowDesc = qMax(current.rowDesc,current.yPos + current.line.descent);
- // else
- current.rowDesc = qMax(current.rowDesc,current.yPos - current.line.descent);
+ current.rowDesc = qMax(current.rowDesc, current.yPos + current.line.descent);
if (!current.lastInRowLine)
{
current.restartX = current.xPos;
More information about the scribus-commit
mailing list