summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>2012-08-03 23:15:09 +0000
committerjghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>2012-08-03 23:15:09 +0000
commit8b81ec270ec6d5bb1b77a90c29bb44863ca59019 (patch)
tree2b2dae6b5c6ed68ff77144d852cab663bdde2f5f
parent092996ccb67d5d9897a757ac78aa43996a75dd93 (diff)
downloadscribus-8b81ec270ec6d5bb1b77a90c29bb44863ca59019.tar.gz
scribus-8b81ec270ec6d5bb1b77a90c29bb44863ca59019.tar.xz
scribus-8b81ec270ec6d5bb1b77a90c29bb44863ca59019.zip
suppress unnecessary big if() block in checkItemForFonts() function
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17752 11d20701-8431-0410-a711-e3c959e3b870
-rw-r--r--scribus/scribusdoc.cpp259
1 files changed, 130 insertions, 129 deletions
diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp
index eca15a2..6580b1c 100644
--- a/scribus/scribusdoc.cpp
+++ b/scribus/scribusdoc.cpp
@@ -3142,163 +3142,164 @@ void ScribusDoc::checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPoint
{
FPointArray gly;
QChar chstr;
- if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
+
+ if (!it->isTextFrame() && !it->isPathText())
+ return;
+
+ /* May be needed for fixing #10371 completely
+ if (it->isAnnotation())
{
- /* May be needed for fixing #10371 completely
- if (it->isAnnotation())
+ int annotType = it->annotation().Type();
+ bool mustEmbed = ((annotType >= 2) && (annotType <= 6) && (annotType != 4));
+ if (mustEmbed && (!Really.contains(it->itemText.defaultStyle().charStyle().font().replacementName())))
{
- int annotType = it->annotation().Type();
- bool mustEmbed = ((annotType >= 2) && (annotType <= 6) && (annotType != 4));
- if (mustEmbed && (!Really.contains(it->itemText.defaultStyle().charStyle().font().replacementName())))
- {
- Really.insert(it->itemText.defaultStyle().charStyle().font().replacementName(), QMap<uint, FPointArray>());
- }
- }*/
- int start = it->isTextFrame() ? it->firstInFrame() : 0;
- int stop = it->isTextFrame() ? it->lastInFrame() + 1 : it->itemText.length();
- for (int e = start; e < stop; ++e)
+ Really.insert(it->itemText.defaultStyle().charStyle().font().replacementName(), QMap<uint, FPointArray>());
+ }
+ }*/
+ int start = it->isTextFrame() ? it->firstInFrame() : 0;
+ int stop = it->isTextFrame() ? it->lastInFrame() + 1 : it->itemText.length();
+ for (int e = start; e < stop; ++e)
+ {
+ if (! Really.contains(it->itemText.charStyle(e).font().replacementName()) )
+ {
+ if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
+ Really.insert(it->itemText.charStyle(e).font().replacementName(), QMap<uint, FPointArray>());
+ }
+ uint chr = it->itemText.text(e).unicode();
+ if ((chr == 13) || (chr == 32) || ((chr >= 26) && (chr <= 29)))
+ continue;
+ if (chr == 9)
{
- if (! Really.contains(it->itemText.charStyle(e).font().replacementName()) )
+ for (int t1 = 0; t1 < it->itemText.paragraphStyle(e).tabValues().count(); t1++)
{
+ if (it->itemText.paragraphStyle(e).tabValues()[t1].tabFillChar.isNull())
+ continue;
+ chstr = it->itemText.paragraphStyle(e).tabValues()[t1].tabFillChar;
+ if ((it->itemText.charStyle(e).effects() & ScStyle_SmallCaps) || (it->itemText.charStyle(e).effects() & ScStyle_AllCaps))
+ {
+ if (chstr.toUpper() != chstr)
+ chstr = chstr.toUpper();
+ }
+ chr = chstr.unicode();
+ uint gl = it->itemText.charStyle(e).font().char2CMap(chstr);
+ gly = it->itemText.charStyle(e).font().glyphOutline(gl);
if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really.insert(it->itemText.charStyle(e).font().replacementName(), QMap<uint, FPointArray>());
+ Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
}
- uint chr = it->itemText.text(e).unicode();
- if ((chr == 13) || (chr == 32) || ((chr >= 26) && (chr <= 29)))
- continue;
- if (chr == 9)
+ for (int t1 = 0; t1 < it->itemText.defaultStyle().tabValues().count(); t1++)
{
- for (int t1 = 0; t1 < it->itemText.paragraphStyle(e).tabValues().count(); t1++)
+ if (it->itemText.defaultStyle().tabValues()[t1].tabFillChar.isNull())
+ continue;
+ chstr = it->itemText.defaultStyle().tabValues()[t1].tabFillChar;
+ if ((it->itemText.charStyle(e).effects() & ScStyle_SmallCaps) || (it->itemText.charStyle(e).effects() & ScStyle_AllCaps))
{
- if (it->itemText.paragraphStyle(e).tabValues()[t1].tabFillChar.isNull())
- continue;
- chstr = it->itemText.paragraphStyle(e).tabValues()[t1].tabFillChar;
- if ((it->itemText.charStyle(e).effects() & ScStyle_SmallCaps) || (it->itemText.charStyle(e).effects() & ScStyle_AllCaps))
- {
- if (chstr.toUpper() != chstr)
- chstr = chstr.toUpper();
- }
- chr = chstr.unicode();
- uint gl = it->itemText.charStyle(e).font().char2CMap(chstr);
- gly = it->itemText.charStyle(e).font().glyphOutline(gl);
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
+ if (chstr.toUpper() != chstr)
+ chstr = chstr.toUpper();
}
- for (int t1 = 0; t1 < it->itemText.defaultStyle().tabValues().count(); t1++)
+ chr = chstr.unicode();
+ uint gl = it->itemText.charStyle(e).font().char2CMap(chstr);
+ gly = it->itemText.charStyle(e).font().glyphOutline(gl);
+ if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
+ Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
+ }
+ continue;
+ }
+ if ((chr == 30) || (chr == 23))
+ {
+ //Our page number collection string
+ QString pageNumberText(QString::null);
+ if (chr == 30)
+ {
+ if (e > 0 && it->itemText.text(e-1) == SpecialChars::PAGENUMBER)
+ pageNumberText=SpecialChars::ZWNBSPACE;
+ else if (lc!=0) //If not on a master page just get the page number for the page and the text
+ pageNumberText=getSectionPageNumberForPageIndex(it->OwnPage);
+ else
{
- if (it->itemText.defaultStyle().tabValues()[t1].tabFillChar.isNull())
- continue;
- chstr = it->itemText.defaultStyle().tabValues()[t1].tabFillChar;
- if ((it->itemText.charStyle(e).effects() & ScStyle_SmallCaps) || (it->itemText.charStyle(e).effects() & ScStyle_AllCaps))
+ //Else, for a page number in a text frame on a master page we must scan
+ //all pages to see which ones use this page and get their page numbers.
+ //We only add each character of the pages' page number text if its nothing
+ //already in the pageNumberText variable. No need to add glyphs twice.
+ QString newText;
+ uint docPageCount=DocPages.count();
+ for (uint a = 0; a < docPageCount; ++a)
{
- if (chstr.toUpper() != chstr)
- chstr = chstr.toUpper();
+ if (DocPages.at(a)->MPageNam == it->OnMasterPage)
+ {
+ newText=getSectionPageNumberForPageIndex(a);
+ for (int nti=0;nti<newText.length();++nti)
+ if (pageNumberText.indexOf(newText[nti])==-1)
+ pageNumberText+=newText[nti];
+ }
}
- chr = chstr.unicode();
- uint gl = it->itemText.charStyle(e).font().char2CMap(chstr);
- gly = it->itemText.charStyle(e).font().glyphOutline(gl);
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
}
- continue;
}
- if ((chr == 30) || (chr == 23))
+ else
{
- //Our page number collection string
- QString pageNumberText(QString::null);
- if (chr == 30)
+ if (lc!=0)
{
- if (e > 0 && it->itemText.text(e-1) == SpecialChars::PAGENUMBER)
- pageNumberText=SpecialChars::ZWNBSPACE;
- else if (lc!=0) //If not on a master page just get the page number for the page and the text
- pageNumberText=getSectionPageNumberForPageIndex(it->OwnPage);
+ QString out("%1");
+ int key = getSectionKeyForPageIndex(it->OwnPage);
+ if (key == -1)
+ pageNumberText = "";
else
- {
- //Else, for a page number in a text frame on a master page we must scan
- //all pages to see which ones use this page and get their page numbers.
- //We only add each character of the pages' page number text if its nothing
- //already in the pageNumberText variable. No need to add glyphs twice.
- QString newText;
- uint docPageCount=DocPages.count();
- for (uint a = 0; a < docPageCount; ++a)
- {
- if (DocPages.at(a)->MPageNam == it->OnMasterPage)
- {
- newText=getSectionPageNumberForPageIndex(a);
- for (int nti=0;nti<newText.length();++nti)
- if (pageNumberText.indexOf(newText[nti])==-1)
- pageNumberText+=newText[nti];
- }
- }
- }
+ pageNumberText = out.arg(getStringFromSequence(sections[key].type, sections[key].toindex - sections[key].fromindex + 1));
}
else
{
- if (lc!=0)
- {
- QString out("%1");
- int key = getSectionKeyForPageIndex(it->OwnPage);
- if (key == -1)
- pageNumberText = "";
- else
- pageNumberText = out.arg(getStringFromSequence(sections[key].type, sections[key].toindex - sections[key].fromindex + 1));
- }
- else
+ QString newText;
+ uint docPageCount=DocPages.count();
+ for (uint a = 0; a < docPageCount; ++a)
{
- QString newText;
- uint docPageCount=DocPages.count();
- for (uint a = 0; a < docPageCount; ++a)
+ if (DocPages.at(a)->MPageNam == it->OnMasterPage)
{
- if (DocPages.at(a)->MPageNam == it->OnMasterPage)
- {
- QString out("%1");
- int key = getSectionKeyForPageIndex(a);
- if (key == -1)
- newText = "";
- else
- newText = out.arg(getStringFromSequence(sections[key].type, sections[key].toindex - sections[key].fromindex + 1));
- for (int nti=0;nti<newText.length();++nti)
- if (pageNumberText.indexOf(newText[nti])==-1)
- pageNumberText+=newText[nti];
- }
+ QString out("%1");
+ int key = getSectionKeyForPageIndex(a);
+ if (key == -1)
+ newText = "";
+ else
+ newText = out.arg(getStringFromSequence(sections[key].type, sections[key].toindex - sections[key].fromindex + 1));
+ for (int nti=0;nti<newText.length();++nti)
+ if (pageNumberText.indexOf(newText[nti])==-1)
+ pageNumberText+=newText[nti];
}
}
}
- //Now scan and add any glyphs used in page numbers
- for (int pnti=0;pnti<pageNumberText.length(); ++pnti)
- {
- uint chr = pageNumberText[pnti].unicode();
- if (it->itemText.charStyle(e).font().canRender(chr))
- {
- uint gl = it->itemText.charStyle(e).font().char2CMap(pageNumberText[pnti]);
- FPointArray gly(it->itemText.charStyle(e).font().glyphOutline(gl));
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
- }
- }
- continue;
- }
- if (it->itemText.charStyle(e).effects() & ScStyle_SmartHyphenVisible)
- {
- uint gl = it->itemText.charStyle(e).font().char2CMap(QChar('-'));
- FPointArray gly(it->itemText.charStyle(e).font().glyphOutline(gl));
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
- }
- if ((it->itemText.charStyle(e).effects() & ScStyle_SmallCaps) || (it->itemText.charStyle(e).effects() & ScStyle_AllCaps))
- {
- chstr = it->itemText.text(e);
- if (chstr.toUpper() != chstr)
- chstr = chstr.toUpper();
- chr = chstr.unicode();
}
- if (it->itemText.charStyle(e).font().canRender(chr))
+ //Now scan and add any glyphs used in page numbers
+ for (int pnti=0;pnti<pageNumberText.length(); ++pnti)
{
- uint gl = it->itemText.charStyle(e).font().char2CMap(chr);
- gly = it->itemText.charStyle(e).font().glyphOutline(gl);
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
+ uint chr = pageNumberText[pnti].unicode();
+ if (it->itemText.charStyle(e).font().canRender(chr))
+ {
+ uint gl = it->itemText.charStyle(e).font().char2CMap(pageNumberText[pnti]);
+ FPointArray gly(it->itemText.charStyle(e).font().glyphOutline(gl));
+ if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
+ Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
+ }
}
+ continue;
+ }
+ if (it->itemText.charStyle(e).effects() & ScStyle_SmartHyphenVisible)
+ {
+ uint gl = it->itemText.charStyle(e).font().char2CMap(QChar('-'));
+ FPointArray gly(it->itemText.charStyle(e).font().glyphOutline(gl));
+ if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
+ Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
+ }
+ if ((it->itemText.charStyle(e).effects() & ScStyle_SmallCaps) || (it->itemText.charStyle(e).effects() & ScStyle_AllCaps))
+ {
+ chstr = it->itemText.text(e);
+ if (chstr.toUpper() != chstr)
+ chstr = chstr.toUpper();
+ chr = chstr.unicode();
+ }
+ if (it->itemText.charStyle(e).font().canRender(chr))
+ {
+ uint gl = it->itemText.charStyle(e).font().char2CMap(chr);
+ gly = it->itemText.charStyle(e).font().glyphOutline(gl);
+ if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
+ Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
}
}
}