diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/pstools/ps_conv |
Initial commit
Diffstat (limited to 'support/pstools/ps_conv')
-rw-r--r-- | support/pstools/ps_conv/0ps_conv.doc | 92 | ||||
l--------- | support/pstools/ps_conv/README | 1 | ||||
-rw-r--r-- | support/pstools/ps_conv/gc.bat | 29 | ||||
-rw-r--r-- | support/pstools/ps_conv/gc.par | 1 | ||||
-rw-r--r-- | support/pstools/ps_conv/gc_head.ps | 32 | ||||
-rw-r--r-- | support/pstools/ps_conv/gc_tail.ps | 4 | ||||
-rw-r--r-- | support/pstools/ps_conv/ps_conv.ps | 286 |
7 files changed, 445 insertions, 0 deletions
diff --git a/support/pstools/ps_conv/0ps_conv.doc b/support/pstools/ps_conv/0ps_conv.doc new file mode 100644 index 0000000000..27cdee656c --- /dev/null +++ b/support/pstools/ps_conv/0ps_conv.doc @@ -0,0 +1,92 @@ +This file belongs to the PS_CONV package. + +----------------------------------------------------------------------------- + +The package PS_CONV belongs to the public domain. You are entitled to do with +the files of which it consists whatever you wish. If you alter a file, +however, please remove the line containing the comment + + `This file belongs to the PS_CONV package.' + +in order to avoid a mess. + +----------------------------------------------------------------------------- + +Authors: P. Pianowski and B. Jackowski +Address: BOP s.c., ul. Piastowska 70, 80-363 Gda\'nsk, Poland + bop@bop.com.pl + +----------------------------------------------------------------------------- + +The kernel of the package is a PostScript program, PS_CONV.PS, for converting +one-page PostScript files into EPS (encapsulated PostScript) files readable +by CorelDRAW!(R), Adobe Illustrator(TM) and Fontographer(R). The current +version is to be used with the Ghostscript interpreter. + +The main features of the current verion of the converter are as follows: + +1) If a multi-page document is supplied, only the first page is processed. +2) Bitmaps are ignored. +3) Fonts are always converted to curves (for Ghostscript ver. < 3 outlines + of the Adobe Type 1 fonts are approximated by polygons). +4) If the size of a converted object differs essentially from A4 page, + an internal parameter of PS_CONV, SCALE (by default SCALE=10), + may require manual tuning. For larger pictures SCALE should be smaller, + otherwise a `numeric exeption' error may occur; for tiny pictures it + can be enlarged. Its value can be passed, e.g., in a command line: + ... -dSCALE=100 ... +5) So far PS_CONV was tested only with Ghostscript interpreter + +----------------------------------------------------------------------------- + +The package consists of the following files: + + 0PS_CONV.DOC this file + PS_CONV.PS the ``engine'' + GC.BAT sample DOS batch file (making use of GS386); + to be adjusted to a particular installation + GC.PAR parameters for Ghostscript for the converting session + GC_HEAD.PS a header, prepended to the result of the conversion + GC_TAIL.PS a trailer, appended to the result of the conversion + +Additionally, SHOWPAGE.PS file is referred to. It belongs to the standard +Ghostscript distribution. + +----------------------------------------------------------------------------- + +LOCATION OF FILES (DOS) + +It is assumed that all the package is placed in the directory C:\PS_CONV. +If another destination place is required, the following files should be +adjusted: + + GC.BAT + GC.PAR + +Ghostscript interpreter is assumed to be in a directory specified by the +DOS environment variable PATH. + +----------------------------------------------------------------------------- + +HISTORY: + +% ver. 0.50, Friday, October 27th, 1995: +% * first official public domain release +% October 30th, 1995: +% * GC.BAT and GC.PAR touched +% ver. 0.52, Wednesday, April 10th, 1996 +% * oper_kind added to degenerated paths (i.e. containing only +% `m' operation) +% * paper format commands neutralized +% * new parameter called ACLEV added; decimal numbers are printed with +% precision PREC (default PREC=3; max. 3 digits follow period) +% ver. 0.53, Friday, November 8th, 1996 +% * the bug in `print_rounded' fixed: numbers of the form `0.0123' i.e. +% with leading zeros following the period were badly printed. +% ver. 0.54, Wednesday, January 5th, 2000 +% * the file `gc_head' has been improved, paths beeng eofilled +% and eoclipped are closed explicity + +----------------------------------------------------------------------------- + +END OF THE 0PS_CONV.DOC FILE diff --git a/support/pstools/ps_conv/README b/support/pstools/ps_conv/README new file mode 120000 index 0000000000..ce0e665d5f --- /dev/null +++ b/support/pstools/ps_conv/README @@ -0,0 +1 @@ +0ps_conv.doc
\ No newline at end of file diff --git a/support/pstools/ps_conv/gc.bat b/support/pstools/ps_conv/gc.bat new file mode 100644 index 0000000000..deafbdc1ef --- /dev/null +++ b/support/pstools/ps_conv/gc.bat @@ -0,0 +1,29 @@ +@echo off +:: DOS batch for converting PS files into ``canonical'' EPS files +:: using Ghostscript +if "%2" == "" goto USAGE +if "%1" == "%2" goto BAD +tm START +echo. +if "%4" == "" goto NOOFF +gs386 @c:/ps_conv/gc.par -dDOS -dXOFF=%3 -dYOFF=%4 ps_conv.ps %1 showpage.ps +goto CONT +:NOOFF +gs386 @c:/ps_conv/gc.par -dDOS ps_conv.ps %1 showpage.ps +:CONT +if exist !ps_exp1.ps goto MERGE +goto END +:MERGE +copy !ps_exp2.ps + c:\ps_conv\gc_head.ps + !ps_exp1.ps + c:\ps_conv\gc_tail.ps %2 /b +:ENDING +del !ps_exp1.ps +del !ps_exp2.ps +:END +echo. +tm STOP +goto DONE +:BAD +echo INPUT AND OUTPUT FILES MUST HAVE DIFFERENT NAMES! +:USAGE +echo USAGE: gc input-file-name output-file-name [X-offset Y-offset] +:DONE diff --git a/support/pstools/ps_conv/gc.par b/support/pstools/ps_conv/gc.par new file mode 100644 index 0000000000..1b92850cd5 --- /dev/null +++ b/support/pstools/ps_conv/gc.par @@ -0,0 +1 @@ +-I.;..;c:/ps_conv/ -sPAPERSIZE=a4 -q -dNODISPLAY -dNOCACHEDEVICE diff --git a/support/pstools/ps_conv/gc_head.ps b/support/pstools/ps_conv/gc_head.ps new file mode 100644 index 0000000000..adac358739 --- /dev/null +++ b/support/pstools/ps_conv/gc_head.ps @@ -0,0 +1,32 @@ +%%BeginProlog +/GSexport 100 dict def GSexport begin +/h {closepath} def +/m {moveto} def +/c {curveto} def +/l {lineto} def +/k {setcmykcolor} def +/K {setcmykcolor} def +/*u {/oper_kind -1 def} def +/*U {*U*f *U*d *U*c} def +/f {closepath /oper_kind 0 def} def +/*U*f {0 oper_kind eq {eofill} if} def +/s {closepath /oper_kind 1 def} def +/S {/oper_kind 1 def} def +/*U*d {1 oper_kind eq {stroke} if} def +/W {} def +/n {closepath /oper_kind 2 def} def +/*U*c {2 oper_kind eq {eoclip newpath} if} def +/w {setlinewidth} def +/j {setlinejoin} def +/J {setlinecap} def +/M {setmiterlimit} def +/d {setdash} def +/setcmykcolor where {pop} + {/setcmykcolor {1 sub /mf exch def + 3 {mf add neg dup 0 lt {pop 0} if 3 1 roll} repeat + setrgbcolor} def} ifelse +/q {gsave} def +/Q {grestore} def +%%EndProlog +%%BeginSetup +%%EndSetup diff --git a/support/pstools/ps_conv/gc_tail.ps b/support/pstools/ps_conv/gc_tail.ps new file mode 100644 index 0000000000..0a620aec76 --- /dev/null +++ b/support/pstools/ps_conv/gc_tail.ps @@ -0,0 +1,4 @@ +%%Trailer +end +showpage + diff --git a/support/pstools/ps_conv/ps_conv.ps b/support/pstools/ps_conv/ps_conv.ps new file mode 100644 index 0000000000..103dc72ac3 --- /dev/null +++ b/support/pstools/ps_conv/ps_conv.ps @@ -0,0 +1,286 @@ +%!PS-Adobe-2.0 +%%Subject: PostScript prolog for converting PostScript files into +%%Subject: a canonical EPS form, acceptable by such programs as +%%Subject: CorelDRAW!(R), Adobe Illustrator(TM) and Fontographer(R). +%%Copyright: (c) BOP s.c. 1993--1999 +%%Public domain +%%Version: 0.54 +%%LastUpdate: Wednesday, January 5th, 2000 +%%BeginProcSet: ps_conv.ps +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Authors: P. Pianowski and B. Jackowski +% Address: BOP s.c., ul. Piastowska 70, 80-363 Gda\'nsk, Poland +% bop@bop.com.pl +% History: +% ver. 0.50, Friday, October 27th, 1995: +% * first official public domain release +% October 30th, 1995: +% * GC.BAT and GC.PAR touched +% ver. 0.52, Wednesday, April 10th, 1996 +% * oper_kind added to degenerated paths (i.e. containing only +% `m' operation) +% * paper format commands neutralized +% * new parameter called PREC added; decimal numbers are printed with +% precision PREC (default PREC=3; max. 3 digits follow period) +% ver. 0.53, Friday, November 8th, 1996 +% * the bug in `print_rounded' fixed: numbers of the form `0.0123' i.e. +% with leading zeros following the period were badly printed. +% ver. 0.54, Wednesday, January 5th, 2000 +% * the file `gc_head' has been improved, paths beeng eofilled +% and eoclipped are closed explicity +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/ExportDict 100 dict def ExportDict begin +% +% command line parameters: +systemdict /SCALE known {/SCALE SCALE def} {/SCALE 10 def} ifelse +systemdict /XOFF known {/XOFF XOFF def} {/XOFF 0 def} ifelse +systemdict /YOFF known {/YOFF YOFF def} {/YOFF 0 def} ifelse +systemdict /DASHED known {/DASHED true def} {/DASHED false def} ifelse +systemdict /DOS known + {/print_new_line {<0D0A> print} def} + {/print_new_line {<0A> print} def} ifelse +systemdict /PREC known {/PREC PREC def} {/PREC 3 def} ifelse +% end of parameters +% +statusdict begin + /letter {} def + /note {} def + /legal {} def + /a3 {} def + /a4 {} def + /a5 {} def + /a6 {} def + /b4 {} def + /b5 {} def + /flsa {} def + /flse {} def + /halfletter {} def + /11x17 {} def + /ledger {} def + /setpageparams {pop pop pop pop} def + /setpage {pop pop pop} def +end +% +/val_str 20 string def +/epsilon 0.001 def +SCALE dup matrix scale setmatrix +/curr_matr matrix currentmatrix def +/default_matr curr_matr def +/xl 100000 def +/yl 100000 def +/xh -100000 def +/yh -100000 def +/save_bb {ExportDict begin xl yl xh yh end} def +/restore_bb {ExportDict begin /yh exch def /xh exch def + /yl exch def /xl exch def end} def +/ori_restore /restore load def +/restore {ExportDict begin save_bb 5 -1 roll ori_restore restore_bb end} def +% +% <x> <y> set_bb <x> <y> +/set_bb {ExportDict begin + dup yl lt {dup /yl exch def} if + dup yh gt {dup /yh exch def} if + exch + dup xl lt {dup /xl exch def} if + dup xh gt {dup /xh exch def} if + exch + end} def +% +/accuracy 10 PREC neg exp def +/accuracy_mask (00000000000000000000000000000000000000000000000) + 0 PREC 1 add getinterval def +/print_rounded {ExportDict begin + dup abs 0.000001 lt {pop (0) print} {accuracy div round + dup abs 16#7FFFFFFF gt {pop (INTEGER OUT of RANGE!\n) ori_print quit} if + cvi + /minus_sign false def dup 0 lt {neg /minus_sign true def} if + % + dup /int_to_pull exch def /dig_to_pull 0 def + {int_to_pull 0 eq {exit} if + /mod_to_pull int_to_pull 10 mod def + mod_to_pull 0 eq {/dig_to_pull dig_to_pull 1 add def + /int_to_pull int_to_pull 10 idiv def} {exit} ifelse} loop + % + /fractional_dig PREC dig_to_pull sub 0 max def + minus_sign {(-) print} if + val_str cvs + % +% dup length PREC le {/leading_zeros accuracy_mask def %% !! ERROR + dup length PREC le {/leading_zeros PREC 1 add string def + leading_zeros 0 accuracy_mask putinterval + % + leading_zeros exch + dup length PREC 1 add exch sub exch putinterval leading_zeros} if + dup dup length PREC sub 0 exch getinterval print + fractional_dig 0 eq {pop} {(.) print + dup length PREC sub fractional_dig getinterval + print} ifelse} ifelse end} def +/print_scaled_x {ExportDict begin SCALE div XOFF sub print_rounded end} def +/print_scaled_y {ExportDict begin SCALE div YOFF sub print_rounded end} def +% +% <s0>..<sn> <r> n_print +/n_print {ExportDict begin -1 1 {-1 roll print_rounded ( ) print} for end} def +% +/p_trans {ExportDict begin /r_param exch def + r_param -1 roll dup /trans_x exch def r_param 1 roll + /r_param r_param 1 sub def + r_param -1 roll dup /trans_y exch def r_param 1 roll + trans_x trans_y curr_matr transform + set_bb + exch + print_scaled_x ( ) print + print_scaled_y ( ) print + end} def +% +/check_point {ExportDict begin + x_1 curr_x sub dup mul + y_1 curr_y sub dup mul add sqrt epsilon ge + end} def +% +/ori_currentcmykcolor /currentcmykcolor load def +/ori_gsave /gsave load def +/ori_grestore /grestore load def +/ori_moveto /moveto load def +/ori_curveto /curveto load def +/ori_lineto /lineto load def +/ori_closepath /closepath load def +% +/my_moveto {ExportDict begin + matrix currentmatrix curr_matr ne {/curr_matr matrix currentmatrix def} if + /y_start exch def + /x_start exch def + /curr_x x_start def + /curr_y y_start def + oper_to_send {oper_kind dup (s) eq {pop (S)} if print print_new_line} if + /oper_to_send true def + curr_x curr_y + 2 p_trans + (m) print print_new_line + ori_moveto + end} def +/my_curveto {ExportDict begin + /y_1 exch def /x_1 exch def + check_point + { + x_1 y_1 + 6 p_trans + 4 p_trans + 2 p_trans + (c) print print_new_line + /curr_x x_1 def + /curr_y y_1 def + } + {x_1 y_1} ifelse + ori_curveto + end} def +/my_lineto {ExportDict begin + /y_1 exch def /x_1 exch def + check_point + { + x_1 y_1 + 2 p_trans + (l) print print_new_line + /curr_x x_1 def + /curr_y y_1 def + } + {x_1 y_1} ifelse + ori_lineto + end} def +/my_closepath {ExportDict begin + curr_x curr_y y_start ne exch x_start ne or + {x_start y_start 2 p_trans (l) print print_new_line ori_lineto} if + oper_kind print print_new_line + /oper_to_send false def + ori_closepath + end} def +/gsave {ExportDict begin (q) print print_new_line ori_gsave end} def +/grestore {ExportDict begin(Q) print print_new_line ori_grestore end} def +% +/show {ExportDict begin + ori_gsave + currentfont [1 0 0 1 0 0] makefont setfont + false charpath currentpoint + (*u) print print_new_line + ori_currentcmykcolor 4 n_print (k) print print_new_line + /oper_kind (f) def /oper_to_send false def + {my_moveto} {my_lineto} {my_curveto} {my_closepath} pathforall + oper_to_send {oper_kind print print_new_line} if + (*U) print print_new_line + ori_grestore + newpath moveto + end} def +/eofill {ExportDict begin + ori_gsave + closepath + (*u) print print_new_line + ori_currentcmykcolor 4 n_print (k) print print_new_line + /oper_kind (f) def /oper_to_send false def + {my_moveto} {my_lineto} {my_curveto} {my_closepath} pathforall + oper_to_send {oper_kind print print_new_line} if + (*U) print print_new_line + ori_grestore newpath + end} def +/eoclip {ExportDict begin + ori_gsave + closepath + (*u) print print_new_line + /oper_kind (h W n) def /oper_to_send false def + {my_moveto} {my_lineto} {my_curveto} {my_closepath} pathforall + oper_to_send {oper_kind print print_new_line} if + (*U) print print_new_line + ori_grestore newpath + end} def +/local_transform{ExportDict begin 0 + default_matr matrix invertmatrix matrix currentmatrix matrix concatmatrix + aload pop pop pop 0 0 6 array astore transform + dup mul exch dup mul add sqrt + end} def +/print_local_transform{ExportDict begin local_transform print_rounded end} def +/n_print_local {ExportDict begin + -1 1 {-1 roll print_local_transform ( ) print} for end} def +/stroke {ExportDict begin + ori_gsave + (*u) print print_new_line + currentlinewidth print_local_transform ( w ) print + currentlinejoin print_rounded ( j ) print + currentlinecap print_rounded ( J ) print + currentmiterlimit local_transform dup 1 lt {pop 1} if print_rounded + ( M ) print + DASHED { + print_new_line + currentdash exch dup length /dashlength exch def + aload pop ([) print dashlength n_print_local (] ) print print_rounded + ( d) print} if + print_new_line + ori_currentcmykcolor 4 n_print (K) print print_new_line + /oper_kind (s) def /oper_to_send false def + {my_moveto} {my_lineto} {my_curveto} {my_closepath} pathforall + oper_to_send {(S) print print_new_line} if + (*U) print print_new_line + ori_grestore newpath + end} def +/fill /eofill load def +/clip /eoclip load def +% +/out_file (!ps_exp1.ps) (w) file def +/showpage {ExportDict begin + out_file flushfile + out_file closefile + /out_file (!ps_exp2.ps) (w) file def + (%!PS-Adobe-2.0 EPSF-2.0) print print_new_line + (%%Creator: GhostScript rev. ) print revision print_rounded print_new_line + (%%BoundingBox: ) print + xl print_scaled_x ( ) print + yl print_scaled_y ( ) print + xh print_scaled_x ( ) print + yh print_scaled_y print_new_line + (%%EndComments) print print_new_line + out_file flushfile + out_file closefile + quit + end} def +/ori_print /print load def +/print {ExportDict begin out_file exch writestring end} def +end +%%EndProcSet: ps_conv.ps +ExportDict begin |