From 0c14fd18747b9f6fbbecb75ba8beef6d449c460a Mon Sep 17 00:00:00 2001 From: Luigi Scarso Date: Sun, 6 Jan 2019 18:57:01 +0000 Subject: luatex 1.09.2; r-mpost alias of mpost -restricted git-svn-id: svn://tug.org/texlive/trunk@49614 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/luatexdir/pdf/pdfgen.c | 7 ++-- Build/source/texk/web2c/luatexdir/pdf/pdfimage.c | 38 +++++++++++----------- Build/source/texk/web2c/luatexdir/pdf/pdflistout.c | 7 +++- Build/source/texk/web2c/luatexdir/pdf/pdftypes.h | 2 +- 4 files changed, 31 insertions(+), 23 deletions(-) (limited to 'Build/source/texk/web2c/luatexdir/pdf') diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c index 0409dbc33dc..78ce165957f 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c @@ -2482,14 +2482,17 @@ void scan_pdfcatalog(PDF pdf) real conforming to the implementation limits of \PDF\ as specified in appendix C.1 of the \PDF\ standard. The maximum value of ints is |+2^32|, the maximum value of reals is |+2^15| and the smallest values of reals is - |1/(2^16)|. + |1/(2^16)|. We are quite large on precision, because it could happen that a + pdf file imported as figure has real numbers with an unusual (and possibly useless) + high precision. Later the formatter will write the numbers in the correct format. */ static pdffloat conv_double_to_pdffloat(double n) { pdffloat a; - a.e = 6; +/* was a.e = 6; */ + a.e = 9 ; a.m = i64round(n * ten_pow[a.e]); return a; } diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfimage.c b/Build/source/texk/web2c/luatexdir/pdf/pdfimage.c index a8cffb0c871..02e4237c820 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfimage.c +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfimage.c @@ -24,8 +24,8 @@ with LuaTeX; if not, see . void place_img(PDF pdf, image_dict * idict, scaled_whd dim, int transform) { /*tex A transformation matrix: */ - float a[6]; - float xoff, yoff, tmp; + double a[6]; + double xoff, yoff, tmp; pdfstructure *p = pdf->pstruct; scaledpos pos = pdf->posstruct->pos; /*tex The number of digits after the decimal point: */ @@ -38,10 +38,10 @@ void place_img(PDF pdf, image_dict * idict, scaled_whd dim, int transform) a[1] = a[2] = 0; if (img_type(idict) == IMG_TYPE_PDF || img_type(idict) == IMG_TYPE_PDFMEMSTREAM || img_type(idict) == IMG_TYPE_PDFSTREAM) { - a[0] /= (float) img_xsize(idict); - a[3] /= (float) img_ysize(idict); - xoff = (float) img_xorig(idict) / (float) img_xsize(idict); - yoff = (float) img_yorig(idict) / (float) img_ysize(idict); + a[0] /= (double) img_xsize(idict); + a[3] /= (double) img_ysize(idict); + xoff = (double) img_xorig(idict) / (double) img_xsize(idict); + yoff = (double) img_yorig(idict) / (double) img_ysize(idict); r = 6; } else { if (img_type(idict) == IMG_TYPE_PNG) { @@ -49,7 +49,7 @@ void place_img(PDF pdf, image_dict * idict, scaled_whd dim, int transform) if ((groupref > 0) && (pdf->img_page_group_val == 0)) pdf->img_page_group_val = groupref; } - a[0] /= (float) one_hundred_bp; + a[0] /= (double) one_hundred_bp; a[3] = a[0]; xoff = yoff = 0; r = 4; @@ -90,14 +90,14 @@ void place_img(PDF pdf, image_dict * idict, scaled_whd dim, int transform) break; default:; } - xoff *= (float) dim.wd; - yoff *= (float) (dim.ht + dim.dp); - a[0] *= (float) dim.wd; - a[1] *= (float) (dim.ht + dim.dp); - a[2] *= (float) dim.wd; - a[3] *= (float) (dim.ht + dim.dp); - a[4] = (float) pos.h - xoff; - a[5] = (float) pos.v - yoff; + xoff *= (double) dim.wd; + yoff *= (double) (dim.ht + dim.dp); + a[0] *= (double) dim.wd; + a[1] *= (double) (dim.ht + dim.dp); + a[2] *= (double) dim.wd; + a[3] *= (double) (dim.ht + dim.dp); + a[4] = (double) pos.h - xoff; + a[5] = (double) pos.v - yoff; k = transform + img_rotation(idict); if ((transform & 7) > 3) k++; @@ -107,16 +107,16 @@ void place_img(PDF pdf, image_dict * idict, scaled_whd dim, int transform) break; case 1: /*tex rotation over 90 degrees (counterclockwise) */ - a[4] += (float) dim.wd; + a[4] += (double) dim.wd; break; case 2: /*tex rotation over 180 degrees (counterclockwise) */ - a[4] += (float) dim.wd; - a[5] += (float) (dim.ht + dim.dp); + a[4] += (double) dim.wd; + a[5] += (double) (dim.ht + dim.dp); break; case 3: /*tex rotation over 270 degrees (counterclockwise) */ - a[5] += (float) (dim.ht + dim.dp); + a[5] += (double) (dim.ht + dim.dp); break; default:; } diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c index 9dbdaeefa28..86567c1dc4e 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c +++ b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c @@ -237,6 +237,8 @@ void hlist_out(PDF pdf, halfword this_box, int rule_callback_id) int i; /*tex DVI! \.{DVI} byte location upon entry */ int saved_loc = 0; + /*tex safeguard */ + int dir_done = 0; /*tex DVI! what |dvi| should pop to */ scaledpos saved_pos = { 0, 0 }; int synctex = synctex_par ; @@ -576,12 +578,15 @@ void hlist_out(PDF pdf, halfword this_box, int rule_callback_id) localpos.dir = dir_dir(p); cur.h = 0; cur.v = 0; - } else { + dir_done = 1; + } else if (dir_done) { refpos->pos.h = dir_refpos_h(p); refpos->pos.v = dir_refpos_v(p); localpos.dir = dir_dir(p); cur.h = dir_cur_h(p); cur.v = dir_cur_v(p); + } else { + /*tex maybe issue a warning */ } break; case whatsit_node: diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h b/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h index ef6a31e167d..67ffcbecb22 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h @@ -41,7 +41,7 @@ #ifdef _WIN32 # define i64round(a) (int64_t) win32_floor((a) + 0.5) #else -# define i64round(a) (int64_t) lround((a)) +# define i64round(a) (int64_t) llround((a)) #endif -- cgit v1.2.3