Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 8090 → Rev 8091

/branches/Version13x/Scribus/scribus/pdflib.cpp
3911,215 → 3911,218
 
uint glyph = hl->glyph.glyph;
 
if (hl->strokeColor() != CommonStrings::None)
if (glyph < ScFace::CONTROL_GLYPHS)
{
StrokeColor = "";
StrokeColor += putColor(hl->strokeColor(), hl->strokeShade(), false);
}
if (hl->fillColor() != CommonStrings::None)
{
FillColor = "";
FillColor += putColor(hl->fillColor(), hl->fillShade(), true);
}
if (((hl->effects() & ScStyle_Underline) && (chstr != SpecialChars::PARSEP)) || ((hl->effects() & ScStyle_UnderlineWords) && (!chstr[0].isSpace())))
{
// double Ulen = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->glyph.scaleH);
double Ulen = hl->glyph.xadvance;
double Upos, Uwid, kern;
if (hl->effects() & ScStyle_StartOfLine)
kern = 0;
else
kern = hl->fontSize() * hl->tracking() / 10000.0;
if ((hl->underlineOffset() != -1) || (hl->underlineWidth() != -1))
if (hl->strokeColor() != CommonStrings::None)
{
if (hl->underlineOffset() != -1)
Upos = (hl->underlineOffset() / 1000.0) * (hl->font().descent(hl->fontSize() / 10.0));
else
Upos = hl->font().underlinePos(hl->fontSize() / 10.0);
if (hl->underlineWidth() != -1)
Uwid = (hl->underlineWidth() / 1000.0) * (hl->fontSize() / 10.0);
else
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
StrokeColor = "";
StrokeColor += putColor(hl->strokeColor(), hl->strokeShade(), false);
}
else
if (hl->fillColor() != CommonStrings::None)
{
Upos = hl->font().underlinePos(hl->fontSize() / 10.0);
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
FillColor = "";
FillColor += putColor(hl->fillColor(), hl->fillShade(), true);
}
if (hl->baselineOffset() != 0)
Upos += (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
if (hl->fillColor() != CommonStrings::None)
tmp2 += putColor(hl->fillColor(), hl->fillShade(), false);
tmp2 += FToStr(Uwid)+" w\n";
tmp2 += FToStr(x+hl->glyph.xoffset-kern)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" m\n";
tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" l\n";
tmp2 += "S\n";
}
if ((!hl->font().hasNames()) || (Options.SubsetList.contains(hl->font().replacementName())))
{
// uint chr = chstr[0].unicode();
if (glyph != hl->font().char2CMap(QChar(' ')))
if (((hl->effects() & ScStyle_Underline) && (chstr != SpecialChars::PARSEP)) || ((hl->effects() & ScStyle_UnderlineWords) && (!chstr[0].isSpace())))
{
if ((hl->strokeColor() != CommonStrings::None) && (hl->effects() & ScStyle_Outline))
// double Ulen = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->glyph.scaleH);
double Ulen = hl->glyph.xadvance;
double Upos, Uwid, kern;
if (hl->effects() & ScStyle_StartOfLine)
kern = 0;
else
kern = hl->fontSize() * hl->tracking() / 10000.0;
if ((hl->underlineOffset() != -1) || (hl->underlineWidth() != -1))
{
tmp2 += FToStr((tsz * hl->outlineWidth() / 1000.0) / tsz)+" w\n[] 0 d\n0 J\n0 j\n";
tmp2 += StrokeColor;
if (hl->underlineOffset() != -1)
Upos = (hl->underlineOffset() / 1000.0) * (hl->font().descent(hl->fontSize() / 10.0));
else
Upos = hl->font().underlinePos(hl->fontSize() / 10.0);
if (hl->underlineWidth() != -1)
Uwid = (hl->underlineWidth() / 1000.0) * (hl->fontSize() / 10.0);
else
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
if (hl->fillColor() != CommonStrings::None)
tmp2 += FillColor;
tmp2 += "q\n";
if (ite->itemType() == PageItem::PathText)
else
{
QWMatrix trafo = QWMatrix( 1, 0, 0, -1, -hl->PRot, 0 );
if (ite->textPathFlipped)
trafo *= QWMatrix(1, 0, 0, -1, 0, 0);
if (ite->textPathType == 0)
trafo *= QWMatrix( hl->PtransX, -hl->PtransY, -hl->PtransY, -hl->PtransX, hl->glyph.xoffset, -hl->glyph.yoffset );
else if (ite->textPathType == 1)
trafo *= QWMatrix(1, 0, 0, -1, hl->glyph.xoffset, -hl->glyph.yoffset );
tmp2 += FToStr(trafo.m11())+" "+FToStr(trafo.m12())+" "+FToStr(trafo.m21())+" "+FToStr(trafo.m22())+" "+FToStr(trafo.dx())+" "+FToStr(trafo.dy())+" cm\n";
Upos = hl->font().underlinePos(hl->fontSize() / 10.0);
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
if (!ite->asPathText())
if (hl->baselineOffset() != 0)
Upos += (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
if (hl->fillColor() != CommonStrings::None)
tmp2 += putColor(hl->fillColor(), hl->fillShade(), false);
tmp2 += FToStr(Uwid)+" w\n";
tmp2 += FToStr(x+hl->glyph.xoffset-kern)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" m\n";
tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" l\n";
tmp2 += "S\n";
}
if ((!hl->font().hasNames()) || (Options.SubsetList.contains(hl->font().replacementName())))
{
// uint chr = chstr[0].unicode();
if (glyph != hl->font().char2CMap(QChar(' ')))
{
if (ite->reversed())
if ((hl->strokeColor() != CommonStrings::None) && (hl->effects() & ScStyle_Outline))
{
double wid = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->glyph.scaleH);
tmp2 += "1 0 0 1 "+FToStr(x+hl->glyph.xoffset)+" "+FToStr((y+hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (hl->baselineOffset() / 1000.0)))+" cm\n";
tmp2 += "-1 0 0 1 0 0 cm\n";
tmp2 += "1 0 0 1 "+FToStr(-wid)+" 0 cm\n";
tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" 0 0 cm\n";
tmp2 += FToStr((tsz * hl->outlineWidth() / 1000.0) / tsz)+" w\n[] 0 d\n0 J\n0 j\n";
tmp2 += StrokeColor;
}
if (hl->fillColor() != CommonStrings::None)
tmp2 += FillColor;
tmp2 += "q\n";
if (ite->itemType() == PageItem::PathText)
{
QWMatrix trafo = QWMatrix( 1, 0, 0, -1, -hl->PRot, 0 );
if (ite->textPathFlipped)
trafo *= QWMatrix(1, 0, 0, -1, 0, 0);
if (ite->textPathType == 0)
trafo *= QWMatrix( hl->PtransX, -hl->PtransY, -hl->PtransY, -hl->PtransX, hl->glyph.xoffset, -hl->glyph.yoffset );
else if (ite->textPathType == 1)
trafo *= QWMatrix(1, 0, 0, -1, hl->glyph.xoffset, -hl->glyph.yoffset );
tmp2 += FToStr(trafo.m11())+" "+FToStr(trafo.m12())+" "+FToStr(trafo.m21())+" "+FToStr(trafo.m22())+" "+FToStr(trafo.dx())+" "+FToStr(trafo.dy())+" cm\n";
}
if (!ite->asPathText())
{
if (ite->reversed())
{
double wid = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->glyph.scaleH);
tmp2 += "1 0 0 1 "+FToStr(x+hl->glyph.xoffset)+" "+FToStr((y+hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (hl->baselineOffset() / 1000.0)))+" cm\n";
tmp2 += "-1 0 0 1 0 0 cm\n";
tmp2 += "1 0 0 1 "+FToStr(-wid)+" 0 cm\n";
tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" 0 0 cm\n";
}
else
{
tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" "+FToStr(x+hl->glyph.xoffset)+" "+FToStr((y+hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (hl->baselineOffset() / 1000.0)))+" cm\n";
}
}
else
{
tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" "+FToStr(x+hl->glyph.xoffset)+" "+FToStr((y+hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (hl->baselineOffset() / 1000.0)))+" cm\n";
if (ite->BaseOffs != 0)
tmp2 += "1 0 0 1 0 "+FToStr( -ite->BaseOffs)+" cm\n";
tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" 0 "+FToStr(tsz / 10.0)+" cm\n";
}
}
else
{
if (ite->BaseOffs != 0)
tmp2 += "1 0 0 1 0 "+FToStr( -ite->BaseOffs)+" cm\n";
tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" 0 "+FToStr(tsz / 10.0)+" cm\n";
}
if (hl->glyph.scaleV != 1.0)
tmp2 += "1 0 0 1 0 "+FToStr( (((tsz / 10.0) - (tsz / 10.0) * (hl->glyph.scaleV)) / (tsz / 10.0)) * -1)+" cm\n";
tmp2 += FToStr(QMAX(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(QMAX(hl->glyph.scaleV, 0.1))+" 0 0 cm\n";
if (hl->fillColor() != CommonStrings::None)
tmp2 += "/"+hl->font().psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+QString::number(glyph)+" Do\n";
if (hl->effects() & ScStyle_Outline)
{
FPointArray gly = hl->font().glyphOutline(glyph);
QWMatrix mat;
mat.scale(0.1, 0.1);
gly.map(mat);
bool nPath = true;
FPoint np;
if (gly.size() > 3)
if (hl->glyph.scaleV != 1.0)
tmp2 += "1 0 0 1 0 "+FToStr( (((tsz / 10.0) - (tsz / 10.0) * (hl->glyph.scaleV)) / (tsz / 10.0)) * -1)+" cm\n";
tmp2 += FToStr(QMAX(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(QMAX(hl->glyph.scaleV, 0.1))+" 0 0 cm\n";
if (hl->fillColor() != CommonStrings::None)
tmp2 += "/"+hl->font().psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+QString::number(glyph)+" Do\n";
if (hl->effects() & ScStyle_Outline)
{
for (uint poi=0; poi<gly.size()-3; poi += 4)
FPointArray gly = hl->font().glyphOutline(glyph);
QWMatrix mat;
mat.scale(0.1, 0.1);
gly.map(mat);
bool nPath = true;
FPoint np;
if (gly.size() > 3)
{
if (gly.point(poi).x() > 900000)
for (uint poi=0; poi<gly.size()-3; poi += 4)
{
tmp2 += "h\n";
nPath = true;
continue;
if (gly.point(poi).x() > 900000)
{
tmp2 += "h\n";
nPath = true;
continue;
}
if (nPath)
{
np = gly.point(poi);
tmp2 += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
nPath = false;
}
np = gly.point(poi+1);
tmp2 += FToStr(np.x())+" "+FToStr(-np.y())+" ";
np = gly.point(poi+3);
tmp2 += FToStr(np.x())+" "+FToStr(-np.y())+" ";
np = gly.point(poi+2);
tmp2 += FToStr(np.x())+" "+FToStr(-np.y())+" c\n";
}
if (nPath)
{
np = gly.point(poi);
tmp2 += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
nPath = false;
}
np = gly.point(poi+1);
tmp2 += FToStr(np.x())+" "+FToStr(-np.y())+" ";
np = gly.point(poi+3);
tmp2 += FToStr(np.x())+" "+FToStr(-np.y())+" ";
np = gly.point(poi+2);
tmp2 += FToStr(np.x())+" "+FToStr(-np.y())+" c\n";
}
tmp2 += "s\n";
}
tmp2 += "s\n";
tmp2 += "Q\n";
}
tmp2 += "Q\n";
}
}
else
{
uint idx = hl->glyph.glyph;
uint idx1 = idx / 224;
tmp += UsedFontsP[hl->font().replacementName()]+"S"+QString::number(idx1)+" "+FToStr(tsz / 10.0)+" Tf\n";
if (hl->strokeColor() != CommonStrings::None)
{
tmp += StrokeColor;
if ((hl->effects() & ScStyle_Underline) || (hl->effects() & ScStyle_Strikethrough))
tmp2 += StrokeColor;
}
if (hl->fillColor() != CommonStrings::None)
{
tmp += FillColor;
if ((hl->effects() & ScStyle_Underline) || (hl->effects() & ScStyle_Strikethrough))
tmp2 += FillColor;
}
if (hl->effects() & 4)
tmp += FToStr(tsz * hl->outlineWidth() / 10000.0) + (hl->fillColor() != CommonStrings::None ? " w 2 Tr\n" : " w 1 Tr\n");
else
tmp += "0 Tr\n";
if (!ite->asPathText())
{
if (ite->reversed())
uint idx = hl->glyph.glyph;
uint idx1 = idx / 224;
tmp += UsedFontsP[hl->font().replacementName()]+"S"+QString::number(idx1)+" "+FToStr(tsz / 10.0)+" Tf\n";
if (hl->strokeColor() != CommonStrings::None)
{
// int chs = hl->fontSize();
double wtr = hl->glyph.xadvance;
tmp += FToStr(-QMAX(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(QMAX(hl->glyph.scaleV, 0.1)) +" "+FToStr(x+hl->glyph.xoffset+wtr)+" "+FToStr(-y-hl->glyph.yoffset+(hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0))+" Tm\n";
// tmp += "-1 0 0 1 "+FToStr(wtr)+" "+FToStr(0)+" Tm\n";
tmp += StrokeColor;
if ((hl->effects() & ScStyle_Underline) || (hl->effects() & ScStyle_Strikethrough))
tmp2 += StrokeColor;
}
if (hl->fillColor() != CommonStrings::None)
{
tmp += FillColor;
if ((hl->effects() & ScStyle_Underline) || (hl->effects() & ScStyle_Strikethrough))
tmp2 += FillColor;
}
if (hl->effects() & 4)
tmp += FToStr(tsz * hl->outlineWidth() / 10000.0) + (hl->fillColor() != CommonStrings::None ? " w 2 Tr\n" : " w 1 Tr\n");
else
tmp += FToStr(QMAX(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(QMAX(hl->glyph.scaleV, 0.1))+" "+FToStr(x+hl->glyph.xoffset)+" "+FToStr(-y-hl->glyph.yoffset+(hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0))+" Tm\n";
tmp += "0 Tr\n";
if (!ite->asPathText())
{
if (ite->reversed())
{
// int chs = hl->fontSize();
double wtr = hl->glyph.xadvance;
tmp += FToStr(-QMAX(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(QMAX(hl->glyph.scaleV, 0.1)) +" "+FToStr(x+hl->glyph.xoffset+wtr)+" "+FToStr(-y-hl->glyph.yoffset+(hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0))+" Tm\n";
// tmp += "-1 0 0 1 "+FToStr(wtr)+" "+FToStr(0)+" Tm\n";
}
else
tmp += FToStr(QMAX(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(QMAX(hl->glyph.scaleV, 0.1))+" "+FToStr(x+hl->glyph.xoffset)+" "+FToStr(-y-hl->glyph.yoffset+(hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0))+" Tm\n";
}
else
tmp += FToStr(QMAX(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(QMAX(hl->glyph.scaleV, 0.1))+" 0 0 Tm\n";
uchar idx2 = idx % 224 + 32;
tmp += "<"+QString(toHex(idx2))+"> Tj\n";
}
else
tmp += FToStr(QMAX(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(QMAX(hl->glyph.scaleV, 0.1))+" 0 0 Tm\n";
uchar idx2 = idx % 224 + 32;
tmp += "<"+QString(toHex(idx2))+"> Tj\n";
}
if ((hl->effects() & ScStyle_Strikethrough) && (chstr != SpecialChars::PARSEP))
{
// double Ulen = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->glyph.scaleH);
double Ulen = hl->glyph.xadvance;
double Upos, Uwid, kern;
if (hl->effects() & ScStyle_StartOfLine)
kern = 0;
else
kern = hl->fontSize() * hl->tracking() / 10000.0;
if ((hl->strikethruOffset() != -1) || (hl->strikethruWidth() != -1))
if ((hl->effects() & ScStyle_Strikethrough) && (chstr != SpecialChars::PARSEP))
{
if (hl->strikethruOffset() != -1)
Upos = (hl->strikethruOffset() / 1000.0) * (hl->font().ascent(hl->fontSize() / 10.0));
// double Ulen = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->glyph.scaleH);
double Ulen = hl->glyph.xadvance;
double Upos, Uwid, kern;
if (hl->effects() & ScStyle_StartOfLine)
kern = 0;
else
kern = hl->fontSize() * hl->tracking() / 10000.0;
if ((hl->strikethruOffset() != -1) || (hl->strikethruWidth() != -1))
{
if (hl->strikethruOffset() != -1)
Upos = (hl->strikethruOffset() / 1000.0) * (hl->font().ascent(hl->fontSize() / 10.0));
else
Upos = hl->font().strikeoutPos(hl->fontSize() / 10.0);
if (hl->strikethruWidth() != -1)
Uwid = (hl->strikethruWidth() / 1000.0) * (hl->fontSize() / 10.0);
else
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
else
{
Upos = hl->font().strikeoutPos(hl->fontSize() / 10.0);
if (hl->strikethruWidth() != -1)
Uwid = (hl->strikethruWidth() / 1000.0) * (hl->fontSize() / 10.0);
else
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
if (hl->baselineOffset() != 0)
Upos += (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
if (hl->fillColor() != CommonStrings::None)
tmp2 += putColor(hl->fillColor(), hl->fillShade(), false);
tmp2 += FToStr(Uwid)+" w\n";
tmp2 += FToStr(x+hl->glyph.xoffset-kern)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" m\n";
tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" l\n";
tmp2 += "S\n";
}
else
if (ite->asPathText())
{
Upos = hl->font().strikeoutPos(hl->fontSize() / 10.0);
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
tmp += "ET\nQ\n"+tmp2;
tmp2 = "";
}
if (hl->baselineOffset() != 0)
Upos += (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
if (hl->fillColor() != CommonStrings::None)
tmp2 += putColor(hl->fillColor(), hl->fillShade(), false);
tmp2 += FToStr(Uwid)+" w\n";
tmp2 += FToStr(x+hl->glyph.xoffset-kern)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" m\n";
tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" l\n";
tmp2 += "S\n";
}
if (ite->asPathText())
{
tmp += "ET\nQ\n"+tmp2;
tmp2 = "";
}
if (hl->glyph.more) {
// ugly hack until setTextCh interface is changed
ScText hl2(*hl);
/branches/Version13x/Scribus/scribus/pslib.cpp
3553,188 → 3553,188
chstr = "-";
}
if (glyph >= ScFace::CONTROL_GLYPHS)
return;
 
if (((cstyle.effects() & ScStyle_Underline)) //FIXME && (chstr != QChar(13)))
|| ((cstyle.effects() & ScStyle_UnderlineWords) && (!chstr[0].isSpace())))
if (glyph < ScFace::CONTROL_GLYPHS)
{
// double Ulen = cstyle.font().glyphWidth(glyph, cstyle.fontSize()) * glyphs.scaleH;
double Ulen = glyphs.xadvance;
double Upos, lw, kern;
if (cstyle.effects() & ScStyle_StartOfLine)
kern = 0;
else
kern = cstyle.fontSize() * cstyle.tracking() / 10000.0;
if ((cstyle.underlineOffset() != -1) || (cstyle.underlineWidth() != -1))
if (((cstyle.effects() & ScStyle_Underline)) //FIXME && (chstr != QChar(13)))
|| ((cstyle.effects() & ScStyle_UnderlineWords) && (!chstr[0].isSpace())))
{
if (cstyle.underlineOffset() != -1)
Upos = (cstyle.underlineOffset() / 1000.0) * (cstyle.font().descent(cstyle.fontSize() / 10.0));
// double Ulen = cstyle.font().glyphWidth(glyph, cstyle.fontSize()) * glyphs.scaleH;
double Ulen = glyphs.xadvance;
double Upos, lw, kern;
if (cstyle.effects() & ScStyle_StartOfLine)
kern = 0;
else
kern = cstyle.fontSize() * cstyle.tracking() / 10000.0;
if ((cstyle.underlineOffset() != -1) || (cstyle.underlineWidth() != -1))
{
if (cstyle.underlineOffset() != -1)
Upos = (cstyle.underlineOffset() / 1000.0) * (cstyle.font().descent(cstyle.fontSize() / 10.0));
else
Upos = cstyle.font().underlinePos(cstyle.fontSize() / 10.0);
if (cstyle.underlineWidth() != -1)
lw = (cstyle.underlineWidth() / 1000.0) * (cstyle.fontSize() / 10.0);
else
lw = QMAX(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1);
}
else
{
Upos = cstyle.font().underlinePos(cstyle.fontSize() / 10.0);
if (cstyle.underlineWidth() != -1)
lw = (cstyle.underlineWidth() / 1000.0) * (cstyle.fontSize() / 10.0);
else
lw = QMAX(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1);
}
if (cstyle.baselineOffset() != 0)
Upos += (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0);
if (cstyle.fillColor() != CommonStrings::None)
{
PS_setcapjoin(Qt::FlatCap, Qt::MiterJoin);
PS_setdash(Qt::SolidLine, 0, dum);
SetFarbe(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
}
PS_setlinewidth(lw);
PS_moveto(x + glyphs.xoffset-kern, -y - glyphs.yoffset+Upos);
PS_lineto(x + glyphs.xoffset+Ulen, -y - glyphs.yoffset+Upos);
putColor(cstyle.fillColor(), cstyle.fillShade(), false);
}
else
/* Subset all TTF Fonts until the bug in the TTF-Embedding Code is fixed */
ScFace::FontType ftype = cstyle.font().type();
if ((ftype == ScFace::TTF) || (hl->font().isOTF()) || (hl->font().subset()))
{
Upos = cstyle.font().underlinePos(cstyle.fontSize() / 10.0);
lw = QMAX(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1);
if (glyph != 0 && glyph != cstyle.font().char2CMap(QChar(' ')))
{
PS_save();
if (ite->reversed())
{
PS_translate(x + hl->glyph.xoffset, (y + hl->glyph.yoffset - (tsz / 10.0)) * -1);
PS_scale(-1, 1);
PS_translate(-glyphs.xadvance, 0);
}
else
PS_translate(x + glyphs.xoffset, (y + glyphs.yoffset - (cstyle.fontSize() / 10.0)) * -1);
if (cstyle.baselineOffset() != 0)
PS_translate(0, (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0));
if (glyphs.scaleH != 1.0)
PS_scale(glyphs.scaleH, 1);
if (glyphs.scaleV != 1.0)
{
PS_translate(0, -((tsz / 10.0) - (tsz / 10.0) * (glyphs.scaleV)));
PS_scale(1, glyphs.scaleV);
}
if (cstyle.fillColor() != CommonStrings::None)
{
SetFarbe(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_fill(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
if ((colorsToUse[cstyle.fillColor()].isSpotColor()) && (!DoSep) && (useSpotColors))
PutSeite(ToStr(cstyle.fillShade() / 100.0)+" "+spotMap[cstyle.fillColor()]);
else
PutSeite(FillColor + " cmyk");
PS_showSub(glyph, cstyle.font().psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ), tsz / 10.0, false);
}
PS_restore();
}
}
if (cstyle.baselineOffset() != 0)
Upos += (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0);
if (cstyle.fillColor() != CommonStrings::None)
else if (glyph != 0)
{
PS_setcapjoin(Qt::FlatCap, Qt::MiterJoin);
PS_setdash(Qt::SolidLine, 0, dum);
SetFarbe(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
}
PS_setlinewidth(lw);
PS_moveto(x + glyphs.xoffset-kern, -y - glyphs.yoffset+Upos);
PS_lineto(x + glyphs.xoffset+Ulen, -y - glyphs.yoffset+Upos);
putColor(cstyle.fillColor(), cstyle.fillShade(), false);
}
/* Subset all TTF Fonts until the bug in the TTF-Embedding Code is fixed */
ScFace::FontType ftype = cstyle.font().type();
if ((ftype == ScFace::TTF) || (hl->font().isOTF()) || (hl->font().subset()))
{
if (glyph != 0 && glyph != cstyle.font().char2CMap(QChar(' ')))
{
PS_selectfont(cstyle.font().replacementName(), tsz / 10.0);
PS_save();
PS_translate(x + glyphs.xoffset, -y - glyphs.yoffset);
if (ite->reversed())
{
PS_translate(x + hl->glyph.xoffset, (y + hl->glyph.yoffset - (tsz / 10.0)) * -1);
PS_scale(-1, 1);
PS_translate(-glyphs.xadvance, 0);
PS_translate(glyphs.xadvance, 0);
}
else
PS_translate(x + glyphs.xoffset, (y + glyphs.yoffset - (cstyle.fontSize() / 10.0)) * -1);
if (cstyle.baselineOffset() != 0)
PS_translate(0, (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0));
if (glyphs.scaleH != 1.0)
PS_scale(glyphs.scaleH, 1);
if (glyphs.scaleV != 1.0)
{
PS_translate(0, -((tsz / 10.0) - (tsz / 10.0) * (glyphs.scaleV)));
PS_scale(1, glyphs.scaleV);
}
if (glyphs.scaleH != 1.0 || glyphs.scaleV != 1.0)
PS_scale(glyphs.scaleH, glyphs.scaleV);
if (cstyle.fillColor() != CommonStrings::None)
{
SetFarbe(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_fill(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
if ((colorsToUse[cstyle.fillColor()].isSpotColor()) && (!DoSep) && (useSpotColors))
{
PutSeite(ToStr(cstyle.fillShade() / 100.0)+" "+spotMap[cstyle.fillColor()]);
PS_show_xyG(cstyle.font().replacementName(), glyph, 0, 0, true);
}
else
PutSeite(FillColor + " cmyk");
PS_showSub(glyph, cstyle.font().psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ), tsz / 10.0, false);
PS_show_xyG(cstyle.font().replacementName(), glyph, 0, 0, false);
}
PS_restore();
}
}
else if (glyph != 0)
{
PS_selectfont(cstyle.font().replacementName(), tsz / 10.0);
PS_save();
PS_translate(x + glyphs.xoffset, -y - glyphs.yoffset);
if (ite->reversed())
if ((cstyle.effects() & ScStyle_Outline) || glyph == 0)//&& (chstr != QChar(13)))
{
PS_scale(-1, 1);
PS_translate(glyphs.xadvance, 0);
// if (cstyle.font().canRender(chstr[0]))
{
FPointArray gly = cstyle.font().glyphOutline(glyph);
QWMatrix chma, chma2, chma3;
chma.scale(tsz / 100.0, tsz / 100.0);
chma2.scale(glyphs.scaleH, glyphs.scaleV);
if (cstyle.baselineOffset() != 0)
chma3.translate(0, -(cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0));
gly.map(chma * chma2 * chma3);
if (ite->reversed())
{
chma = QWMatrix();
chma.scale(-1, 1);
chma.translate(wideR, 0);
gly.map(chma);
}
if ((cstyle.strokeColor() != CommonStrings::None) && ((tsz * cstyle.outlineWidth() / 10000.0) != 0))
{
PS_save();
PS_setlinewidth(tsz * cstyle.outlineWidth() / 10000.0);
PS_setcapjoin(Qt::FlatCap, Qt::MiterJoin);
PS_setdash(Qt::SolidLine, 0, dum);
PS_translate(x + glyphs.xoffset, (y + glyphs.yoffset - (tsz / 10.0)) * -1);
PS_translate(0, -((tsz / 10.0) - (tsz / 10.0) * glyphs.scaleV));
SetFarbe(cstyle.strokeColor(), cstyle.strokeShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
SetClipPath(&gly);
PS_closepath();
putColor(cstyle.strokeColor(), cstyle.strokeShade(), false);
PS_restore();
}
}
}
if (cstyle.baselineOffset() != 0)
PS_translate(0, (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0));
if (glyphs.scaleH != 1.0 || glyphs.scaleV != 1.0)
PS_scale(glyphs.scaleH, glyphs.scaleV);
if (cstyle.fillColor() != CommonStrings::None)
if ((cstyle.effects() & ScStyle_Strikethrough))//&& (chstr != QChar(13)))
{
SetFarbe(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
if ((colorsToUse[cstyle.fillColor()].isSpotColor()) && (!DoSep) && (useSpotColors))
// double Ulen = cstyle.font().glyphWidth(glyph, cstyle.fontSize()) * glyphs.scaleH;
double Ulen = glyphs.xadvance;
double Upos, lw, kern;
if (cstyle.effects() & 16384)
kern = 0;
else
kern = cstyle.fontSize() * cstyle.tracking() / 10000.0;
if ((cstyle.strikethruOffset() != -1) || (cstyle.strikethruWidth() != -1))
{
PutSeite(ToStr(cstyle.fillShade() / 100.0)+" "+spotMap[cstyle.fillColor()]);
PS_show_xyG(cstyle.font().replacementName(), glyph, 0, 0, true);
if (cstyle.strikethruOffset() != -1)
Upos = (cstyle.strikethruOffset() / 1000.0) * (cstyle.font().ascent(cstyle.fontSize() / 10.0));
else
Upos = cstyle.font().strikeoutPos(cstyle.fontSize() / 10.0);
if (cstyle.strikethruWidth() != -1)
lw = (cstyle.strikethruWidth() / 1000.0) * (cstyle.fontSize() / 10.0);
else
lw = QMAX(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1);
}
else
PS_show_xyG(cstyle.font().replacementName(), glyph, 0, 0, false);
}
PS_restore();
}
if ((cstyle.effects() & ScStyle_Outline) || glyph == 0)//&& (chstr != QChar(13)))
{
// if (cstyle.font().canRender(chstr[0]))
{
FPointArray gly = cstyle.font().glyphOutline(glyph);
QWMatrix chma, chma2, chma3;
chma.scale(tsz / 100.0, tsz / 100.0);
chma2.scale(glyphs.scaleH, glyphs.scaleV);
if (cstyle.baselineOffset() != 0)
chma3.translate(0, -(cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0));
gly.map(chma * chma2 * chma3);
if (ite->reversed())
{
chma = QWMatrix();
chma.scale(-1, 1);
chma.translate(wideR, 0);
gly.map(chma);
Upos = cstyle.font().strikeoutPos(cstyle.fontSize() / 10.0);
lw = QMAX(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1);
}
if ((cstyle.strokeColor() != CommonStrings::None) && ((tsz * cstyle.outlineWidth() / 10000.0) != 0))
if (cstyle.baselineOffset() != 0)
Upos += (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0);
if (cstyle.fillColor() != CommonStrings::None)
{
PS_save();
PS_setlinewidth(tsz * cstyle.outlineWidth() / 10000.0);
PS_setcapjoin(Qt::FlatCap, Qt::MiterJoin);
PS_setdash(Qt::SolidLine, 0, dum);
PS_translate(x + glyphs.xoffset, (y + glyphs.yoffset - (tsz / 10.0)) * -1);
PS_translate(0, -((tsz / 10.0) - (tsz / 10.0) * glyphs.scaleV));
SetFarbe(cstyle.strokeColor(), cstyle.strokeShade(), &h, &s, &v, &k, gcr);
SetFarbe(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
SetClipPath(&gly);
PS_closepath();
putColor(cstyle.strokeColor(), cstyle.strokeShade(), false);
PS_restore();
}
PS_setlinewidth(lw);
PS_moveto(x + glyphs.xoffset-kern, -y-glyphs.yoffset+Upos);
PS_lineto(x + glyphs.xoffset+Ulen, -y-glyphs.yoffset+Upos);
putColor(cstyle.fillColor(), cstyle.fillShade(), false);
}
}
if ((cstyle.effects() & ScStyle_Strikethrough))//&& (chstr != QChar(13)))
{
// double Ulen = cstyle.font().glyphWidth(glyph, cstyle.fontSize()) * glyphs.scaleH;
double Ulen = glyphs.xadvance;
double Upos, lw, kern;
if (cstyle.effects() & 16384)
kern = 0;
else
kern = cstyle.fontSize() * cstyle.tracking() / 10000.0;
if ((cstyle.strikethruOffset() != -1) || (cstyle.strikethruWidth() != -1))
{
if (cstyle.strikethruOffset() != -1)
Upos = (cstyle.strikethruOffset() / 1000.0) * (cstyle.font().ascent(cstyle.fontSize() / 10.0));
else
Upos = cstyle.font().strikeoutPos(cstyle.fontSize() / 10.0);
if (cstyle.strikethruWidth() != -1)
lw = (cstyle.strikethruWidth() / 1000.0) * (cstyle.fontSize() / 10.0);
else
lw = QMAX(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1);
}
else
{
Upos = cstyle.font().strikeoutPos(cstyle.fontSize() / 10.0);
lw = QMAX(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1);
}
if (cstyle.baselineOffset() != 0)
Upos += (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0);
if (cstyle.fillColor() != CommonStrings::None)
{
PS_setcapjoin(Qt::FlatCap, Qt::MiterJoin);
PS_setdash(Qt::SolidLine, 0, dum);
SetFarbe(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
}
PS_setlinewidth(lw);
PS_moveto(x + glyphs.xoffset-kern, -y-glyphs.yoffset+Upos);
PS_lineto(x + glyphs.xoffset+Ulen, -y-glyphs.yoffset+Upos);
putColor(cstyle.fillColor(), cstyle.fillShade(), false);
}
if (glyphs.more) {
// ugly hack until setTextCh interface is changed
ScText hl2(*hl);