diff -u -r vcg.1.30/src/PSdev.c vcg.1.30-sde/src/PSdev.c --- vcg.1.30/src/PSdev.c Wed Feb 8 11:35:51 1995 +++ vcg.1.30-sde/src/PSdev.c Sat Mar 17 14:54:32 2001 @@ -209,6 +209,8 @@ _PP((int x,int y,int size,int c)); static void ps_se_arrowpoint _PP((int x,int y,int size,int c)); +void ps_mark + _PP((char *s, int minx, int miny, int maxx, int maxy)); static void portrait_header _PP((int a,int b,int c,int d,float scale,float lm, float bm)); @@ -344,7 +346,7 @@ * inch, i.e. 300 dpi. * lm,bm are the left margin, bottom margin in inches. * - * We follow the Adobe 2.0 PostScript format with Bounding Box. + * We follow the Adobe 3.0 PostScript format with Bounding Box. * Note: the bounding box gives the true size of the picture in 72dpi, * E.g. BoundingBox: 72 72 518 762 is a picture that is on a din A 4 * 1 inc far from the border. @@ -455,6 +457,11 @@ FPRINTF(fptr,"%%%%Page: %d %d\n", (i-1)*numpag+j, (i-1)*numpag+j); + /* Default line thickness is 1 */ + + FPRINTF(fptr,"1 setlinecap\n"); + FPRINTF(fptr,"1 setlinejoin\n"); + FPRINTF(fptr,"1 LW\n"); /* if (numpag>1) init_postscriptpage(); */ FPRINTF(fptr,"72 %3.2f div dup scale\n",scale); if (numpag == 1) { @@ -495,10 +502,10 @@ ps_draw_main(); FPRINTF(fptr,"showpage\n"); - FPRINTF(fptr,"%%%%PageTrailer\n"); } } FPRINTF(fptr,"%%%%Trailer\n"); + FPRINTF(fptr,"%%%%Pages: %d\n",numpag*numpag); FPRINTF(fptr,"%%%%EOF\n"); if (fptr) fclose(fptr); @@ -582,21 +589,16 @@ numxunits = (float)(c-a); numyunits = (float)(d-b); - FPRINTF(fptr,"%%!PS-Adobe-2.0 EPSF-1.2\n"); - FPRINTF(fptr,"%%%%Creator: %s (P)\n", short_banner); - FPRINTF(fptr,"%%%%Title: %s\n", mfilename); - FPRINTF(fptr,"%%%%RCS-info: $I"); - FPRINTF(fptr,"d$\n"); - FPRINTF(fptr,"%%%%SCCS-info: %%W"); - FPRINTF(fptr,"%% %%E"); - FPRINTF(fptr,"%%\n"); - if (act_bbox) FPRINTF(fptr,"%%%%BoundingBox: "); - else FPRINTF(fptr,"%%%%ProposedBoundings: "); - FPRINTF(fptr," %d %d %d %d\n", - gstoint(lm*72),gstoint(bm*72), - gstoint(lm*72)+gstoint(72*numxunits/scale), - gstoint(bm*72)+gstoint(72*numyunits/scale)); - + FPRINTF(fptr,"%%!PS-Adobe-3.0\n"); + FPRINTF(fptr,"%%%%Creator: (%s (P))\n", short_banner); + FPRINTF(fptr,"%%%%Title: (%s)\n", mfilename); + if (act_bbox) { + FPRINTF(fptr,"%%%%BoundingBox: %d %d %d %d\n", + gstoint(lm*72),gstoint(bm*72), + gstoint(lm*72)+gstoint(72*numxunits/scale), + gstoint(bm*72)+gstoint(72*numyunits/scale)); + } + FPRINTF(fptr,"%%%%Pages: (atend)\n"); FPRINTF(fptr,"%%%%EndComments\n"); common_header(); @@ -623,20 +625,17 @@ numxunits = (float)(c-a); numyunits = (float)(d-b); - FPRINTF(fptr,"%%!PS-Adobe-2.0 EPSF-1.2\n"); - FPRINTF(fptr,"%%%%Creator: %s (L)\n", short_banner); - FPRINTF(fptr,"%%%%Title: %s\n", mfilename); - FPRINTF(fptr,"%%%%RCS-info: $I"); - FPRINTF(fptr,"d$\n"); - FPRINTF(fptr,"%%%%SCCS-info: %%W"); - FPRINTF(fptr,"%% %%E"); - FPRINTF(fptr,"%%\n"); - if (act_bbox) FPRINTF(fptr,"%%%%BoundingBox: "); - else FPRINTF(fptr,"%%%%ProposedBoundings: "); - FPRINTF(fptr," %d %d %d %d\n", - gstoint(tm*72),gstoint(lm*72), - gstoint(tm*72)+gstoint(72*numyunits/scale), - gstoint(lm*72)+gstoint(72*numxunits/scale)); + FPRINTF(fptr,"%%!PS-Adobe-3.0\n"); + FPRINTF(fptr,"%%%%Creator: (%s (L))\n", short_banner); + FPRINTF(fptr,"%%%%Title: (%s)\n", mfilename); + if (act_bbox) + { + FPRINTF(fptr,"%%%%BoundingBox: %d %d %d %d\n", + gstoint(tm*72),gstoint(lm*72), + gstoint(tm*72)+gstoint(72*numyunits/scale), + gstoint(lm*72)+gstoint(72*numxunits/scale)); + } + FPRINTF(fptr,"%%%%Pages: (atend)\n"); FPRINTF(fptr,"%%%%EndComments\n"); common_header(); @@ -652,8 +651,9 @@ static void common_header() #endif { - FPRINTF(fptr,"1 setlinecap\n"); - FPRINTF(fptr,"1 setlinejoin\n"); + FPRINTF(fptr,"%%%%BeginProlog\n"); + FPRINTF(fptr,"%%%%BeginResource: procset vcgutil\n"); + FPRINTF(fptr,"%%%%Version: 1.0 1\n"); /* Position turtle without drawing */ @@ -695,9 +695,22 @@ FPRINTF(fptr,"/SD /setdash load def\n"); - /* Default line thickness is 1 */ + /* Define PDFmarks to be null if unsupported */ + + FPRINTF(fptr,"/pdfmark where\n {pop} {userdict /pdfmark /cleartomark " + "load put} ifelse\n"); - FPRINTF(fptr,"1 LW\n"); + FPRINTF(fptr,"%%%%EndResource\n"); + FPRINTF(fptr,"%%%%EndProlog\n"); + FPRINTF(fptr,"%%%%BeginSetup\n"); + + /* Output document information PDFmark */ + FPRINTF(fptr, + "[ /Title (%s)\n" + " /Creator (%s)\n" + " /DOCINFO pdfmark\n", + mfilename, short_banner); + FPRINTF(fptr,"%%%%EndSetup\n"); } @@ -1285,6 +1298,34 @@ } +/* Insert a pdfmark + * ---------------- + * link target 's' is terminated by character '>' + */ + +#ifdef ANSI_C +void ps_mark(char *s, int minx, int miny, int maxx, int maxy) +#else +void ps_mark(s, minx, miny, maxx, maxy) +char *s; +int minx, miny, maxx, maxy; +#endif +{ + char *e; + for (e=s; *e && *e!='>'; e++); + *e=0; + FPRINTF(fptr, + "[ /Rect [ %d %d %d %d ]\n" + " /Action 2 dict dup begin\n" + " /Subtype /URI def\n" + " /URI (%s) def end\n" + " /Border [ 0 0 0 ]\n" +/* " /Color [ .7 0 0 ]\n" */ + " /Subtype /Link\n" + " /ANN pdfmark\n", + minx-V_xmin, dist - (miny-V_ymin), + maxx-V_xmin, dist - (maxy-V_ymin), s); + *e='>'; +} /*--------------------------------------------------------------------*/ - diff -u -r vcg.1.30/src/PSdevstr.c vcg.1.30-sde/src/PSdevstr.c --- vcg.1.30/src/PSdevstr.c Wed Feb 8 11:35:56 1995 +++ vcg.1.30-sde/src/PSdevstr.c Sat Mar 17 01:40:50 2001 @@ -127,6 +127,7 @@ void ps_line _PP((int fx,int fy,int tx,int ty,int c)); void ps_thickline _PP((int fx,int fy,int tx,int ty,int t,int c)); +void ps_mark _PP((char *s,int minx,int miny,int maxx,int maxy)); #include "drawstr.c" diff -u -r vcg.1.30/src/drawstr.c vcg.1.30-sde/src/drawstr.c --- vcg.1.30/src/drawstr.c Wed Feb 8 11:35:56 1995 +++ vcg.1.30-sde/src/drawstr.c Sat Mar 17 14:52:59 2001 @@ -351,6 +351,8 @@ int i; /* counter for the characters */ int actcolor,underline; int cc; + char *link=NULL; + int lx, ly, lmx; /* link origin */ if (myshrink==0) return; if (gs_stlimit*myshrink>gs_shlimit*mystretch) return; @@ -372,6 +374,8 @@ myxpos = mx + (xcnt * 8 * mystretch) / myshrink; myypos = my + (ycnt * 16 * mystretch) / myshrink; + if (link && (myxpos > lmx)) lmx=myxpos; + /* check visibility */ if ( my + ((ycnt+1) * 16 * mystretch) / myshrink >= V_ymax) return; @@ -426,6 +430,22 @@ myoutchar(cc,actcolor,underline); xcnt++; } + else if (*s=='<') { + lx=lmx=myxpos; + ly=myypos; + link=++s; + while (*s && *s!='>') { + s++; + } + } + else if (*s=='l') { +#ifdef POSTSCRIPT_DEVICE + if (link) ps_mark(link,lx,ly,lmx, + my+((ycnt+1)*16*mystretch) + /myshrink); +#endif + link=NULL; + } else { actcolor = *s-'0'; s++; if (!*s) return; @@ -538,6 +558,10 @@ return; } c++; + } + else if (*ss=='l') break; + else if (*ss=='<') { + while (*ss && *ss!='>') ss++; } else { ss++; if (!*ss) {