r16656 by jghali - #5761: Text vertically misaligned if first character is page number
scribus-commit
scribus-commit at lists.scribus.net
Sat Jun 11 23:25:22 UTC 2011
Author: jghali
Date: Sat Jun 11 23:25:22 2011
New Revision: 16656
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16656
Log:
#5761: Text vertically misaligned if first character is page number
Modified:
trunk/Scribus/scribus/pageitem_textframe.cpp
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16656&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sat Jun 11 23:25:22 2011
@@ -555,12 +555,16 @@
double getLineAscent(const StoryText& itemText)
{
double result = 0;
+ QChar firstChar = itemText.text(line.firstItem);
+ const CharStyle& fcStyle(itemText.charStyle(line.firstItem));
if ((itemText.text(line.firstItem) == SpecialChars::PARSEP) || (itemText.text(line.firstItem) == SpecialChars::LINEBREAK))
- result = itemText.charStyle(line.firstItem).font().ascent(itemText.charStyle(line.firstItem).fontSize() / 10.0);
+ result = fcStyle.font().ascent(fcStyle.fontSize() / 10.0);
else if (itemText.object(line.firstItem) != 0)
- result = qMax(result, (itemText.object(line.firstItem)->gHeight + itemText.object(line.firstItem)->lineWidth()) * (itemText.charStyle(line.firstItem).scaleV() / 1000.0));
+ result = qMax(result, (itemText.object(line.firstItem)->gHeight + itemText.object(line.firstItem)->lineWidth()) * (fcStyle.scaleV() / 1000.0));
+ else if ((firstChar == SpecialChars::PAGENUMBER) || (firstChar == SpecialChars::PAGECOUNT))
+ result = fcStyle.font().realCharAscent('8', fcStyle.fontSize() / 10.0);
else //if (itemText.charStyle(current.line.firstItem).effects() & ScStyle_DropCap == 0)
- result = itemText.charStyle(line.firstItem).font().realCharAscent(itemText.text(line.firstItem), itemText.charStyle(line.firstItem).fontSize() / 10.0);
+ result = fcStyle.font().realCharAscent(itemText.text(line.firstItem), fcStyle.fontSize() / 10.0);
for (int zc = 0; zc < itemsInLine; ++zc)
{
QChar ch = itemText.text(line.firstItem + zc);
@@ -586,12 +590,16 @@
double getLineDescent(const StoryText& itemText)
{
double result = 0;
- if ((itemText.text(line.firstItem) == SpecialChars::PARSEP) || (itemText.text(line.firstItem) == SpecialChars::LINEBREAK))
- result = itemText.charStyle(line.firstItem).font().descent(itemText.charStyle(line.firstItem).fontSize() / 10.0);
+ QChar firstChar = itemText.text(line.firstItem);
+ const CharStyle& fcStyle(itemText.charStyle(line.firstItem));
+ if ((firstChar == SpecialChars::PARSEP) || (firstChar == SpecialChars::LINEBREAK))
+ result = fcStyle.font().descent(fcStyle.fontSize() / 10.0);
else if (itemText.object(line.firstItem) != 0)
result = 0.0;
+ else if ((firstChar == SpecialChars::PAGENUMBER) || (firstChar == SpecialChars::PAGECOUNT))
+ result = fcStyle.font().realCharDescent('8', fcStyle.fontSize() / 10.0);
else //if (itemText.charStyle(current.line.firstItem).effects() & ScStyle_DropCap == 0)
- result = itemText.charStyle(line.firstItem).font().realCharDescent(itemText.text(line.firstItem), itemText.charStyle(line.firstItem).fontSize() / 10.0);
+ result = fcStyle.font().realCharDescent(firstChar, fcStyle.fontSize() / 10.0);
for (int zc = 0; zc < itemsInLine; ++zc)
{
QChar ch = itemText.text(line.firstItem + zc);
More information about the scribus-commit
mailing list