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

32 lines
1.1 KiB
Plaintext

---
fig2dev/dev/readeps.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--- fig2dev/dev/readeps.c
+++ fig2dev/dev/readeps.c 2017-02-02 13:52:46.733848874 +0000
@@ -75,16 +75,22 @@ read_eps_pdf(FILE *file, int filetype, F
while (fgets(buf, 512, file) != NULL) {
/* look for /MediaBox for pdf file */
if (pdf_flag) {
+ char *s;
+ for(s=buf; (s=strchr(s,'/')); s++) {
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) {
+ c = strchr(s,'[');
+ if (c && sscanf(c+1,"%d %d %d %d",llx,lly,&urx,&ury) < 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" );
}
+ pic->bit_size.x = (urx-(*llx));
+ pic->bit_size.y = (ury-(*lly));
+ break;
}
+ }
/* look for bounding box for EPS file */
} else if (!nested && !strncmp(buf, "%%BoundingBox:", 14)) {
c=buf+14;