summaryrefslogtreecommitdiff
path: root/print
diff options
context:
space:
mode:
authorwiz <wiz>2011-01-17 10:33:43 +0000
committerwiz <wiz>2011-01-17 10:33:43 +0000
commitd7e51a9f96763a763d154c92ddd19430a4a7dfff (patch)
treed1d96994f332944e5dc5754c61fdb4c7b5f5be9c /print
parent60f58e6f576096a22dcd0d5a1a2ceb6c1e805854 (diff)
downloadpkgsrc-d7e51a9f96763a763d154c92ddd19430a4a7dfff.tar.gz
Update to 0.65.0, set LICENSE, and fix build with png-1.5.
0.65.0: I have just uploaded the archives for a new luatex release, 0.65.0. This release mostly fixes a number of bugs, but it also deprecates a number of existing lua and macro commands. Please read the News section carefully if you are the current maintainer of a luatex macro package. News: * The Aleph and Omega version primitives are deprecated. * The Apple Snow Leopard Truetype font collections now work properly. * Libpng has been updated to 1.4.4, and zlib to 1.2.5. * New lua functions node.next() and node.prev(). * The already deprecated for some time node.protrusion_skipable() function has been removed. * fontloader.apply_featurefile() and fontloader.apply_afmfile() now return nil,<errortable> on failure. * The various node list fields in the lua node interface have been renamed from 'list' to 'head', e.g. tex.box[0].head, and the 'list' name is deprecated. For now, the deprecation is silent, as 'list' will stay for quite some time. Please update your lua source as soon as possible, though. * The call node.type(<node>) now returns "node". The existing functionality is otherwise unchanged. * Luafilesystem has been updated to 1.5.0. NOTE: there is an incompatible change in the directory iterator method. * The restriction on linebreak_filter has been eased: at least one horizontal box should be returned, but that is not necessarily the last node any more. * Backward compatibility has been restored for \meaning\mathchar * node.first_character() has been renamed to node.first_glyph() to better match its actual functionality. * The \Umathaccent primitive now supports both/bottom keywords, and \Umathbotaccent / \Umathaccents are now deprecated. * The \Umathaccent primitive now also supports the fixed keyword, which supports non-growing math accents even if the font says there are extensible variants. * Ongoing work on the epdf library. 0.64.0: I have just uploaded the archives for a new luatex release, 0.64.0. This is a development release, but it also fixes a few rather annoying bugs in 0.63.0. News: * New lua functions pdf.refobj(), pdf.maxobjnum() and pdf.objtype() * New lua function node.is_node() * The max_strings configuration variable's maximum value is raised to be identical to texlive's maximum (2097151), and same for param_size (32767). * The embedded mplib is now 1.503. * Minor cleanups in the output of fontloader.to_table(): - removed out-of-range altuni's from the output - don't dump the extra encodings, just the actual font encoding - export the encoding's name also as 'enc_name' at one level up - no longer exporting unset macstyles, nor zero uniqueids - fix creationtime and modification time * Ongoing work on the epdf library Bugfixes: * Fix a bug where an explicit hyphen prevented hyphenation for the whole rest of the paragraph * Internal font copying forgot to copy the last font dimen * os.selfdir() is now documented * patch quad (\fontdimen6) in \letterspacefont to be compatible with pdftex * Multi-page pdf inclusion was very slow in 0.63.0 * Some extra checks added to the handling of glue_spec node objects in lua code. * Some node.prev pointers have been corrected (but this is not quite finished). * A small fix to lpeg 0.9.
Diffstat (limited to 'print')
-rw-r--r--print/luatex/Makefile26
-rw-r--r--print/luatex/distinfo9
-rw-r--r--print/luatex/patches/patch-ad449
3 files changed, 472 insertions, 12 deletions
diff --git a/print/luatex/Makefile b/print/luatex/Makefile
index eb2349885ca..68fb2a8cf4e 100644
--- a/print/luatex/Makefile
+++ b/print/luatex/Makefile
@@ -1,25 +1,26 @@
-# $NetBSD: Makefile,v 1.8 2011/01/13 13:39:13 wiz Exp $
+# $NetBSD: Makefile,v 1.9 2011/01/17 10:33:43 wiz Exp $
-DISTNAME= luatex-beta-0.63.0
-PKGNAME= ${DISTNAME:S/-beta//}
-PKGREVISION= 1
+DISTNAME= luatex-beta-0.65.0-source
+PKGNAME= ${DISTNAME:S/-beta//:S/-source//}
CATEGORIES= print
-MASTER_SITES= http://foundry.supelec.fr/gf/download/frsrelease/382/1568/
+MASTER_SITES= http://foundry.supelec.fr/gf/download/frsrelease/386/1704/
EXTRACT_SUFX= .tar.bz2
MAINTAINER= minskim@NetBSD.org
HOMEPAGE= http://www.luatex.org/
COMMENT= Extended version of pdfTeX using Lua
+LICENSE= gnu-gpl-v2
PKG_DESTDIR_SUPPORT= user-destdir
+MAKE_JOBS_SAFE=no
CONFLICTS+= web2c<=7.5.7nb3
GNU_CONFIGURE= yes
USE_LANGUAGES= c c++
USE_LIBTOOL= yes
-USE_TOOLS+= gmake
-WRKSRC= ${WRKDIR}/${DISTNAME}/source
+USE_TOOLS+= gmake pkg-config
+WRKSRC= ${WRKDIR}/${DISTNAME:S/-source//}/source
CONFIGURE_ARGS+=--enable-cxx-runtime-hack \
--disable-afm2pl \
@@ -93,15 +94,24 @@ CONFIGURE_ARGS+=--with-system-libpng \
CONFIGURE_ARGS+=--with-system-zlib \
--with-zlib-include=${BUILDLINK_PREFIX.zlib}/include \
--with-zlib-libdir=${BUILDLINK_PREFIX.zlib}/lib
-CONFIGURE_DIRS+=. ./texk/web2c
+CONFIGURE_ARGS+=--with-system-zziplib \
+ --with-zziplib-include=${BUILDLINK_PREFIX.zziplib}/include \
+ --with-zziplib-libdir=${BUILDLINK_PREFIX.zziplib}/lib
+CONFIGURE_ARGS+=--with-system-poppler \
+ --with-poppler-include=${BUILDLINK_PREFIX.poppler}/include \
+ --with-poppler-libdir=${BUILDLINK_PREFIX.poppler}/lib
+CONFIGURE_DIRS+=. texk/web2c
MAKE_FLAGS+= LIBTOOL=${LIBTOOL:Q}
CFLAGS+= -DLUA_ROOT=\"${PREFIX}/\"
INSTALLATION_DIRS+= bin
+.include "../../archivers/zziplib/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../graphics/png/buildlink3.mk"
.include "../../print/kpathsea/buildlink3.mk"
+.include "../../print/poppler-includes/buildlink3.mk"
+.include "../../print/poppler/buildlink3.mk"
post-extract:
${RM} -rf ${WRKSRC}/texk/kpathsea
diff --git a/print/luatex/distinfo b/print/luatex/distinfo
index d5459c07eb9..d9517a49789 100644
--- a/print/luatex/distinfo
+++ b/print/luatex/distinfo
@@ -1,8 +1,9 @@
-$NetBSD: distinfo,v 1.4 2010/09/13 04:11:52 minskim Exp $
+$NetBSD: distinfo,v 1.5 2011/01/17 10:33:43 wiz Exp $
-SHA1 (luatex-beta-0.63.0.tar.bz2) = bd947f620511876d3384ed6c0aacf08b12c0a060
-RMD160 (luatex-beta-0.63.0.tar.bz2) = 5abe91a511af9cd75036f67b835f9e242155f529
-Size (luatex-beta-0.63.0.tar.bz2) = 8368686 bytes
+SHA1 (luatex-beta-0.65.0-source.tar.bz2) = 5d01dc1dbc46b8c654ca5a45f3b537cae8a2cf6d
+RMD160 (luatex-beta-0.65.0-source.tar.bz2) = c23ac8c3cc26c9064f099c5789ae64edd22fc1a7
+Size (luatex-beta-0.65.0-source.tar.bz2) = 7575951 bytes
SHA1 (patch-aa) = 738c8bd631db36671d2c4eb48a360b7a16186c64
SHA1 (patch-ab) = e9c4d72aaac53ee9f47d84a01438e23ce9e9c326
SHA1 (patch-ac) = 23d6c26c4ded11267f05730119c250a831cd53ff
+SHA1 (patch-ad) = 98dd91c2741452b2356a2b7e6c74d8a5b82ae7bf
diff --git a/print/luatex/patches/patch-ad b/print/luatex/patches/patch-ad
new file mode 100644
index 00000000000..d97c911edf2
--- /dev/null
+++ b/print/luatex/patches/patch-ad
@@ -0,0 +1,449 @@
+$NetBSD: patch-ad,v 1.1 2011/01/17 10:33:43 wiz Exp $
+
+Fix build with png-1.5 from upstream SVN.
+http://foundry.supelec.fr/gf/project/luatex/scmsvn/?action=browse&path=%2F&view=rev&revision=4045
+Further additional changes manually; ->transformations part
+commented out on recommendation by John Bowler.
+
+--- texk/web2c/luatexdir/image/writepng.w.orig 2010-12-13 13:41:15.000000000 +0000
++++ texk/web2c/luatexdir/image/writepng.w
+@@ -67,7 +67,7 @@ void read_png_info(PDF pdf, image_dict *
+ if ((info_p = png_create_info_struct(png_p)) == NULL)
+ pdftex_fail("libpng: png_create_info_struct() failed");
+ img_png_info_ptr(idict) = info_p;
+- if (setjmp(png_p->jmpbuf))
++ if (setjmp(png_jmpbuf(png_p)))
+ pdftex_fail("libpng: internal error");
+ png_init_io(png_p, img_file(idict));
+ png_read_info(png_p, info_p);
+@@ -76,12 +76,12 @@ void read_png_info(PDF pdf, image_dict *
+ png_set_tRNS_to_alpha(png_p);
+ }
+ /* alpha channel support */
+- if (pdf->minor_version < 4 && png_p->color_type | PNG_COLOR_MASK_ALPHA)
++ if (pdf->minor_version < 4 && png_get_color_type (png_p, info_p) | PNG_COLOR_MASK_ALPHA)
+ png_set_strip_alpha(png_p);
+ /* 16bit depth support */
+ if (pdf->minor_version < 5)
+ pdf->image_hicolor = 0;
+- if ((info_p->bit_depth == 16) && (pdf->image_hicolor == 0))
++ if ((png_get_bit_depth (png_p, info_p) == 16) && (pdf->image_hicolor == 0))
+ png_set_strip_16(png_p);
+ /* gamma support */
+ if (pdf->image_apply_gamma) {
+@@ -94,15 +94,15 @@ void read_png_info(PDF pdf, image_dict *
+ /* reset structure */
+ png_read_update_info(png_p, info_p);
+ /* resolution support */
+- img_xsize(idict) = (int) info_p->width;
+- img_ysize(idict) = (int) info_p->height;
+- if (info_p->valid & PNG_INFO_pHYs) {
++ img_xsize(idict) = (int) png_get_image_width (png_p, info_p);
++ img_ysize(idict) = (int) png_get_image_height (png_p, info_p);
++ if (png_get_valid(png_p, info_p, PNG_INFO_pHYs)) {
+ img_xres(idict) =
+ round(0.0254 * (double) png_get_x_pixels_per_meter(png_p, info_p));
+ img_yres(idict) =
+ round(0.0254 * (double) png_get_y_pixels_per_meter(png_p, info_p));
+ }
+- switch (info_p->color_type) {
++ switch (png_get_color_type (png_p, info_p)) {
+ case PNG_COLOR_TYPE_PALETTE:
+ img_procset(idict) |= PROCSET_IMAGE_C | PROCSET_IMAGE_I;
+ break;
+@@ -115,9 +115,9 @@ void read_png_info(PDF pdf, image_dict *
+ img_procset(idict) |= PROCSET_IMAGE_C;
+ break;
+ default:
+- pdftex_fail("unsupported type of color_type <%i>", info_p->color_type);
++ pdftex_fail("unsupported type of color_type <%i>", (int)png_get_color_type (png_p, info_p));
+ }
+- img_colordepth(idict) = info_p->bit_depth;
++ img_colordepth(idict) = png_get_bit_depth (png_p, info_p);
+ if (readtype == IMG_CLOSEINBETWEEN)
+ close_and_cleanup_png(idict);
+ }
+@@ -142,10 +142,10 @@ void read_png_info(PDF pdf, image_dict *
+ #define write_simple_pixel(r) pdf_quick_out(pdf,*r++)
+
+ #define write_noninterlaced(outmac) \
+- for (i = 0; i < (int)info_p->height; i++) { \
++ for (i = 0; i < (int)png_get_image_height (png_p, info_p); i++) { \
+ png_read_row(png_p, row, NULL); \
+ r = row; \
+- k = (int)info_p->rowbytes; \
++ k = (int)png_get_rowbytes (png_p, info_p); \
+ while(k > 0) { \
+ l = (k > pdf->buf_size)? pdf->buf_size : k; \
+ pdf_room(pdf,l); \
+@@ -157,9 +157,9 @@ void read_png_info(PDF pdf, image_dict *
+ }
+
+ #define write_interlaced(outmac) \
+- for (i = 0; i < (int)info_p->height; i++) { \
++ for (i = 0; i < (int)png_get_image_height (png_p, info_p); i++) { \
+ row = rows[i]; \
+- k = (int)info_p->rowbytes; \
++ k = (int)png_get_rowbytes (png_p, info_p); \
+ while(k > 0) { \
+ l = (k > pdf->buf_size)?pdf->buf_size: k;\
+ pdf_room(pdf,l); \
+@@ -179,25 +179,30 @@ static void write_png_palette(PDF pdf, i
+ png_infop info_p = img_png_info_ptr(idict);
+ png_bytep row, r, *rows;
+ int palette_objnum = 0;
++ png_colorp palette;
++ int num_palette;
++
++ png_get_PLTE(png_p, info_p, &palette, &num_palette);
++
+ if (img_colorspace(idict) != 0) {
+ pdf_printf(pdf, "%i 0 R\n", (int) img_colorspace(idict));
+ } else {
+ palette_objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_printf(pdf, "[/Indexed /DeviceRGB %i %i 0 R]\n",
+- (int) (info_p->num_palette - 1), (int) palette_objnum);
++ num_palette - 1, (int) palette_objnum);
+ }
+ pdf_begin_stream(pdf);
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
++ if (png_get_interlace_type (png_p, info_p) == PNG_INTERLACE_NONE) {
++ row = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
+ write_noninterlaced(write_simple_pixel(r));
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ if (png_get_image_height (png_p, info_p) * png_get_rowbytes (png_p, info_p) >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(png_get_image_height (png_p, info_p), png_bytep);
++ for (i = 0; (unsigned) i < png_get_image_height (png_p, info_p); i++)
++ rows[i] = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
+ png_read_image(png_p, rows);
+ write_interlaced(write_simple_pixel(row));
+ xfree(rows);
+@@ -206,11 +211,11 @@ static void write_png_palette(PDF pdf, i
+ if (palette_objnum > 0) {
+ pdf_begin_dict(pdf, palette_objnum, 0);
+ pdf_begin_stream(pdf);
+- for (i = 0; (unsigned) i < info_p->num_palette; i++) {
++ for (i = 0; (unsigned) i < num_palette; i++) {
+ pdf_room(pdf, 3);
+- pdf_quick_out(pdf, info_p->palette[i].red);
+- pdf_quick_out(pdf, info_p->palette[i].green);
+- pdf_quick_out(pdf, info_p->palette[i].blue);
++ pdf_quick_out(pdf, palette[i].red);
++ pdf_quick_out(pdf, palette[i].green);
++ pdf_quick_out(pdf, palette[i].blue);
+ }
+ pdf_end_stream(pdf);
+ }
+@@ -229,17 +234,17 @@ static void write_png_gray(PDF pdf, imag
+ pdf_puts(pdf, "/DeviceGray\n");
+ }
+ pdf_begin_stream(pdf);
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
++ if (png_get_interlace_type (png_p, info_p) == PNG_INTERLACE_NONE) {
++ row = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
+ write_noninterlaced(write_simple_pixel(r));
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ if (png_get_image_height (png_p, info_p) * png_get_rowbytes (png_p, info_p) >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(png_get_image_height (png_p, info_p), png_bytep);
++ for (i = 0; (unsigned) i < png_get_image_height (png_p, info_p); i++)
++ rows[i] = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
+ png_read_image(png_p, rows);
+ write_interlaced(write_simple_pixel(row));
+ xfree(rows);
+@@ -258,7 +263,7 @@ static void write_png_gray_alpha(PDF pdf
+ png_bytep smask;
+ int smask_ptr = 0;
+ int smask_size = 0;
+- int bitdepth;
++ png_byte bitdepth;
+ if (img_colorspace(idict) != 0) {
+ pdf_printf(pdf, "%i 0 R\n", (int) img_colorspace(idict));
+ } else {
+@@ -266,26 +271,26 @@ static void write_png_gray_alpha(PDF pdf
+ }
+ smask_objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_printf(pdf, "/SMask %i 0 R\n", (int) smask_objnum);
+- smask_size = (int) ((info_p->rowbytes / 2) * info_p->height);
++ smask_size = (int) ((png_get_rowbytes (png_p, info_p) / 2) * png_get_image_height (png_p, info_p));
+ smask = xtalloc((unsigned) smask_size, png_byte);
+ pdf_begin_stream(pdf);
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
+- if ((info_p->bit_depth == 16) && (pdf->image_hicolor != 0)) {
++ if (png_get_interlace_type (png_p, info_p) == PNG_INTERLACE_NONE) {
++ row = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
++ if ((png_get_bit_depth (png_p, info_p) == 16) && (pdf->image_hicolor != 0)) {
+ write_noninterlaced(write_gray_pixel_16(r));
+ } else {
+ write_noninterlaced(write_gray_pixel_8(r));
+ }
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ if (png_get_image_height (png_p, info_p) * png_get_rowbytes (png_p, info_p) >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(png_get_image_height (png_p, info_p), png_bytep);
++ for (i = 0; (unsigned) i < png_get_image_height (png_p, info_p); i++)
++ rows[i] = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
+ png_read_image(png_p, rows);
+- if ((info_p->bit_depth == 16) && (pdf->image_hicolor != 0)) {
++ if ((png_get_bit_depth (png_p, info_p) == 16) && (pdf->image_hicolor != 0)) {
+ write_interlaced(write_gray_pixel_16(row));
+ } else {
+ write_interlaced(write_gray_pixel_8(row));
+@@ -295,14 +300,15 @@ static void write_png_gray_alpha(PDF pdf
+ pdf_end_stream(pdf);
+ pdf_flush(pdf);
+ /* now write the Smask object */
+- bitdepth = (int) info_p->bit_depth;
++ bitdepth = png_get_bit_depth (png_p, info_p);
+ pdf_begin_dict(pdf, smask_objnum, 0);
+ pdf_puts(pdf, "/Type /XObject\n/Subtype /Image\n");
+ if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
+ pdf_printf(pdf, "%s\n", img_attr(idict));
+- pdf_printf(pdf, "/Width %i\n/Height %i\n/BitsPerComponent %i\n",
+- (int) info_p->width,
+- (int) info_p->height, (bitdepth == 16 ? 8 : bitdepth));
++ pdf_printf(pdf, "/Width %u\n/Height %i\n/BitsPerComponent %u\n",
++ png_get_image_width (png_p, info_p),
++ png_get_image_height (png_p, info_p),
++ (bitdepth == 16 ? 8 : bitdepth));
+ pdf_puts(pdf, "/ColorSpace /DeviceGray\n");
+ pdf_begin_stream(pdf);
+ for (i = 0; i < smask_size; i++) {
+@@ -329,17 +335,17 @@ static void write_png_rgb(PDF pdf, image
+ pdf_puts(pdf, "/DeviceRGB\n");
+ }
+ pdf_begin_stream(pdf);
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
++ if (png_get_interlace_type (png_p, info_p) == PNG_INTERLACE_NONE) {
++ row = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
+ write_noninterlaced(write_simple_pixel(r));
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ if (png_get_image_height (png_p, info_p) * png_get_rowbytes (png_p, info_p) >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(png_get_image_height (png_p, info_p), png_bytep);
++ for (i = 0; (unsigned) i < png_get_image_height (png_p, info_p); i++)
++ rows[i] = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
+ png_read_image(png_p, rows);
+ write_interlaced(write_simple_pixel(row));
+ xfree(rows);
+@@ -358,7 +364,7 @@ static void write_png_rgb_alpha(PDF pdf,
+ png_bytep smask;
+ int smask_ptr = 0;
+ int smask_size = 0;
+- int bitdepth;
++ png_byte bitdepth;
+ if (img_colorspace(idict) != 0) {
+ pdf_printf(pdf, "%i 0 R\n", (int) img_colorspace(idict));
+ } else {
+@@ -366,26 +372,26 @@ static void write_png_rgb_alpha(PDF pdf,
+ }
+ smask_objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_printf(pdf, "/SMask %i 0 R\n", (int) smask_objnum);
+- smask_size = (int) ((info_p->rowbytes / 4) * info_p->height);
++ smask_size = (int) ((png_get_rowbytes (png_p, info_p) / 4) * png_get_image_height (png_p, info_p));
+ smask = xtalloc((unsigned) smask_size, png_byte);
+ pdf_begin_stream(pdf);
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
+- if ((info_p->bit_depth == 16) && (pdf->image_hicolor != 0)) {
++ if (png_get_interlace_type (png_p, info_p) == PNG_INTERLACE_NONE) {
++ row = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
++ if ((png_get_bit_depth (png_p, info_p) == 16) && (pdf->image_hicolor != 0)) {
+ write_noninterlaced(write_rgb_pixel_16(r));
+ } else {
+ write_noninterlaced(write_rgb_pixel_8(r));
+ }
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ if (png_get_image_height (png_p, info_p) * png_get_rowbytes (png_p, info_p) >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(png_get_image_height (png_p, info_p), png_bytep);
++ for (i = 0; (unsigned) i < png_get_image_height (png_p, info_p); i++)
++ rows[i] = xtalloc(png_get_rowbytes (png_p, info_p), png_byte);
+ png_read_image(png_p, rows);
+- if ((info_p->bit_depth == 16) && (pdf->image_hicolor != 0)) {
++ if ((png_get_bit_depth (png_p, info_p) == 16) && (pdf->image_hicolor != 0)) {
+ write_interlaced(write_rgb_pixel_16(row));
+ } else {
+ write_interlaced(write_rgb_pixel_8(row));
+@@ -396,14 +402,15 @@ static void write_png_rgb_alpha(PDF pdf,
+ pdf_flush(pdf);
+ /* now write the Smask object */
+ if (smask_objnum > 0) {
+- bitdepth = (int) info_p->bit_depth;
++ bitdepth = png_get_bit_depth (png_p, info_p);
+ pdf_begin_dict(pdf, smask_objnum, 0);
+ pdf_puts(pdf, "/Type /XObject\n/Subtype /Image\n");
+ if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
+ pdf_printf(pdf, "%s\n", img_attr(idict));
+- pdf_printf(pdf, "/Width %i\n/Height %i\n/BitsPerComponent %i\n",
+- (int) info_p->width,
+- (int) info_p->height, (bitdepth == 16 ? 8 : bitdepth));
++ pdf_printf(pdf, "/Width %u\n/Height %u\n/BitsPerComponent %i\n",
++ png_get_image_width (png_p, info_p),
++ png_get_image_height (png_p, info_p),
++ (bitdepth == 16 ? 8 : bitdepth));
+ pdf_puts(pdf, "/ColorSpace /DeviceGray\n");
+ pdf_begin_stream(pdf);
+ for (i = 0; i < smask_size; i++) {
+@@ -451,7 +458,7 @@ static void copy_png(PDF pdf, image_dict
+ assert(idict != NULL);
+ png_p = img_png_png_ptr(idict);
+ info_p = img_png_info_ptr(idict);
+- fp = (FILE *) png_p->io_ptr;
++ fp = (FILE *) png_get_io_ptr (png_p);
+ /* 1st pass to find overall stream /Length */
+ if (fseek(fp, 8, SEEK_SET) != 0)
+ pdftex_fail("writepng: fseek in PNG file failed");
+@@ -473,11 +480,12 @@ static void copy_png(PDF pdf, image_dict
+ "/Filter/FlateDecode\n"
+ "/DecodeParms<<"
+ "/Colors %d"
+- "/Columns %d"
++ "/Columns %u"
+ "/BitsPerComponent %i"
+ "/Predictor 10>>\n>>\nstream\n", streamlength,
+- info_p->color_type == 2 ? 3 : 1,
+- (int) info_p->width, info_p->bit_depth);
++ png_get_color_type (png_p, info_p) == 2 ? 3 : 1,
++ png_get_image_width (png_p, info_p),
++ png_get_bit_depth (png_p, info_p));
+ /* 2nd pass to copy data */
+ endflag = false;
+ if (fseek(fp, 8, SEEK_SET) != 0)
+@@ -549,9 +557,10 @@ void write_png(PDF pdf, image_dict * idi
+ pdf_puts(pdf, "/Type /XObject\n/Subtype /Image\n");
+ if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
+ pdf_printf(pdf, "%s\n", img_attr(idict));
+- pdf_printf(pdf, "/Width %i\n/Height %i\n/BitsPerComponent %i\n",
+- (int) info_p->width,
+- (int) info_p->height, (int) info_p->bit_depth);
++ pdf_printf(pdf, "/Width %u\n/Height %u\n/BitsPerComponent %u\n",
++ png_get_image_width (png_p, info_p),
++ png_get_image_height (png_p, info_p),
++ png_get_bit_depth (png_p, info_p));
+ pdf_puts(pdf, "/ColorSpace ");
+ checked_gamma = 1.0;
+ if (pdf->image_apply_gamma) {
+@@ -563,21 +572,25 @@ void write_png(PDF pdf, image_dict * idi
+ }
+ /* the switching between |info_p| and |png_p| queries has been trial and error.
+ */
+- if (pdf->minor_version > 1 && info_p->interlace_type == PNG_INTERLACE_NONE && (png_p->transformations == 0 || png_p->transformations == 0x2000) /* gamma */
+- &&!(png_p->color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
+- png_p->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+- && ((pdf->image_hicolor != 0) || (png_p->bit_depth <= 8))
++ if (pdf->minor_version > 1
++ && png_get_interlace_type (png_p, info_p) == PNG_INTERLACE_NONE
++ &&!(png_get_color_type (png_p, info_p) == PNG_COLOR_TYPE_GRAY_ALPHA ||
++ png_get_color_type (png_p, info_p) == PNG_COLOR_TYPE_RGB_ALPHA)
++ && ((pdf->image_hicolor != 0) || (png_get_bit_depth (png_p, info_p) <= 8))
+ && (checked_gamma <= 1.01 && checked_gamma > 0.99)
+ ) {
++ png_colorp palette;
++ int num_palette;
++
++ png_get_PLTE(png_p, info_p, &palette, &num_palette);
+ if (img_colorspace(idict) != 0) {
+ pdf_printf(pdf, "%i 0 R\n", (int) img_colorspace(idict));
+ } else {
+- switch (info_p->color_type) {
++ switch (png_get_color_type (png_p, info_p)) {
+ case PNG_COLOR_TYPE_PALETTE:
+ palette_objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_printf(pdf, "[/Indexed /DeviceRGB %i %i 0 R]\n",
+- (int) (info_p->num_palette - 1),
+- (int) palette_objnum);
++ num_palette - 1, (int) palette_objnum);
+ break;
+ case PNG_COLOR_TYPE_GRAY:
+ pdf_puts(pdf, "/DeviceGray\n");
+@@ -592,11 +605,11 @@ void write_png(PDF pdf, image_dict * idi
+ if (palette_objnum > 0) {
+ pdf_begin_dict(pdf, palette_objnum, 0);
+ pdf_begin_stream(pdf);
+- for (i = 0; (unsigned) i < info_p->num_palette; i++) {
++ for (i = 0; (unsigned) i < num_palette; i++) {
+ pdf_room(pdf, 3);
+- pdf_quick_out(pdf, info_p->palette[i].red);
+- pdf_quick_out(pdf, info_p->palette[i].green);
+- pdf_quick_out(pdf, info_p->palette[i].blue);
++ pdf_quick_out(pdf, palette[i].red);
++ pdf_quick_out(pdf, palette[i].green);
++ pdf_quick_out(pdf, palette[i].blue);
+ }
+ pdf_end_stream(pdf);
+ }
+@@ -606,22 +619,20 @@ void write_png(PDF pdf, image_dict * idi
+ if ((pdf->image_apply_gamma != 0) &&
+ (checked_gamma > 1.01 || checked_gamma < 0.99))
+ tex_printf("gamma delta=%lf ", checked_gamma);
+- if (png_p->transformations != PNG_TRANSFORM_IDENTITY)
+- tex_printf("transform=%lu", (long) png_p->transformations);
+- if ((info_p->color_type != PNG_COLOR_TYPE_GRAY)
+- && (info_p->color_type != PNG_COLOR_TYPE_RGB)
+- && (info_p->color_type != PNG_COLOR_TYPE_PALETTE))
++ if ((png_get_color_type (png_p, info_p) != PNG_COLOR_TYPE_GRAY)
++ && (png_get_color_type (png_p, info_p) != PNG_COLOR_TYPE_RGB)
++ && (png_get_color_type (png_p, info_p) != PNG_COLOR_TYPE_PALETTE))
+ tex_printf("colortype ");
+ if (pdf->minor_version <= 1)
+ tex_printf("version=%d ", pdf->minor_version);
+- if (info_p->interlace_type != PNG_INTERLACE_NONE)
++ if (png_get_interlace_type (png_p, info_p) != PNG_INTERLACE_NONE)
+ tex_printf("interlaced ");
+- if (info_p->bit_depth > 8)
+- tex_printf("bitdepth=%d ", info_p->bit_depth);
++ if (png_get_bit_depth (png_p, info_p) > 8)
++ tex_printf("bitdepth=%d ", png_get_bit_depth (png_p, info_p));
+ if (png_get_valid(png_p, info_p, PNG_INFO_tRNS))
+ tex_printf("simple transparancy ");
+ }
+- switch (info_p->color_type) {
++ switch (png_get_color_type (png_p, info_p)) {
+ case PNG_COLOR_TYPE_PALETTE:
+ write_png_palette(pdf, idict);
+ break;
+@@ -647,7 +658,7 @@ void write_png(PDF pdf, image_dict * idi
+ break;
+ default:
+ pdftex_fail("unsupported type of color_type <%i>",
+- info_p->color_type);
++ png_get_color_type (png_p, info_p));
+ }
+ }
+ pdf_flush(pdf);