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

33 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 2018-05-07 08:45:37.772825723 +0000
@@ -83,9 +83,11 @@ read_eps_pdf(FILE *file, int filetype, F
while (fgets(buf, BUFSIZ, file) != NULL) {
/* look for /MediaBox for pdf file */
if (pdf_flag) {
+ char *s;
+ for(s=buf; (s=strchr(s,'/')); s++) {
if (!strncmp(buf, "/MediaBox", 9)) { /* 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;
@@ -93,7 +95,11 @@ read_eps_pdf(FILE *file, int filetype, F
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;