r16654 by jghali - #5761: Text vertically misaligned if first character is page number
scribus-commit
scribus-commit at lists.scribus.net
Sat Jun 11 23:22:31 UTC 2011
Author: jghali
Date: Sat Jun 11 23:22:31 2011
New Revision: 16654
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16654
Log:
#5761: Text vertically misaligned if first character is page number
Modified:
branches/Version135/Scribus/scribus/pageitem_textframe.cpp
Modified: branches/Version135/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16654&path=/branches/Version135/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pageitem_textframe.cpp (original)
+++ branches/Version135/Scribus/scribus/pageitem_textframe.cpp Sat Jun 11 23:22:31 2011
@@ -577,12 +577,16 @@
double getLineAscent(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().ascent(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().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(firstChar, fcStyle.fontSize() / 10.0);
for (int zc = 0; zc < itemsInLine; ++zc)
{
QChar ch = itemText.text(line.firstItem + zc);
@@ -608,12 +612,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