[poppler] Branch 'poppler-0.16' - poppler/PSOutputDev.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Jan 30 09:02:33 PST 2011
poppler/PSOutputDev.cc | 200 ++++++++++++++++++++++++-------------------------
1 file changed, 100 insertions(+), 100 deletions(-)
New commits:
commit 87d47e5cd7306d96f4e99e458f3947933e274140
Author: William Bader <williambader at hotmail.com>
Date: Sun Jan 30 17:02:02 2011 +0000
Increase precision
Fixes some issues with pdf from bug 27482
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 8bc6eea..4376722 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1350,7 +1350,7 @@ void PSOutputDev::writeHeader(int firstPage, int lastPage,
(int)floor(x1), (int)floor(y1), (int)ceil(x2), (int)ceil(y2));
if (floor(x1) != ceil(x1) || floor(y1) != ceil(y1) ||
floor(x2) != ceil(x2) || floor(y2) != ceil(y2)) {
- writePSFmt("%%HiResBoundingBox: {0:.4g} {1:.4g} {2:.4g} {3:.4g}\n",
+ writePSFmt("%%HiResBoundingBox: {0:.6g} {1:.6g} {2:.6g} {3:.6g}\n",
x1, y1, x2, y2);
}
writePS("%%DocumentSuppliedResources: (atend)\n");
@@ -1875,7 +1875,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
font->getWMode());
}
} else {
- writePSFmt("/F{0:d}_{1:d} /{2:t} {3:.4g} {4:.4g}\n",
+ writePSFmt("/F{0:d}_{1:d} /{2:t} {3:.6g} {4:.6g}\n",
font->getID()->num, font->getID()->gen, psName, xs, ys);
for (i = 0; i < 256; i += 8) {
writePS((char *)((i == 0) ? "[ " : " "));
@@ -2573,10 +2573,10 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName,
writePS("8 dict begin\n");
writePS("/FontType 3 def\n");
m = font->getFontMatrix();
- writePSFmt("/FontMatrix [{0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g}] def\n",
+ writePSFmt("/FontMatrix [{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] def\n",
m[0], m[1], m[2], m[3], m[4], m[5]);
m = font->getFontBBox();
- writePSFmt("/FontBBox [{0:.4g} {1:.4g} {2:.4g} {3:.4g}] def\n",
+ writePSFmt("/FontBBox [{0:.6g} {1:.6g} {2:.6g} {3:.6g}] def\n",
m[0], m[1], m[2], m[3]);
writePS("/Encoding 256 array def\n");
writePS(" 0 1 255 { Encoding exch /.notdef put } for\n");
@@ -2608,10 +2608,10 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName,
charProc.free();
if (t3String) {
if (t3Cacheable) {
- buf = GooString::format("{0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g} setcachedevice\n",
+ buf = GooString::format("{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g} setcachedevice\n",
t3WX, t3WY, t3LLX, t3LLY, t3URX, t3URY);
} else {
- buf = GooString::format("{0:.4g} {1:.4g} setcharwidth\n", t3WX, t3WY);
+ buf = GooString::format("{0:.6g} {1:.6g} setcharwidth\n", t3WX, t3WY);
}
(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
delete buf;
@@ -2931,7 +2931,7 @@ void PSOutputDev::setupForm(Ref id, Object *strObj) {
writePSFmt("/f_{0:d}_{1:d} {{\n", id.num, id.gen);
writePS("q\n");
- writePSFmt("[{0:.4gs} {1:.4gs} {2:.4gs} {3:.4gs} {4:.4gs} {5:.4gs}] cm\n",
+ writePSFmt("[{0:.6gs} {1:.6gs} {2:.6gs} {3:.6gs} {4:.6gs} {5:.6gs}] cm\n",
m[0], m[1], m[2], m[3], m[4], m[5]);
box.x1 = bbox[0];
@@ -3067,7 +3067,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
w = bitmap->getWidth();
h = bitmap->getHeight();
writePS("gsave\n");
- writePSFmt("[{0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g}] concat\n",
+ writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] concat\n",
m0, m1, m2, m3, m4, m5);
switch (level) {
case psLevel1:
@@ -3365,13 +3365,13 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) {
tx += rotate == 0 ? imgLLX : imgLLY;
ty += rotate == 0 ? imgLLY : -imgLLX;
if (tx != 0 || ty != 0) {
- writePSFmt("{0:.4g} {1:.4g} translate\n", tx, ty);
+ writePSFmt("{0:.6g} {1:.6g} translate\n", tx, ty);
}
if (xScale != 1 || yScale != 1) {
- writePSFmt("{0:.4f} {1:.4f} scale\n", xScale, yScale);
+ writePSFmt("{0:.6f} {1:.6f} scale\n", xScale, yScale);
}
if (clipLLX0 < clipURX0 && clipLLY0 < clipURY0) {
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re W\n",
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} re W\n",
clipLLX0, clipLLY0, clipURX0 - clipLLX0, clipURY0 - clipLLY0);
} else {
writePSFmt("{0:d} {1:d} {2:d} {3:d} re W\n", x1, y1, x2 - x1, y2 - y1);
@@ -3400,7 +3400,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) {
ty = -epsY1;
}
if (tx != 0 || ty != 0) {
- writePSFmt("{0:.4g} {1:.4g} translate\n", tx, ty);
+ writePSFmt("{0:.6g} {1:.6g} translate\n", tx, ty);
}
xScale = yScale = 1;
break;
@@ -3449,7 +3449,7 @@ void PSOutputDev::restoreState(GfxState *state) {
void PSOutputDev::updateCTM(GfxState *state, double m11, double m12,
double m21, double m22, double m31, double m32) {
- writePSFmt("[{0:.4gs} {1:.4gs} {2:.4gs} {3:.4gs} {4:.4gs} {5:.4gs}] cm\n",
+ writePSFmt("[{0:.6gs} {1:.6gs} {2:.6gs} {3:.6gs} {4:.6gs} {5:.6gs}] cm\n",
m11, m12, m21, m22, m31, m32);
}
@@ -3461,11 +3461,11 @@ void PSOutputDev::updateLineDash(GfxState *state) {
state->getLineDash(&dash, &length, &start);
writePS("[");
for (i = 0; i < length; ++i) {
- writePSFmt("{0:.4g}{1:w}",
+ writePSFmt("{0:.6g}{1:w}",
dash[i] < 0 ? 0 : dash[i],
(i == length-1) ? 0 : 1);
}
- writePSFmt("] {0:.4g} d\n", start);
+ writePSFmt("] {0:.6g} d\n", start);
}
void PSOutputDev::updateFlatness(GfxState *state) {
@@ -3481,11 +3481,11 @@ void PSOutputDev::updateLineCap(GfxState *state) {
}
void PSOutputDev::updateMiterLimit(GfxState *state) {
- writePSFmt("{0:.4g} M\n", state->getMiterLimit());
+ writePSFmt("{0:.6g} M\n", state->getMiterLimit());
}
void PSOutputDev::updateLineWidth(GfxState *state) {
- writePSFmt("{0:.4g} w\n", state->getLineWidth());
+ writePSFmt("{0:.6g} w\n", state->getLineWidth());
}
void PSOutputDev::updateFillColorSpace(GfxState *state) {
@@ -3721,7 +3721,7 @@ void PSOutputDev::updateTransfer(GfxState *state) {
void PSOutputDev::updateFont(GfxState *state) {
if (state->getFont()) {
- writePSFmt("/F{0:d}_{1:d} {2:.4g} Tf\n",
+ writePSFmt("/F{0:d}_{1:d} {2:.6g} Tf\n",
state->getFont()->getID()->num, state->getFont()->getID()->gen,
fabs(state->getFontSize()) < 0.00001 ? 0.00001
: state->getFontSize());
@@ -3734,15 +3734,15 @@ void PSOutputDev::updateTextMat(GfxState *state) {
mat = state->getTextMat();
if (fabs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.00001) {
// avoid a singular (or close-to-singular) matrix
- writePSFmt("[0.00001 0 0 0.00001 {0:.4g} {1:.4g}] Tm\n", mat[4], mat[5]);
+ writePSFmt("[0.00001 0 0 0.00001 {0:.6g} {1:.6g}] Tm\n", mat[4], mat[5]);
} else {
- writePSFmt("[{0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g}] Tm\n",
+ writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] Tm\n",
mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
}
}
void PSOutputDev::updateCharSpace(GfxState *state) {
- writePSFmt("{0:.4g} Tc\n", state->getCharSpace());
+ writePSFmt("{0:.6g} Tc\n", state->getCharSpace());
}
void PSOutputDev::updateRender(GfxState *state) {
@@ -3757,11 +3757,11 @@ void PSOutputDev::updateRender(GfxState *state) {
}
void PSOutputDev::updateRise(GfxState *state) {
- writePSFmt("{0:.4g} Ts\n", state->getRise());
+ writePSFmt("{0:.6g} Ts\n", state->getRise());
}
void PSOutputDev::updateWordSpace(GfxState *state) {
- writePSFmt("{0:.4g} Tw\n", state->getWordSpace());
+ writePSFmt("{0:.6g} Tw\n", state->getWordSpace());
}
void PSOutputDev::updateHorizScaling(GfxState *state) {
@@ -3771,18 +3771,18 @@ void PSOutputDev::updateHorizScaling(GfxState *state) {
if (fabs(h) < 0.01) {
h = 0.01;
}
- writePSFmt("{0:.4g} Tz\n", h);
+ writePSFmt("{0:.6g} Tz\n", h);
}
void PSOutputDev::updateTextPos(GfxState *state) {
- writePSFmt("{0:.4g} {1:.4g} Td\n", state->getLineX(), state->getLineY());
+ writePSFmt("{0:.6g} {1:.6g} Td\n", state->getLineX(), state->getLineY());
}
void PSOutputDev::updateTextShift(GfxState *state, double shift) {
if (state->getFont()->getWMode()) {
- writePSFmt("{0:.4g} TJmV\n", shift);
+ writePSFmt("{0:.6g} TJmV\n", shift);
} else {
- writePSFmt("{0:.4g} TJm\n", shift);
+ writePSFmt("{0:.6g} TJm\n", shift);
}
}
@@ -3819,7 +3819,7 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Object *str,
writePS("8 dict begin\n");
writePS("/FontType 3 def\n");
writePS("/FontMatrix [1 0 0 1 0 0] def\n");
- writePSFmt("/FontBBox [{0:.4g} {1:.4g} {2:.4g} {3:.4g}] def\n",
+ writePSFmt("/FontBBox [{0:.6g} {1:.6g} {2:.6g} {3:.6g}] def\n",
bbox[0], bbox[1], bbox[2], bbox[3]);
writePS("/Encoding 256 array def\n");
writePS(" 0 1 255 { Encoding exch /.notdef put } for\n");
@@ -3842,14 +3842,14 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Object *str,
gfx = new Gfx(xref, this, resDict, m_catalog, &box, NULL);
writePS("/x {\n");
if (paintType == 2) {
- writePSFmt("{0:.4g} 0 {1:.4g} {2:.4g} {3:.4g} {4:.4g} setcachedevice\n",
+ writePSFmt("{0:.6g} 0 {1:.6g} {2:.6g} {3:.6g} {4:.6g} setcachedevice\n",
xStep, bbox[0], bbox[1], bbox[2], bbox[3]);
} else
{
if (x1 - 1 <= x0) {
writePS("1 0 setcharwidth\n");
} else {
- writePSFmt("{0:.4g} 0 setcharwidth\n", xStep);
+ writePSFmt("{0:.6g} 0 setcharwidth\n", xStep);
}
}
inType3Char = gTrue;
@@ -3865,9 +3865,9 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Object *str,
// draw the tiles
writePSFmt("/xpdfTile{0:d} findfont setfont\n", numTilingPatterns);
- writePSFmt("gsave [{0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g}] concat\n",
+ writePSFmt("gsave [{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] concat\n",
mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
- writePSFmt("{0:d} 1 {1:d} {{ {2:.4g} exch {3:.4g} mul m {4:d} 1 {5:d} {{ pop (x) show }} for }} for\n",
+ writePSFmt("{0:d} 1 {1:d} {{ {2:.6g} exch {3:.6g} mul m {4:d} 1 {5:d} {{ pop (x) show }} for }} for\n",
y0, y1 - 1, x0 * xStep, yStep, x0, x1 - 1);
writePS("grestore\n");
@@ -3889,7 +3889,7 @@ GBool PSOutputDev::functionShadedFill(GfxState *state,
shading->getDomain(&x0, &y0, &x1, &y1);
mat = shading->getMatrix();
- writePSFmt("/mat [{0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g}] def\n",
+ writePSFmt("/mat [{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] def\n",
mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
writePSFmt("/n {0:d} def\n", shading->getColorSpace()->getNComps());
if (shading->getNFuncs() == 1) {
@@ -3910,7 +3910,7 @@ GBool PSOutputDev::functionShadedFill(GfxState *state,
}
writePS("} def\n");
}
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} 0 funcSH\n", x0, y0, x1, y1);
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} 0 funcSH\n", x0, y0, x1, y1);
return gTrue;
}
@@ -3972,19 +3972,19 @@ GBool PSOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, do
t1 = shading->getDomain1();
// generate the PS code
- writePSFmt("/t0 {0:.4g} def\n", t0);
- writePSFmt("/t1 {0:.4g} def\n", t1);
- writePSFmt("/dt {0:.4g} def\n", t1 - t0);
- writePSFmt("/x0 {0:.4g} def\n", x0);
- writePSFmt("/y0 {0:.4g} def\n", y0);
- writePSFmt("/dx {0:.4g} def\n", x1 - x0);
- writePSFmt("/x1 {0:.4g} def\n", x1);
- writePSFmt("/y1 {0:.4g} def\n", y1);
- writePSFmt("/dy {0:.4g} def\n", y1 - y0);
- writePSFmt("/xMin {0:.4g} def\n", xMin);
- writePSFmt("/yMin {0:.4g} def\n", yMin);
- writePSFmt("/xMax {0:.4g} def\n", xMax);
- writePSFmt("/yMax {0:.4g} def\n", yMax);
+ writePSFmt("/t0 {0:.6g} def\n", t0);
+ writePSFmt("/t1 {0:.6g} def\n", t1);
+ writePSFmt("/dt {0:.6g} def\n", t1 - t0);
+ writePSFmt("/x0 {0:.6g} def\n", x0);
+ writePSFmt("/y0 {0:.6g} def\n", y0);
+ writePSFmt("/dx {0:.6g} def\n", x1 - x0);
+ writePSFmt("/x1 {0:.6g} def\n", x1);
+ writePSFmt("/y1 {0:.6g} def\n", y1);
+ writePSFmt("/dy {0:.6g} def\n", y1 - y0);
+ writePSFmt("/xMin {0:.6g} def\n", xMin);
+ writePSFmt("/yMin {0:.6g} def\n", yMin);
+ writePSFmt("/xMax {0:.6g} def\n", xMax);
+ writePSFmt("/yMax {0:.6g} def\n", yMax);
writePSFmt("/n {0:d} def\n", shading->getColorSpace()->getNComps());
if (shading->getNFuncs() == 1) {
writePS("/func ");
@@ -4004,7 +4004,7 @@ GBool PSOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, do
}
writePS("} def\n");
}
- writePSFmt("{0:.4g} {1:.4g} 0 axialSH\n", tMin, tMax);
+ writePSFmt("{0:.6g} {1:.6g} 0 axialSH\n", tMin, tMax);
return gTrue;
}
@@ -4122,22 +4122,22 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading,
}
// generate the PS code
- writePSFmt("/x0 {0:.4g} def\n", x0);
- writePSFmt("/x1 {0:.4g} def\n", x1);
- writePSFmt("/dx {0:.4g} def\n", x1 - x0);
- writePSFmt("/y0 {0:.4g} def\n", y0);
- writePSFmt("/y1 {0:.4g} def\n", y1);
- writePSFmt("/dy {0:.4g} def\n", y1 - y0);
- writePSFmt("/r0 {0:.4g} def\n", r0);
- writePSFmt("/r1 {0:.4g} def\n", r1);
- writePSFmt("/dr {0:.4g} def\n", r1 - r0);
- writePSFmt("/t0 {0:.4g} def\n", t0);
- writePSFmt("/t1 {0:.4g} def\n", t1);
- writePSFmt("/dt {0:.4g} def\n", t1 - t0);
+ writePSFmt("/x0 {0:.6g} def\n", x0);
+ writePSFmt("/x1 {0:.6g} def\n", x1);
+ writePSFmt("/dx {0:.6g} def\n", x1 - x0);
+ writePSFmt("/y0 {0:.6g} def\n", y0);
+ writePSFmt("/y1 {0:.6g} def\n", y1);
+ writePSFmt("/dy {0:.6g} def\n", y1 - y0);
+ writePSFmt("/r0 {0:.6g} def\n", r0);
+ writePSFmt("/r1 {0:.6g} def\n", r1);
+ writePSFmt("/dr {0:.6g} def\n", r1 - r0);
+ writePSFmt("/t0 {0:.6g} def\n", t0);
+ writePSFmt("/t1 {0:.6g} def\n", t1);
+ writePSFmt("/dt {0:.6g} def\n", t1 - t0);
writePSFmt("/n {0:d} def\n", shading->getColorSpace()->getNComps());
writePSFmt("/encl {0:s} def\n", enclosed ? "true" : "false");
- writePSFmt("/a1 {0:.4g} def\n", a1);
- writePSFmt("/a2 {0:.4g} def\n", a2);
+ writePSFmt("/a1 {0:.6g} def\n", a1);
+ writePSFmt("/a2 {0:.6g} def\n", a2);
if (shading->getNFuncs() == 1) {
writePS("/func ");
cvtFunction(shading->getFunc(0));
@@ -4156,7 +4156,7 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading,
}
writePS("} def\n");
}
- writePSFmt("{0:.4g} {1:.4g} 0 radialSH\n", sMin, sMax);
+ writePSFmt("{0:.6g} {1:.6g} 0 radialSH\n", sMin, sMax);
// extend the 'enclosed' case
if (enclosed) {
@@ -4175,11 +4175,11 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading,
ya = y1;
}
if (level == psLevel2Sep || level == psLevel3Sep) {
- writePSFmt("{0:.4g} radialCol aload pop k\n", ta);
+ writePSFmt("{0:.6g} radialCol aload pop k\n", ta);
} else {
- writePSFmt("{0:.4g} radialCol sc\n", ta);
+ writePSFmt("{0:.6g} radialCol sc\n", ta);
}
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} 0 360 arc h f*\n", xa, ya, ra);
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} 0 360 arc h f*\n", xa, ya, ra);
}
// extend the larger circle
@@ -4197,12 +4197,12 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading,
ya = y1;
}
if (level == psLevel2Sep || level == psLevel3Sep) {
- writePSFmt("{0:.4g} radialCol aload pop k\n", ta);
+ writePSFmt("{0:.6g} radialCol aload pop k\n", ta);
} else {
- writePSFmt("{0:.4g} radialCol sc\n", ta);
+ writePSFmt("{0:.6g} radialCol sc\n", ta);
}
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} 0 360 arc h\n", xa, ya, ra);
- writePSFmt("{0:.4g} {1:.4g} m {2:.4g} {3:.4g} l {4:.4g} {5:.4g} l {6:.4g} {7:.4g} l h f*\n",
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} 0 360 arc h\n", xa, ya, ra);
+ writePSFmt("{0:.6g} {1:.6g} m {2:.6g} {3:.6g} l {4:.6g} {5:.6g} l {6:.6g} {7:.6g} l h f*\n",
xMin, yMin, xMin, yMax, xMax, yMax, xMax, yMin);
}
}
@@ -4246,12 +4246,12 @@ void PSOutputDev::doPath(GfxPath *path) {
x3 = subpath->getX(3);
y3 = subpath->getY(3);
if (x0 == x1 && x2 == x3 && y0 == y3 && y1 == y2) {
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re\n",
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} re\n",
x0 < x2 ? x0 : x2, y0 < y1 ? y0 : y1,
fabs(x2 - x0), fabs(y1 - y0));
return;
} else if (x0 == x3 && x1 == x2 && y0 == y1 && y2 == y3) {
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re\n",
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} re\n",
x0 < x1 ? x0 : x1, y0 < y2 ? y0 : y2,
fabs(x1 - x0), fabs(y2 - y0));
return;
@@ -4262,17 +4262,17 @@ void PSOutputDev::doPath(GfxPath *path) {
for (i = 0; i < n; ++i) {
subpath = path->getSubpath(i);
m = subpath->getNumPoints();
- writePSFmt("{0:.4g} {1:.4g} m\n", subpath->getX(0), subpath->getY(0));
+ writePSFmt("{0:.6g} {1:.6g} m\n", subpath->getX(0), subpath->getY(0));
j = 1;
while (j < m) {
if (subpath->getCurve(j)) {
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g} c\n",
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g} c\n",
subpath->getX(j), subpath->getY(j),
subpath->getX(j+1), subpath->getY(j+1),
subpath->getX(j+2), subpath->getY(j+2));
j += 3;
} else {
- writePSFmt("{0:.4g} {1:.4g} l\n", subpath->getX(j), subpath->getY(j));
+ writePSFmt("{0:.6g} {1:.6g} l\n", subpath->getX(j), subpath->getY(j));
++j;
}
}
@@ -4387,12 +4387,12 @@ void PSOutputDev::drawString(GfxState *state, GooString *s) {
writePSString(s2);
if (font->isCIDFont()) {
if (wMode) {
- writePSFmt(" {0:d} {1:.4g} Tj16V\n", nChars, dy);
+ writePSFmt(" {0:d} {1:.6g} Tj16V\n", nChars, dy);
} else {
- writePSFmt(" {0:d} {1:.4g} Tj16\n", nChars, dx);
+ writePSFmt(" {0:d} {1:.6g} Tj16\n", nChars, dx);
}
} else {
- writePSFmt(" {0:.4g} Tj\n", dx);
+ writePSFmt(" {0:.6g} Tj\n", dx);
}
}
delete s2;
@@ -4418,7 +4418,7 @@ void PSOutputDev::endTextObject(GfxState *state) {
if (state->getFillColorSpace()->getMode() != csPattern) {
double cxMin, cyMin, cxMax, cyMax;
state->getClipBBox(&cxMin, &cyMin, &cxMax, &cyMax);
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re\n",
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} re\n",
cxMin, cyMin,
cxMax, cyMax);
writePS("f*\n");
@@ -4866,7 +4866,7 @@ void PSOutputDev::maskToClippingPath(Stream *maskStr, int maskWidth, int maskHei
// make each rectangle path and clip.
writePS("gsave newpath\n");
for (i = 0; i < rectsOutLen; ++i) {
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re\n",
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} re\n",
((double)rectsOut[i].x0)/maskWidth,
((double)rectsOut[i].y0)/maskHeight,
((double)(rectsOut[i].x1 - rectsOut[i].x0))/maskWidth,
@@ -5048,7 +5048,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
// make each rectangle path and clip.
writePS("gsave newpath\n");
for (i = 0; i < rectsOutLen; ++i) {
- writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re\n",
+ writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} re\n",
((double)rectsOut[i].x0)/width,
((double)rectsOut[i].y0)/height,
((double)(rectsOut[i].x1 - rectsOut[i].x0))/width,
@@ -5989,7 +5989,7 @@ void PSOutputDev::opiBegin20(GfxState *state, Dict *dict) {
obj1.arrayGet(1, &obj2);
height = obj2.getNum();
obj2.free();
- writePSFmt("%%ImageDimensions: {0:.4g} {1:.4g}\n", width, height);
+ writePSFmt("%%ImageDimensions: {0:.6g} {1:.6g}\n", width, height);
}
obj1.free();
@@ -6007,7 +6007,7 @@ void PSOutputDev::opiBegin20(GfxState *state, Dict *dict) {
obj1.arrayGet(3, &obj2);
bottom = obj2.getNum();
obj2.free();
- writePSFmt("%%ImageCropRect: {0:.4g} {1:.4g} {2:.4g} {3:.4g}\n",
+ writePSFmt("%%ImageCropRect: {0:.6g} {1:.6g} {2:.6g} {3:.6g}\n",
left, top, right, bottom);
}
obj1.free();
@@ -6032,7 +6032,7 @@ void PSOutputDev::opiBegin20(GfxState *state, Dict *dict) {
if (obj3.isString() && obj4.isNum()) {
writePS(" ");
writePSString(obj3.getString());
- writePSFmt(" {0:.4g}", obj4.getNum());
+ writePSFmt(" {0:.6g}", obj4.getNum());
}
obj3.free();
obj4.free();
@@ -6061,7 +6061,7 @@ void PSOutputDev::opiBegin20(GfxState *state, Dict *dict) {
dict->lookup("IncludedImageQuality", &obj1);
if (obj1.isNum()) {
- writePSFmt("%%IncludedImageQuality: {0:.4g}\n", obj1.getNum());
+ writePSFmt("%%IncludedImageQuality: {0:.6g}\n", obj1.getNum());
}
obj1.free();
@@ -6155,7 +6155,7 @@ void PSOutputDev::opiBegin13(GfxState *state, Dict *dict) {
obj1.arrayGet(3, &obj2);
lry = obj2.getNum();
obj2.free();
- writePSFmt("%ALDImageCropFixed: {0:.4g} {1:.4g} {2:.4g} {3:.4g}\n",
+ writePSFmt("%ALDImageCropFixed: {0:.6g} {1:.6g} {2:.6g} {3:.6g}\n",
ulx, uly, lrx, lry);
}
obj1.free();
@@ -6232,7 +6232,7 @@ void PSOutputDev::opiBegin13(GfxState *state, Dict *dict) {
opiTransform(state, ulx, uly, &tulx, &tuly);
opiTransform(state, urx, ury, &turx, &tury);
opiTransform(state, lrx, lry, &tlrx, &tlry);
- writePSFmt("%ALDImagePosition: {0:.4g} {1:.4g} {2:.4g} {3:.4g} {4:.4g} {5:.4g} {6:.4g} {7:.4g}\n",
+ writePSFmt("%ALDImagePosition: {0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g} {6:.6g} {7:.6g}\n",
tllx, tlly, tulx, tuly, turx, tury, tlrx, tlry);
obj2.free();
}
@@ -6246,7 +6246,7 @@ void PSOutputDev::opiBegin13(GfxState *state, Dict *dict) {
obj1.arrayGet(1, &obj2);
vert = obj2.getNum();
obj2.free();
- writePSFmt("%ALDImageResoution: {0:.4g} {1:.4g}\n", horiz, vert);
+ writePSFmt("%ALDImageResoution: {0:.6g} {1:.6g}\n", horiz, vert);
obj2.free();
}
obj1.free();
@@ -6268,7 +6268,7 @@ void PSOutputDev::opiBegin13(GfxState *state, Dict *dict) {
dict->lookup("Tint", &obj1);
if (obj1.isNum()) {
- writePSFmt("%ALDImageTint: {0:.4g}\n", obj1.getNum());
+ writePSFmt("%ALDImageTint: {0:.6g}\n", obj1.getNum());
}
obj1.free();
@@ -6336,7 +6336,7 @@ void PSOutputDev::opiEnd(GfxState *state, Dict *opiDict) {
#endif // OPI_SUPPORT
void PSOutputDev::type3D0(GfxState *state, double wx, double wy) {
- writePSFmt("{0:.4g} {1:.4g} setcharwidth\n", wx, wy);
+ writePSFmt("{0:.6g} {1:.6g} setcharwidth\n", wx, wy);
writePS("q\n");
t3NeedsRestore = gTrue;
}
@@ -6401,14 +6401,14 @@ void PSOutputDev::cvtFunction(Function *func) {
}
writePSFmt("/xpdfSamples{0:d} [\n", thisFunc);
for (i = 0; i < nSamples; ++i) {
- writePSFmt("{0:.4g}\n", func0->getSamples()[i]);
+ writePSFmt("{0:.6g}\n", func0->getSamples()[i]);
}
writePS("] def\n");
writePSFmt("{{ {0:d} array {1:d} array {2:d} 2 roll\n", 2*m, m, m+2);
// [e01] [efrac] x0 x1 ... xm-1
for (i = m-1; i >= 0; --i) {
// [e01] [efrac] x0 x1 ... xi
- writePSFmt("{0:.4g} sub {1:.4g} mul {2:.4g} add\n",
+ writePSFmt("{0:.6g} sub {1:.6g} mul {2:.6g} add\n",
func0->getDomainMin(i),
(func0->getEncodeMax(i) - func0->getEncodeMin(i)) /
(func0->getDomainMax(i) - func0->getDomainMin(i)),
@@ -6458,10 +6458,10 @@ void PSOutputDev::cvtFunction(Function *func) {
// [e01] [efrac] s'(0) s'(1) ... s(2^(m-j-1)-1)
}
// [e01] [efrac] y(0) ... y(i-1) s
- writePSFmt("{0:.4g} mul {1:.4g} add\n",
+ writePSFmt("{0:.6g} mul {1:.6g} add\n",
func0->getDecodeMax(i) - func0->getDecodeMin(i),
func0->getDecodeMin(i));
- writePSFmt("dup {0:.4g} lt {{ pop {1:.4g} }} {{ dup {2:.4g} gt {{ pop {3:.4g} }} if }} ifelse\n",
+ writePSFmt("dup {0:.6g} lt {{ pop {1:.6g} }} {{ dup {2:.6g} gt {{ pop {3:.6g} }} if }} ifelse\n",
func0->getRangeMin(i), func0->getRangeMin(i),
func0->getRangeMax(i), func0->getRangeMax(i));
// [e01] [efrac] y(0) ... y(i-1) y(i)
@@ -6473,17 +6473,17 @@ void PSOutputDev::cvtFunction(Function *func) {
case 2: // exponential
func2 = (ExponentialFunction *)func;
n = func2->getOutputSize();
- writePSFmt("{{ dup {0:.4g} lt {{ pop {1:.4g} }} {{ dup {2:.4g} gt {{ pop {3:.4g} }} if }} ifelse\n",
+ writePSFmt("{{ dup {0:.6g} lt {{ pop {1:.6g} }} {{ dup {2:.6g} gt {{ pop {3:.6g} }} if }} ifelse\n",
func2->getDomainMin(0), func2->getDomainMin(0),
func2->getDomainMax(0), func2->getDomainMax(0));
// x
for (i = 0; i < n; ++i) {
// x y(0) .. y(i-1)
- writePSFmt("{0:d} index {1:.4g} exp {2:.4g} mul {3:.4g} add\n",
+ writePSFmt("{0:d} index {1:.6g} exp {2:.6g} mul {3:.6g} add\n",
i, func2->getE(), func2->getC1()[i] - func2->getC0()[i],
func2->getC0()[i]);
if (func2->getHasRange()) {
- writePSFmt("dup {0:.4g} lt {{ pop {1:.4g} }} {{ dup {2:.4g} gt {{ pop {3:.4g} }} if }} ifelse\n",
+ writePSFmt("dup {0:.6g} lt {{ pop {1:.6g} }} {{ dup {2:.6g} gt {{ pop {3:.6g} }} if }} ifelse\n",
func2->getRangeMin(i), func2->getRangeMin(i),
func2->getRangeMax(i), func2->getRangeMax(i));
}
@@ -6499,18 +6499,18 @@ void PSOutputDev::cvtFunction(Function *func) {
cvtFunction(func3->getFunc(i));
writePSFmt("/xpdfFunc{0:d}_{1:d} exch def\n", thisFunc, i);
}
- writePSFmt("{{ dup {0:.4g} lt {{ pop {1:.4g} }} {{ dup {2:.4g} gt {{ pop {3:.4g} }} if }} ifelse\n",
+ writePSFmt("{{ dup {0:.6g} lt {{ pop {1:.6g} }} {{ dup {2:.6g} gt {{ pop {3:.6g} }} if }} ifelse\n",
func3->getDomainMin(0), func3->getDomainMin(0),
func3->getDomainMax(0), func3->getDomainMax(0));
for (i = 0; i < func3->getNumFuncs() - 1; ++i) {
- writePSFmt("dup {0:.4g} lt {{ {1:.4g} sub {2:.4g} mul {3:.4g} add xpdfFunc{4:d}_{5:d} }} {{\n",
+ writePSFmt("dup {0:.6g} lt {{ {1:.6g} sub {2:.6g} mul {3:.6g} add xpdfFunc{4:d}_{5:d} }} {{\n",
func3->getBounds()[i+1],
func3->getBounds()[i],
func3->getScale()[i],
func3->getEncode()[2*i],
thisFunc, i);
}
- writePSFmt("{0:.4g} sub {1:.4g} mul {2:.4g} add xpdfFunc{3:d}_{4:d}\n",
+ writePSFmt("{0:.6g} sub {1:.6g} mul {2:.6g} add xpdfFunc{3:d}_{4:d}\n",
func3->getBounds()[i],
func3->getScale()[i],
func3->getEncode()[2*i],
More information about the poppler
mailing list