summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-op-buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/pdf/pdf-op-buffer.c')
-rw-r--r--source/pdf/pdf-op-buffer.c274
1 files changed, 137 insertions, 137 deletions
diff --git a/source/pdf/pdf-op-buffer.c b/source/pdf/pdf-op-buffer.c
index 1bfe982a..b916ea3f 100644
--- a/source/pdf/pdf-op-buffer.c
+++ b/source/pdf/pdf-op-buffer.c
@@ -17,7 +17,7 @@ pdf_out_w(fz_context *ctx, pdf_processor *proc, float linewidth)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
if (!((pdf_output_processor*)proc)->extgstate)
- fz_printf(ctx, out, "%f w\n", linewidth);
+ fz_write_printf(ctx, out, "%f w\n", linewidth);
}
static void
@@ -25,7 +25,7 @@ pdf_out_j(fz_context *ctx, pdf_processor *proc, int linejoin)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
if (!((pdf_output_processor*)proc)->extgstate)
- fz_printf(ctx, out, "%d j\n", linejoin);
+ fz_write_printf(ctx, out, "%d j\n", linejoin);
}
static void
@@ -33,7 +33,7 @@ pdf_out_J(fz_context *ctx, pdf_processor *proc, int linecap)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
if (!((pdf_output_processor*)proc)->extgstate)
- fz_printf(ctx, out, "%d J\n", linecap);
+ fz_write_printf(ctx, out, "%d J\n", linecap);
}
static void
@@ -41,7 +41,7 @@ pdf_out_M(fz_context *ctx, pdf_processor *proc, float a)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
if (!((pdf_output_processor*)proc)->extgstate)
- fz_printf(ctx, out, "%f M\n", a);
+ fz_write_printf(ctx, out, "%f M\n", a);
}
static void
@@ -51,7 +51,7 @@ pdf_out_d(fz_context *ctx, pdf_processor *proc, pdf_obj *array, float phase)
if (!((pdf_output_processor*)proc)->extgstate)
{
pdf_print_obj(ctx, out, array, 1);
- fz_printf(ctx, out, " %f d\n", phase);
+ fz_write_printf(ctx, out, " %f d\n", phase);
}
}
@@ -60,7 +60,7 @@ pdf_out_ri(fz_context *ctx, pdf_processor *proc, const char *intent)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
if (!((pdf_output_processor*)proc)->extgstate)
- fz_printf(ctx, out, "/%s ri\n", intent);
+ fz_write_printf(ctx, out, "/%s ri\n", intent);
}
static void
@@ -68,7 +68,7 @@ pdf_out_i(fz_context *ctx, pdf_processor *proc, float flatness)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
if (!((pdf_output_processor*)proc)->extgstate)
- fz_printf(ctx, out, "%f i\n", flatness);
+ fz_write_printf(ctx, out, "%f i\n", flatness);
}
static void
@@ -76,7 +76,7 @@ pdf_out_gs_begin(fz_context *ctx, pdf_processor *proc, const char *name, pdf_obj
{
fz_output *out = ((pdf_output_processor*)proc)->out;
((pdf_output_processor*)proc)->extgstate = 1;
- fz_printf(ctx, out, "/%s gs\n", name);
+ fz_write_printf(ctx, out, "/%s gs\n", name);
}
static void
@@ -91,21 +91,21 @@ static void
pdf_out_q(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "q\n");
+ fz_write_printf(ctx, out, "q\n");
}
static void
pdf_out_Q(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "Q\n");
+ fz_write_printf(ctx, out, "Q\n");
}
static void
pdf_out_cm(fz_context *ctx, pdf_processor *proc, float a, float b, float c, float d, float e, float f)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f %f %f cm\n", a, b, c, d, e, f);
+ fz_write_printf(ctx, out, "%f %f %f %f %f %f cm\n", a, b, c, d, e, f);
}
/* path construction */
@@ -114,49 +114,49 @@ static void
pdf_out_m(fz_context *ctx, pdf_processor *proc, float x, float y)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f m\n", x, y);
+ fz_write_printf(ctx, out, "%f %f m\n", x, y);
}
static void
pdf_out_l(fz_context *ctx, pdf_processor *proc, float x, float y)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f l\n", x, y);
+ fz_write_printf(ctx, out, "%f %f l\n", x, y);
}
static void
pdf_out_c(fz_context *ctx, pdf_processor *proc, float x1, float y1, float x2, float y2, float x3, float y3)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f %f %f c\n", x1, y1, x2, y2, x3, y3);
+ fz_write_printf(ctx, out, "%f %f %f %f %f %f c\n", x1, y1, x2, y2, x3, y3);
}
static void
pdf_out_v(fz_context *ctx, pdf_processor *proc, float x2, float y2, float x3, float y3)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f v\n", x2, y2, x3, y3);
+ fz_write_printf(ctx, out, "%f %f %f %f v\n", x2, y2, x3, y3);
}
static void
pdf_out_y(fz_context *ctx, pdf_processor *proc, float x1, float y1, float x3, float y3)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f y\n", x1, y1, x3, y3);
+ fz_write_printf(ctx, out, "%f %f %f %f y\n", x1, y1, x3, y3);
}
static void
pdf_out_h(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "h\n");
+ fz_write_printf(ctx, out, "h\n");
}
static void
pdf_out_re(fz_context *ctx, pdf_processor *proc, float x, float y, float w, float h)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f re\n", x, y, w, h);
+ fz_write_printf(ctx, out, "%f %f %f %f re\n", x, y, w, h);
}
/* path painting */
@@ -165,70 +165,70 @@ static void
pdf_out_S(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "S\n");
+ fz_write_printf(ctx, out, "S\n");
}
static void
pdf_out_s(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "s\n");
+ fz_write_printf(ctx, out, "s\n");
}
static void
pdf_out_F(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "F\n");
+ fz_write_printf(ctx, out, "F\n");
}
static void
pdf_out_f(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "f\n");
+ fz_write_printf(ctx, out, "f\n");
}
static void
pdf_out_fstar(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "f*\n");
+ fz_write_printf(ctx, out, "f*\n");
}
static void
pdf_out_B(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "B\n");
+ fz_write_printf(ctx, out, "B\n");
}
static void
pdf_out_Bstar(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "B*\n");
+ fz_write_printf(ctx, out, "B*\n");
}
static void
pdf_out_b(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "b\n");
+ fz_write_printf(ctx, out, "b\n");
}
static void
pdf_out_bstar(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "b*\n");
+ fz_write_printf(ctx, out, "b*\n");
}
static void
pdf_out_n(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "n\n");
+ fz_write_printf(ctx, out, "n\n");
}
/* clipping paths */
@@ -237,14 +237,14 @@ static void
pdf_out_W(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "W\n");
+ fz_write_printf(ctx, out, "W\n");
}
static void
pdf_out_Wstar(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "W*\n");
+ fz_write_printf(ctx, out, "W*\n");
}
/* text objects */
@@ -253,14 +253,14 @@ static void
pdf_out_BT(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "BT\n");
+ fz_write_printf(ctx, out, "BT\n");
}
static void
pdf_out_ET(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "ET\n");
+ fz_write_printf(ctx, out, "ET\n");
}
/* text state */
@@ -269,28 +269,28 @@ static void
pdf_out_Tc(fz_context *ctx, pdf_processor *proc, float charspace)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f Tc\n", charspace);
+ fz_write_printf(ctx, out, "%f Tc\n", charspace);
}
static void
pdf_out_Tw(fz_context *ctx, pdf_processor *proc, float wordspace)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f Tw\n", wordspace);
+ fz_write_printf(ctx, out, "%f Tw\n", wordspace);
}
static void
pdf_out_Tz(fz_context *ctx, pdf_processor *proc, float scale)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f Tz\n", scale);
+ fz_write_printf(ctx, out, "%f Tz\n", scale);
}
static void
pdf_out_TL(fz_context *ctx, pdf_processor *proc, float leading)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f TL\n", leading);
+ fz_write_printf(ctx, out, "%f TL\n", leading);
}
static void
@@ -298,21 +298,21 @@ pdf_out_Tf(fz_context *ctx, pdf_processor *proc, const char *name, pdf_font_desc
{
fz_output *out = ((pdf_output_processor*)proc)->out;
if (!((pdf_output_processor*)proc)->extgstate)
- fz_printf(ctx, out, "/%s %f Tf\n", name, size);
+ fz_write_printf(ctx, out, "/%s %f Tf\n", name, size);
}
static void
pdf_out_Tr(fz_context *ctx, pdf_processor *proc, int render)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%d Tr\n", render);
+ fz_write_printf(ctx, out, "%d Tr\n", render);
}
static void
pdf_out_Ts(fz_context *ctx, pdf_processor *proc, float rise)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f Ts\n", rise);
+ fz_write_printf(ctx, out, "%f Ts\n", rise);
}
/* text positioning */
@@ -321,28 +321,28 @@ static void
pdf_out_Td(fz_context *ctx, pdf_processor *proc, float tx, float ty)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f Td\n", tx, ty);
+ fz_write_printf(ctx, out, "%f %f Td\n", tx, ty);
}
static void
pdf_out_TD(fz_context *ctx, pdf_processor *proc, float tx, float ty)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f TD\n", tx, ty);
+ fz_write_printf(ctx, out, "%f %f TD\n", tx, ty);
}
static void
pdf_out_Tm(fz_context *ctx, pdf_processor *proc, float a, float b, float c, float d, float e, float f)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f %f %f Tm\n", a, b, c, d, e, f);
+ fz_write_printf(ctx, out, "%f %f %f %f %f %f Tm\n", a, b, c, d, e, f);
}
static void
pdf_out_Tstar(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "T*\n");
+ fz_write_printf(ctx, out, "T*\n");
}
/* text showing */
@@ -358,22 +358,22 @@ put_string(fz_context *ctx, fz_output *out, const unsigned char *str, int len)
if (i < len)
{
- fz_printf(ctx, out, "<");
+ fz_write_printf(ctx, out, "<");
for (i = 0; i < len; ++i)
- fz_printf(ctx, out, "%02x", str[i]);
- fz_printf(ctx, out, ">");
+ fz_write_printf(ctx, out, "%02x", str[i]);
+ fz_write_printf(ctx, out, ">");
}
else
{
- fz_printf(ctx, out, "(");
+ fz_write_printf(ctx, out, "(");
for (i = 0; i < len; ++i)
{
unsigned char c = str[i];
if (c == '(' || c == ')' || c == '\\')
- fz_putc(ctx, out, '\\');
- fz_putc(ctx, out, c);
+ fz_write_byte(ctx, out, '\\');
+ fz_write_byte(ctx, out, c);
}
- fz_printf(ctx, out, ")");
+ fz_write_printf(ctx, out, ")");
}
}
@@ -382,7 +382,7 @@ pdf_out_TJ(fz_context *ctx, pdf_processor *proc, pdf_obj *array)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
pdf_print_obj(ctx, out, array, 1);
- fz_printf(ctx, out, " TJ\n");
+ fz_write_printf(ctx, out, " TJ\n");
}
static void
@@ -390,7 +390,7 @@ pdf_out_Tj(fz_context *ctx, pdf_processor *proc, char *str, int len)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
put_string(ctx, out, (const unsigned char *)str, len);
- fz_printf(ctx, out, " Tj\n");
+ fz_write_printf(ctx, out, " Tj\n");
}
static void
@@ -398,16 +398,16 @@ pdf_out_squote(fz_context *ctx, pdf_processor *proc, char *str, int len)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
put_string(ctx, out, (const unsigned char *)str, len);
- fz_printf(ctx, out, " '\n");
+ fz_write_printf(ctx, out, " '\n");
}
static void
pdf_out_dquote(fz_context *ctx, pdf_processor *proc, float aw, float ac, char *str, int len)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f ", aw, ac);
+ fz_write_printf(ctx, out, "%f %f ", aw, ac);
put_string(ctx, out, (const unsigned char *)str, len);
- fz_printf(ctx, out, " \"\n");
+ fz_write_printf(ctx, out, " \"\n");
}
/* type 3 fonts */
@@ -416,14 +416,14 @@ static void
pdf_out_d0(fz_context *ctx, pdf_processor *proc, float wx, float wy)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f d0\n", wx, wy);
+ fz_write_printf(ctx, out, "%f %f d0\n", wx, wy);
}
static void
pdf_out_d1(fz_context *ctx, pdf_processor *proc, float wx, float wy, float llx, float lly, float urx, float ury)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f %f %f d1\n", wx, wy, llx, lly, urx, ury);
+ fz_write_printf(ctx, out, "%f %f %f %f %f %f d1\n", wx, wy, llx, lly, urx, ury);
}
/* color */
@@ -432,14 +432,14 @@ static void
pdf_out_CS(fz_context *ctx, pdf_processor *proc, const char *name, fz_colorspace *cs)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s CS\n", name);
+ fz_write_printf(ctx, out, "/%s CS\n", name);
}
static void
pdf_out_cs(fz_context *ctx, pdf_processor *proc, const char *name, fz_colorspace *cs)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s cs\n", name);
+ fz_write_printf(ctx, out, "/%s cs\n", name);
}
static void
@@ -448,8 +448,8 @@ pdf_out_SC_pattern(fz_context *ctx, pdf_processor *proc, const char *name, pdf_p
fz_output *out = ((pdf_output_processor*)proc)->out;
int i;
for (i = 0; i < n; ++i)
- fz_printf(ctx, out, "%f ", color[i]);
- fz_printf(ctx, out, "/%s SCN\n", name);
+ fz_write_printf(ctx, out, "%f ", color[i]);
+ fz_write_printf(ctx, out, "/%s SCN\n", name);
}
static void
@@ -458,22 +458,22 @@ pdf_out_sc_pattern(fz_context *ctx, pdf_processor *proc, const char *name, pdf_p
fz_output *out = ((pdf_output_processor*)proc)->out;
int i;
for (i = 0; i < n; ++i)
- fz_printf(ctx, out, "%f ", color[i]);
- fz_printf(ctx, out, "/%s scn\n", name);
+ fz_write_printf(ctx, out, "%f ", color[i]);
+ fz_write_printf(ctx, out, "/%s scn\n", name);
}
static void
pdf_out_SC_shade(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s SCN\n", name);
+ fz_write_printf(ctx, out, "/%s SCN\n", name);
}
static void
pdf_out_sc_shade(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s scn\n", name);
+ fz_write_printf(ctx, out, "/%s scn\n", name);
}
static void
@@ -482,8 +482,8 @@ pdf_out_SC_color(fz_context *ctx, pdf_processor *proc, int n, float *color)
fz_output *out = ((pdf_output_processor*)proc)->out;
int i;
for (i = 0; i < n; ++i)
- fz_printf(ctx, out, "%f ", color[i]);
- fz_printf(ctx, out, "SCN\n");
+ fz_write_printf(ctx, out, "%f ", color[i]);
+ fz_write_printf(ctx, out, "SCN\n");
}
static void
@@ -492,50 +492,50 @@ pdf_out_sc_color(fz_context *ctx, pdf_processor *proc, int n, float *color)
fz_output *out = ((pdf_output_processor*)proc)->out;
int i;
for (i = 0; i < n; ++i)
- fz_printf(ctx, out, "%f ", color[i]);
- fz_printf(ctx, out, "scn\n");
+ fz_write_printf(ctx, out, "%f ", color[i]);
+ fz_write_printf(ctx, out, "scn\n");
}
static void
pdf_out_G(fz_context *ctx, pdf_processor *proc, float g)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f G\n", g);
+ fz_write_printf(ctx, out, "%f G\n", g);
}
static void
pdf_out_g(fz_context *ctx, pdf_processor *proc, float g)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f g\n", g);
+ fz_write_printf(ctx, out, "%f g\n", g);
}
static void
pdf_out_RG(fz_context *ctx, pdf_processor *proc, float r, float g, float b)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f RG\n", r, g, b);
+ fz_write_printf(ctx, out, "%f %f %f RG\n", r, g, b);
}
static void
pdf_out_rg(fz_context *ctx, pdf_processor *proc, float r, float g, float b)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f rg\n", r, g, b);
+ fz_write_printf(ctx, out, "%f %f %f rg\n", r, g, b);
}
static void
pdf_out_K(fz_context *ctx, pdf_processor *proc, float c, float m, float y, float k)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f K\n", c, m, y, k);
+ fz_write_printf(ctx, out, "%f %f %f %f K\n", c, m, y, k);
}
static void
pdf_out_k(fz_context *ctx, pdf_processor *proc, float c, float m, float y, float k)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "%f %f %f %f k\n", c, m, y, k);
+ fz_write_printf(ctx, out, "%f %f %f %f k\n", c, m, y, k);
}
/* shadings, images, xobjects */
@@ -560,30 +560,30 @@ pdf_out_BI(fz_context *ctx, pdf_processor *proc, fz_image *img)
if (buf == NULL)
return;
- fz_printf(ctx, out, "BI\n");
- fz_printf(ctx, out, "/W %d\n", img->w);
- fz_printf(ctx, out, "/H %d\n", img->h);
- fz_printf(ctx, out, "/BPC %d\n", img->bpc);
+ fz_write_printf(ctx, out, "BI\n");
+ fz_write_printf(ctx, out, "/W %d\n", img->w);
+ fz_write_printf(ctx, out, "/H %d\n", img->h);
+ fz_write_printf(ctx, out, "/BPC %d\n", img->bpc);
if (img->imagemask)
- fz_printf(ctx, out, "/IM true\n");
+ fz_write_printf(ctx, out, "/IM true\n");
else if (img->colorspace == fz_device_gray(ctx))
- fz_printf(ctx, out, "/CS/G\n");
+ fz_write_printf(ctx, out, "/CS/G\n");
else if (img->colorspace == fz_device_rgb(ctx))
- fz_printf(ctx, out, "/CS/RGB\n");
+ fz_write_printf(ctx, out, "/CS/RGB\n");
else if (img->colorspace == fz_device_cmyk(ctx))
- fz_printf(ctx, out, "/CS/CMYK\n");
+ fz_write_printf(ctx, out, "/CS/CMYK\n");
else if (fz_colorspace_is_indexed(ctx, img->colorspace))
- fz_printf(ctx, out, "/CS/I\n");
+ fz_write_printf(ctx, out, "/CS/I\n");
if (img->interpolate)
- fz_printf(ctx, out, "/I true\n");
- fz_printf(ctx, out, "/D[");
+ fz_write_printf(ctx, out, "/I true\n");
+ fz_write_printf(ctx, out, "/D[");
for (i = 0; i < img->n * 2; ++i)
{
if (i > 0)
- fz_putc(ctx, out, ' ');
- fz_printf(ctx, out, "%g", img->decode[i]);
+ fz_write_byte(ctx, out, ' ');
+ fz_write_printf(ctx, out, "%g", img->decode[i]);
}
- fz_printf(ctx, out, "]\n");
+ fz_write_printf(ctx, out, "]\n");
switch (cbuf->params.type)
{
@@ -592,78 +592,78 @@ pdf_out_BI(fz_context *ctx, pdf_processor *proc, fz_image *img)
break;
case FZ_IMAGE_JPEG:
- fz_printf(ctx, out, ahx ? "/F[/AHx/DCT]\n" : "/F/DCT\n");
+ fz_write_printf(ctx, out, ahx ? "/F[/AHx/DCT]\n" : "/F/DCT\n");
if (cbuf->params.u.jpeg.color_transform != -1)
- fz_printf(ctx, out, "/DP<</ColorTransform %d>>\n",
+ fz_write_printf(ctx, out, "/DP<</ColorTransform %d>>\n",
cbuf->params.u.jpeg.color_transform);
break;
case FZ_IMAGE_FAX:
- fz_printf(ctx, out, ahx ? "/F[/AHx/CCF]\n/DP[null<<\n" : "/F/CCF\n/DP<<\n");
- fz_printf(ctx, out, "/K %d\n", cbuf->params.u.fax.k);
+ fz_write_printf(ctx, out, ahx ? "/F[/AHx/CCF]\n/DP[null<<\n" : "/F/CCF\n/DP<<\n");
+ fz_write_printf(ctx, out, "/K %d\n", cbuf->params.u.fax.k);
if (cbuf->params.u.fax.columns != 1728)
- fz_printf(ctx, out, "/Columns %d\n", cbuf->params.u.fax.columns);
+ fz_write_printf(ctx, out, "/Columns %d\n", cbuf->params.u.fax.columns);
if (cbuf->params.u.fax.rows > 0)
- fz_printf(ctx, out, "/Rows %d\n", cbuf->params.u.fax.rows);
+ fz_write_printf(ctx, out, "/Rows %d\n", cbuf->params.u.fax.rows);
if (cbuf->params.u.fax.end_of_line)
- fz_printf(ctx, out, "/EndOfLine true\n");
+ fz_write_printf(ctx, out, "/EndOfLine true\n");
if (cbuf->params.u.fax.encoded_byte_align)
- fz_printf(ctx, out, "/EncodedByteAlign true\n");
+ fz_write_printf(ctx, out, "/EncodedByteAlign true\n");
if (!cbuf->params.u.fax.end_of_block)
- fz_printf(ctx, out, "/EndOfBlock false\n");
+ fz_write_printf(ctx, out, "/EndOfBlock false\n");
if (cbuf->params.u.fax.black_is_1)
- fz_printf(ctx, out, "/BlackIs1 true\n");
+ fz_write_printf(ctx, out, "/BlackIs1 true\n");
if (cbuf->params.u.fax.damaged_rows_before_error > 0)
- fz_printf(ctx, out, "/DamagedRowsBeforeError %d\n",
+ fz_write_printf(ctx, out, "/DamagedRowsBeforeError %d\n",
cbuf->params.u.fax.damaged_rows_before_error);
- fz_printf(ctx, out, ahx ? ">>]\n" : ">>\n");
+ fz_write_printf(ctx, out, ahx ? ">>]\n" : ">>\n");
break;
case FZ_IMAGE_RAW:
if (ahx)
- fz_printf(ctx, out, "/F/AHx\n");
+ fz_write_printf(ctx, out, "/F/AHx\n");
break;
case FZ_IMAGE_RLD:
- fz_printf(ctx, out, ahx ? "/F[/AHx/RL]\n" : "/F/RL\n");
+ fz_write_printf(ctx, out, ahx ? "/F[/AHx/RL]\n" : "/F/RL\n");
break;
case FZ_IMAGE_FLATE:
- fz_printf(ctx, out, ahx ? "/F[/AHx/Fl]\n" : "/F/Fl\n");
+ fz_write_printf(ctx, out, ahx ? "/F[/AHx/Fl]\n" : "/F/Fl\n");
if (cbuf->params.u.flate.predictor > 1)
{
- fz_printf(ctx, out, ahx ? "/DP[null<<\n" : "/DP<<\n");
- fz_printf(ctx, out, "/Predictor %d\n", cbuf->params.u.flate.predictor);
+ fz_write_printf(ctx, out, ahx ? "/DP[null<<\n" : "/DP<<\n");
+ fz_write_printf(ctx, out, "/Predictor %d\n", cbuf->params.u.flate.predictor);
if (cbuf->params.u.flate.columns != 1)
- fz_printf(ctx, out, "/Columns %d\n", cbuf->params.u.flate.columns);
+ fz_write_printf(ctx, out, "/Columns %d\n", cbuf->params.u.flate.columns);
if (cbuf->params.u.flate.colors != 1)
- fz_printf(ctx, out, "/Colors %d\n", cbuf->params.u.flate.colors);
+ fz_write_printf(ctx, out, "/Colors %d\n", cbuf->params.u.flate.colors);
if (cbuf->params.u.flate.bpc != 8)
- fz_printf(ctx, out, "/BitsPerComponent %d\n", cbuf->params.u.flate.bpc);
- fz_printf(ctx, out, ahx ? ">>]\n" : ">>\n");
+ fz_write_printf(ctx, out, "/BitsPerComponent %d\n", cbuf->params.u.flate.bpc);
+ fz_write_printf(ctx, out, ahx ? ">>]\n" : ">>\n");
}
break;
case FZ_IMAGE_LZW:
- fz_printf(ctx, out, ahx ? "/F[/AHx/LZW]\n" : "/F/LZW\n");
+ fz_write_printf(ctx, out, ahx ? "/F[/AHx/LZW]\n" : "/F/LZW\n");
if (cbuf->params.u.lzw.predictor > 1)
{
- fz_printf(ctx, out, ahx ? "/DP[<<null\n" : "/DP<<\n");
- fz_printf(ctx, out, "/Predictor %d\n", cbuf->params.u.lzw.predictor);
+ fz_write_printf(ctx, out, ahx ? "/DP[<<null\n" : "/DP<<\n");
+ fz_write_printf(ctx, out, "/Predictor %d\n", cbuf->params.u.lzw.predictor);
if (cbuf->params.u.lzw.columns != 1)
- fz_printf(ctx, out, "/Columns %d\n", cbuf->params.u.lzw.columns);
+ fz_write_printf(ctx, out, "/Columns %d\n", cbuf->params.u.lzw.columns);
if (cbuf->params.u.lzw.colors != 1)
- fz_printf(ctx, out, "/Colors %d\n", cbuf->params.u.lzw.colors);
+ fz_write_printf(ctx, out, "/Colors %d\n", cbuf->params.u.lzw.colors);
if (cbuf->params.u.lzw.bpc != 8)
- fz_printf(ctx, out, "/BitsPerComponent %d\n", cbuf->params.u.lzw.bpc);
+ fz_write_printf(ctx, out, "/BitsPerComponent %d\n", cbuf->params.u.lzw.bpc);
if (cbuf->params.u.lzw.early_change != 1)
- fz_printf(ctx, out, "/EarlyChange %d\n", cbuf->params.u.lzw.early_change);
- fz_printf(ctx, out, ahx ? ">>]\n" : ">>\n");
+ fz_write_printf(ctx, out, "/EarlyChange %d\n", cbuf->params.u.lzw.early_change);
+ fz_write_printf(ctx, out, ahx ? ">>]\n" : ">>\n");
}
break;
}
- fz_printf(ctx, out, "ID\n");
+ fz_write_printf(ctx, out, "ID\n");
len = fz_buffer_storage(ctx, buf, &data);
if (ahx)
{
@@ -671,39 +671,39 @@ pdf_out_BI(fz_context *ctx, pdf_processor *proc, fz_image *img)
for (z = 0; z < len; ++z)
{
int c = data[z];
- fz_putc(ctx, out, "0123456789abcdef"[(c >> 4) & 0xf]);
- fz_putc(ctx, out, "0123456789abcdef"[c & 0xf]);
+ fz_write_byte(ctx, out, "0123456789abcdef"[(c >> 4) & 0xf]);
+ fz_write_byte(ctx, out, "0123456789abcdef"[c & 0xf]);
if ((z & 31) == 31)
- fz_putc(ctx, out, '\n');
+ fz_write_byte(ctx, out, '\n');
}
- fz_putc(ctx, out, '>');
+ fz_write_byte(ctx, out, '>');
}
else
{
- fz_write(ctx, out, data, len);
+ fz_write_data(ctx, out, data, len);
}
- fz_printf(ctx, out, "\nEI\n");
+ fz_write_printf(ctx, out, "\nEI\n");
}
static void
pdf_out_sh(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s sh\n", name);
+ fz_write_printf(ctx, out, "/%s sh\n", name);
}
static void
pdf_out_Do_image(fz_context *ctx, pdf_processor *proc, const char *name, fz_image *image)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s Do\n", name);
+ fz_write_printf(ctx, out, "/%s Do\n", name);
}
static void
pdf_out_Do_form(fz_context *ctx, pdf_processor *proc, const char *name, pdf_xobject *xobj, pdf_obj *page_resources)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s Do\n", name);
+ fz_write_printf(ctx, out, "/%s Do\n", name);
}
/* marked content */
@@ -712,39 +712,39 @@ static void
pdf_out_MP(fz_context *ctx, pdf_processor *proc, const char *tag)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s MP\n", tag);
+ fz_write_printf(ctx, out, "/%s MP\n", tag);
}
static void
pdf_out_DP(fz_context *ctx, pdf_processor *proc, const char *tag, pdf_obj *raw, pdf_obj *cooked)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s ", tag);
+ fz_write_printf(ctx, out, "/%s ", tag);
pdf_print_obj(ctx, out, raw, 1);
- fz_printf(ctx, out, " DP\n");
+ fz_write_printf(ctx, out, " DP\n");
}
static void
pdf_out_BMC(fz_context *ctx, pdf_processor *proc, const char *tag)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s BMC\n", tag);
+ fz_write_printf(ctx, out, "/%s BMC\n", tag);
}
static void
pdf_out_BDC(fz_context *ctx, pdf_processor *proc, const char *tag, pdf_obj *raw, pdf_obj *cooked)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "/%s ", tag);
+ fz_write_printf(ctx, out, "/%s ", tag);
pdf_print_obj(ctx, out, raw, 1);
- fz_printf(ctx, out, " BDC\n");
+ fz_write_printf(ctx, out, " BDC\n");
}
static void
pdf_out_EMC(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "EMC\n");
+ fz_write_printf(ctx, out, "EMC\n");
}
/* compatibility */
@@ -753,14 +753,14 @@ static void
pdf_out_BX(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "BX\n");
+ fz_write_printf(ctx, out, "BX\n");
}
static void
pdf_out_EX(fz_context *ctx, pdf_processor *proc)
{
fz_output *out = ((pdf_output_processor*)proc)->out;
- fz_printf(ctx, out, "EX\n");
+ fz_write_printf(ctx, out, "EX\n");
}
static void