summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/pdfinput/pdf-parser.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2015-05-27 20:02:55 +0000
committertavmjong-free <tavmjong@free.fr>2015-05-27 20:02:55 +0000
commitebcbea982c7b7dce6a5d3641e3a5d3a556b4d69f (patch)
treeddf6ac6c50de218018780b1cc3688c92ebee8263 /src/extension/internal/pdfinput/pdf-parser.cpp
parentFix duplicate order (diff)
downloadinkscape-ebcbea982c7b7dce6a5d3641e3a5d3a556b4d69f.tar.gz
inkscape-ebcbea982c7b7dce6a5d3641e3a5d3a556b4d69f.zip
Add 'font-variant-xxx' to properties that should not be set on non-text elements.
(bzr r14179)
Diffstat (limited to 'src/extension/internal/pdfinput/pdf-parser.cpp')
-rw-r--r--src/extension/internal/pdfinput/pdf-parser.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index 836c34c32..a70b42d41 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -409,6 +409,7 @@ PdfParser::~PdfParser() {
}
}
+// Equivalent to Gfx::display()
void PdfParser::parse(Object *obj, GBool topLevel) {
Object obj2;
@@ -1578,11 +1579,13 @@ void PdfParser::opCloseStroke(Object * /*args[]*/, int /*numArgs*/) {
void PdfParser::opFill(Object /*args*/[], int /*numArgs*/)
{
+ std::cout << "PdfParser::opFill" << std::endl;
if (!state->isCurPt()) {
//error(getPos(), const_cast<char*>("No path in fill"));
return;
}
if (state->isPath()) {
+ std::cout << " isPath" << std::endl;
if (state->getFillColorSpace()->getMode() == csPattern &&
!builder->isPatternTypeSupported(state->getFillPattern())) {
doPatternFillFallback(gFalse);
@@ -1595,6 +1598,7 @@ void PdfParser::opFill(Object /*args*/[], int /*numArgs*/)
void PdfParser::opEOFill(Object /*args*/[], int /*numArgs*/)
{
+ std::cout << "PdfParser::opEOFill" << std::endl;
if (!state->isCurPt()) {
//error(getPos(), const_cast<char*>("No path in eofill"));
return;
@@ -1663,6 +1667,7 @@ void PdfParser::opCloseEOFillStroke(Object /*args*/[], int /*numArgs*/)
}
void PdfParser::doFillAndStroke(GBool eoFill) {
+ std::cout << "PdfParser::doFillandStroke()" << std::endl;
GBool fillOk = gTrue, strokeOk = gTrue;
if (state->getFillColorSpace()->getMode() == csPattern &&
!builder->isPatternTypeSupported(state->getFillPattern())) {
@@ -1673,14 +1678,17 @@ void PdfParser::doFillAndStroke(GBool eoFill) {
strokeOk = gFalse;
}
if (fillOk && strokeOk) {
+ std::cout << " ... fillOk and StrokeOk" << std::endl;
builder->addPath(state, true, true, eoFill);
} else {
+ std::cout << " ... fillOk or StrokeOk not OK" << std::endl;
doPatternFillFallback(eoFill);
doPatternStrokeFallback();
}
}
void PdfParser::doPatternFillFallback(GBool eoFill) {
+ std::cout << "PdfParser::doPatternFillFallback: " << eoFill << std::endl;
GfxPattern *pattern;
if (!(pattern = state->getFillPattern())) {
@@ -1704,6 +1712,7 @@ void PdfParser::doPatternFillFallback(GBool eoFill) {
}
void PdfParser::doPatternStrokeFallback() {
+ std::cout << "PdfParser::doPatternStrokeFallback" << std::endl;
GfxPattern *pattern;
if (!(pattern = state->getStrokePattern())) {
@@ -1737,6 +1746,8 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat,
shading = sPat->getShading();
+ std::cout << "PdfParser::doShadingPatternFillFallback: " << shading->getType() << std::endl;
+
// save current graphics state
savedPath = state->getPath()->copy();
saveState();
@@ -1823,6 +1834,12 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat,
break;
case 6:
case 7:
+ std::cout << " Type 6/7: calling doPatchMeshShFill()"
+ << " Clip path? " << (clipHistory->getClipPath()?"true":"false") << std::endl;
+ if (clipHistory->getClipPath()) {
+ builder->addShadedFill(shading, NULL, clipHistory->getClipPath(),
+ clipHistory->getClipType() == clipEO ? true : false);
+ }
doPatchMeshShFill(static_cast<GfxPatchMeshShading *>(shading));
break;
}
@@ -1856,6 +1873,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/)
return;
}
#endif
+ std::cout << "PdfParser::opShFill: type: " << shading->getType() << std::endl;
// save current graphics state
if (shading->getType() != 2 && shading->getType() != 3) {
@@ -1943,6 +1961,12 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/)
break;
case 6:
case 7:
+ std::cout << " Type 6/7: calling doPatchMeshShFill()"
+ << " Clip path? " << (clipHistory->getClipPath()?"true":"false") << std::endl;
+ if (clipHistory->getClipPath()) {
+ builder->addShadedFill(shading, matrix, clipHistory->getClipPath(),
+ clipHistory->getClipType() == clipEO ? true : false);
+ }
doPatchMeshShFill(static_cast<GfxPatchMeshShading *>(shading));
break;
}
@@ -2141,6 +2165,10 @@ void PdfParser::gouraudFillTriangle(double x0, double y0, GfxColor *color0,
void PdfParser::doPatchMeshShFill(GfxPatchMeshShading *shading) {
int start, i;
+ // if( true ) {
+ // builder->patchMeshShadedFill( state, shading );
+ // }
+ std::cout << "PdfParser::doPatchMeshShFill: Number of patches: " << shading->getNPatches() << std::endl;
if (shading->getNPatches() > 128) {
start = 3;
} else if (shading->getNPatches() > 64) {
@@ -2690,6 +2718,7 @@ void PdfParser::doShowText(GooString *s) {
state->textTransformDelta(0, state->getRise(), &riseX, &riseY);
p = s->getCString();
len = s->getLength();
+ // std::cout << "PDFParser::doShowText: p: " << (p?p:"null") << " " << len << std::endl;
while (len > 0) {
n = font->getNextChar(p, len, &code,
&u, &uLen, /* TODO: This looks like a memory leak for u. */
@@ -2713,6 +2742,12 @@ void PdfParser::doShowText(GooString *s) {
originX *= state->getFontSize();
originY *= state->getFontSize();
state->textTransformDelta(originX, originY, &tOriginX, &tOriginY);
+ // std::cout << " dx: " << dx << " dy: " << dy
+ // << " originX: " << originX << " originY: " << originY
+ // << " tOriginX: " << tOriginX << " tOriginY: " << tOriginY
+ // << " riseX: " << riseX << " riseY: " << riseY
+ // << " curX: " << state->getCurX() + riseX
+ // << " curY: " << state->getCurY() + riseY << std::endl;
builder->addChar(state, state->getCurX() + riseX, state->getCurY() + riseY,
dx, dy, tOriginX, tOriginY, code, n, u, uLen);
state->shift(tdx, tdy);