Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 17751 → Rev 17752

/branches/Version14x/Scribus/scribus/scribusdoc.cpp
3142,164 → 3142,165
{
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 (! 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)
{
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 newText;
uint docPageCount=DocPages.count();
for (uint a = 0; a < docPageCount; ++a)
{
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)
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)
}
//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 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);
}
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);
}
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);
}
}
}