SHA256
1
0
forked from pool/transfig
transfig/transfig.3.2.5d-mediaboxrealnb.dif

34 lines
1.2 KiB
Plaintext

--- fig2dev/dev/readeps.c
+++ fig2dev/dev/readeps.c 2013-02-07 16:18:36.233452627 +0000
@@ -79,12 +79,20 @@ read_eps_pdf(file, filetype, pic, llx, l
if (pdf_flag) {
if (!strncmp(buf, "/MediaBox", 8)) { /* look for the MediaBox spec */
c = strchr(buf,'[')+1;
- if (c && sscanf(c,"%d %d %d %d",llx,lly,&urx,&ury) < 4) {
+ if (c && sscanf(c, "%lf %lf %lf %lf",
+ &fllx, &flly, &furx, &fury) < 4) {
*llx = *lly = 0;
urx = paperdef[0].width*72;
ury = paperdef[0].height*72;
put_msg("Bad MediaBox in imported PDF file %s, assuming %s size",
pic->file, metric? "A4" : "Letter" );
+ } else {
+ *llx = (int) floor(fllx);
+ *lly = (int) floor(flly);
+ urx = (int) floor(furx);
+ ury = (int) floor(fury);
+ pic->bit_size.x = (int) (furx-fllx);
+ pic->bit_size.y = (int) (fury-flly);
}
}
/* look for bounding box for EPS file */
@@ -101,6 +109,8 @@ read_eps_pdf(file, filetype, pic, llx, l
}
*llx = (int) floor(fllx);
*lly = (int) floor(flly);
+ urx = (int) floor(furx);
+ ury = (int) floor(fury);
pic->bit_size.x = (int) (furx-fllx);
pic->bit_size.y = (int) (fury-flly);
break;