diff options
author | Han The Thanh <hanthethanh@gmail.com> | 2010-04-16 10:39:02 +0000 |
---|---|---|
committer | Han The Thanh <hanthethanh@gmail.com> | 2010-04-16 10:39:02 +0000 |
commit | 1a4eb7d7de2042c12e223a2eb31bc016de246561 (patch) | |
tree | de1e1b8f9a605b6528712675291c752a3f75f3ed /Build | |
parent | 3ba06bc5a98bfc651ab7ec896205727f7373045d (diff) |
minor fixes for pdftex
git-svn-id: svn://tug.org/texlive/trunk@17892 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/image.h | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/pdftoepdf.cc | 15 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/writeimg.c | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/writepng.c | 74 |
4 files changed, 49 insertions, 42 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/image.h b/Build/source/texk/web2c/pdftexdir/image.h index 9365d128716..e54145c0582 100644 --- a/Build/source/texk/web2c/pdftexdir/image.h +++ b/Build/source/texk/web2c/pdftexdir/image.h @@ -109,7 +109,6 @@ extern void write_epdf(void); extern void epdf_delete(void); extern void read_png_info(integer); extern void write_png(integer); -extern void write_additional_png_objects(void); extern void read_jpg_info(integer); extern void write_jpg(integer); extern void read_jbig2_info(integer); diff --git a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc index d1da80bb3cc..fd1b5365cb5 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc +++ b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc @@ -447,13 +447,22 @@ static void copyFontResources(Object * obj) static void copyOtherResources(Object * obj, char *key) { // copies all other resources (write_epdf handles Fonts and ProcSets), - // but gives a warning if an object is not a dictionary. - if (!obj->isDict()) + // if Subtype is present, it must be a name + if (strcmp("Subtype", key) == 0) { + if (!obj->isName()) { + pdftex_warn("PDF inclusion: Subtype in Resources dict is not a name" + " (key '%s', type <%s>); ignored.", + key, obj->getTypeName()); + return; + } + } else if (!obj->isDict()) { //FIXME: Write the message only to the log file pdftex_warn("PDF inclusion: invalid other resource which is no dict" - " (key '%s', type <%s>); copying it anyway.", + " (key '%s', type <%s>); ignored.", key, obj->getTypeName()); + return; + } copyName(key); pdf_puts(" "); copyObject(obj); diff --git a/Build/source/texk/web2c/pdftexdir/writeimg.c b/Build/source/texk/web2c/pdftexdir/writeimg.c index ba6281eeb33..78540e0d180 100644 --- a/Build/source/texk/web2c/pdftexdir/writeimg.c +++ b/Build/source/texk/web2c/pdftexdir/writeimg.c @@ -350,7 +350,6 @@ void writeimage(integer img) switch (img_type(img)) { case IMAGE_TYPE_PNG: write_png(img); - write_additional_png_objects(); break; case IMAGE_TYPE_JPG: write_jpg(img); diff --git a/Build/source/texk/web2c/pdftexdir/writepng.c b/Build/source/texk/web2c/pdftexdir/writepng.c index 249bb96d933..aa5fb0c7e39 100644 --- a/Build/source/texk/web2c/pdftexdir/writepng.c +++ b/Build/source/texk/web2c/pdftexdir/writepng.c @@ -110,7 +110,7 @@ void read_png_info(integer img) #define write_gray_pixel_8(r) \ if (j % 2 == 0) pdfbuf[pdfptr++] = *r++; \ - else smask[smask_ptr++] = *r++ + else smask[smask_ptr++] = *r++ #define write_rgb_pixel_16(r) \ @@ -130,27 +130,27 @@ void read_png_info(integer img) r = row; \ k = png_info(img)->rowbytes; \ while(k > 0) { \ - l = (k > pdfbufsize)? pdfbufsize : k; \ - pdfroom(l); \ - for (j = 0; j < l; j++) { \ - outmac; \ - } \ - k -= l; \ - } \ + l = (k > pdfbufsize)? pdfbufsize : k; \ + pdfroom(l); \ + for (j = 0; j < l; j++) { \ + outmac; \ + } \ + k -= l; \ + } \ } #define write_interlaced(outmac) \ for (i = 0; i < (int)png_info(img)->height; i++) { \ row = rows[i]; \ - k = png_info(img)->rowbytes; \ - while(k > 0) { \ - l = (k > pdfbufsize)? pdfbufsize : k; \ - pdfroom(l); \ - for (j = 0; j < l; j++) { \ - outmac; \ - } \ - k -= l; \ - } \ + k = png_info(img)->rowbytes; \ + while(k > 0) { \ + l = (k > pdfbufsize)? pdfbufsize : k; \ + pdfroom(l); \ + for (j = 0; j < l; j++) { \ + outmac; \ + } \ + k -= l; \ + } \ xfree(rows[i]); \ } @@ -486,6 +486,25 @@ static void copy_png(integer img) } static boolean last_png_needs_page_group; +static boolean transparent_page_group_was_written = false; + +/* Called after the xobject generated by write_png has been finished; used to + * write out additional objects */ +static void write_additional_png_objects(void) +{ + if (last_png_needs_page_group) { + if (!transparent_page_group_was_written && transparent_page_group > 1) { + // create new group object + transparent_page_group_was_written = true; + pdfbeginobj(transparent_page_group, 2); + if (getpdfcompresslevel() == 0) { + pdf_puts("%PTEX Group needed for transparent pngs\n"); + } + pdf_puts("<</Type/Group /S/Transparency /CS/DeviceRGB /I true>>\n"); + pdfendobj(); + } + } +} void write_png(integer img) { @@ -605,24 +624,5 @@ void write_png(integer img) } } pdfflush(); -} - -static boolean transparent_page_group_was_written = false; - -/* Called after the xobject generated by write_png has been finished; used to - * write out additional objects */ -void write_additional_png_objects(void) -{ - if (last_png_needs_page_group) { - if (!transparent_page_group_was_written && transparent_page_group > 1) { - // create new group object - transparent_page_group_was_written = true; - pdfbeginobj(transparent_page_group, 2); - if (getpdfcompresslevel() == 0) { - pdf_puts("%PTEX Group needed for transparent pngs\n"); - } - pdf_puts("<</Type/Group /S/Transparency /CS/DeviceRGB /I true>>\n"); - pdfendobj(); - } - } + write_additional_png_objects(); } |