%! % start user definition % % < X unit length (point) > % /SYS_Char {72.00 10 div} def % % < Y unit length (point) > % /SYS_Line {72.00 6 div} def % % < X bias (Char) > % /SYS_Xbias {2 SYS_Char mul} def % % < Y bias (Line) > % /SYS_Ybias {-2 SYS_Line mul} def % % < max printable width (Char) > % /SYS_MaxWidth 80 def % % < max printable height (Line) > % /SYS_MaxHeight 66 def % % end user definition % %---------------------------------------------------------------------- % % start system definition % % CHAR c2p ... convert Char to point % /c2p { /SYS_c2p_CHAR_X exch def SYS_c2p_CHAR_X SYS_Char mul SYS_Xbias add } def % % LINE l2p ... convert Line to point % /l2p { /SYS_l2p_LINE_Y exch def SYS_MaxHeight SYS_Line mul SYS_Ybias sub SYS_l2p_LINE_Y SYS_Line mul sub } def % % DASH setLineStyle (DASH is 0 or 1 or ... ) % /setLineStyle { /SYS_setLineStyle_DASH exch def 0 SYS_setLineStyle_DASH eq {[] 0 setdash} {[SYS_setLineStyle_DASH] 0 setdash} ifelse } def % % GRAY setGrayScale (GRAY is 0 to 1) % /setGrayScale { setgray } def % % X0 Y0 X1 Y1 WIDTH drawLine % /drawLine { /SYS_drawLine_WIDTH exch def /SYS_drawLine_Y1 exch def /SYS_drawLine_X1 exch def /SYS_drawLine_Y0 exch def /SYS_drawLine_X0 exch def newpath SYS_drawLine_WIDTH setlinewidth SYS_drawLine_X0 c2p SYS_drawLine_Y0 l2p moveto SYS_drawLine_X1 c2p SYS_drawLine_Y1 l2p lineto stroke } def % % X0 Y0 X1 Y1 WIDTH XDELTA YDELTA REPEAT drawRepeatLine % /drawRepeatLine { /SYS_drawRepeatLine_REPEAT exch def /SYS_drawRepeatLine_YDELTA exch def /SYS_drawRepeatLine_XDELTA exch def /SYS_drawRepeatLine_WIDTH exch def /SYS_drawRepeatLine_Y1 exch def /SYS_drawRepeatLine_X1 exch def /SYS_drawRepeatLine_Y0 exch def /SYS_drawRepeatLine_X0 exch def SYS_drawRepeatLine_REPEAT { SYS_drawRepeatLine_X0 SYS_drawRepeatLine_Y0 SYS_drawRepeatLine_X1 SYS_drawRepeatLine_Y1 SYS_drawRepeatLine_WIDTH drawLine SYS_drawRepeatLine_X0 SYS_drawRepeatLine_XDELTA add /SYS_drawRepeatLine_X0 exch def SYS_drawRepeatLine_Y0 SYS_drawRepeatLine_YDELTA add /SYS_drawRepeatLine_Y0 exch def SYS_drawRepeatLine_X1 SYS_drawRepeatLine_XDELTA add /SYS_drawRepeatLine_X1 exch def SYS_drawRepeatLine_Y1 SYS_drawRepeatLine_YDELTA add /SYS_drawRepeatLine_Y1 exch def } repeat } def % % X0 Y0 X1 Y1 WIDTH drawBox % /drawBox { /SYS_drawBox_WIDTH exch def /SYS_drawBox_Y1 exch def /SYS_drawBox_X1 exch def /SYS_drawBox_Y0 exch def /SYS_drawBox_X0 exch def SYS_drawBox_X0 SYS_drawBox_Y0 SYS_drawBox_X0 SYS_drawBox_Y1 SYS_drawBox_WIDTH drawLine SYS_drawBox_X0 SYS_drawBox_Y1 SYS_drawBox_X1 SYS_drawBox_Y1 SYS_drawBox_WIDTH drawLine SYS_drawBox_X1 SYS_drawBox_Y1 SYS_drawBox_X1 SYS_drawBox_Y0 SYS_drawBox_WIDTH drawLine SYS_drawBox_X1 SYS_drawBox_Y0 SYS_drawBox_X0 SYS_drawBox_Y0 SYS_drawBox_WIDTH drawLine } def % % X0 Y0 X1 Y1 fillBox % /fillBox { /SYS_fillBox_Y1 exch def /SYS_fillBox_X1 exch def /SYS_fillBox_Y0 exch def /SYS_fillBox_X0 exch def newpath SYS_fillBox_X0 c2p SYS_fillBox_Y0 l2p moveto SYS_fillBox_X0 c2p SYS_fillBox_Y1 l2p lineto SYS_fillBox_X1 c2p SYS_fillBox_Y1 l2p lineto SYS_fillBox_X1 c2p SYS_fillBox_Y0 l2p lineto closepath fill } def % % POINT FONT setChar % /FONT_NORMAL 0 def /FONT_ITALIC 1 def /FONT_BOLD 2 def /FONT_BOLDITALIC 3 def % /setChar { /SYS_setChar_FONT exch def /SYS_setChar_POINT exch def SYS_setChar_FONT FONT_NORMAL eq {/Courier findfont} if SYS_setChar_FONT FONT_ITALIC eq {/Courier_Italic findfont} if SYS_setChar_FONT FONT_BOLD eq {/Courier_Bold findfont} if SYS_setChar_FONT FONT_BOLDITALIC eq {/Courier_BoldItalic findfont} if SYS_setChar_POINT scalefont setfont } def % % POINT KFONT setKanjiChar % /KFONT_RYUMIN 0 def /KFONT_RYUMIN_V 1 def /KFONT_GOTHIC 2 def /KFONT_GOTHIC_V 3 def % /setKanjiChar { /SYS_setKanjiChar_KFONT exch def /SYS_setKanjiChar_POINT exch def SYS_setKanjiChar_KFONT KFONT_RYUMIN eq {/Ryumin-Light-H findfont} if SYS_setKanjiChar_KFONT KFONT_RYUMIN_V eq {/Ryumin-Light-V findfont} if SYS_setKanjiChar_KFONT KFONT_GOTHIC eq {/GothicBBB-Medium-H findfont} if SYS_setKanjiChar_KFONT KFONT_GOTHIC_V eq {/GothicBBB-Medium-V findfont} if SYS_setKanjiChar_POINT scalefont setfont } def % % X Y (TEXT) drawText % X Y drawText % /drawText { /SYS_drawText_TEXT exch def /SYS_drawText_Y exch def /SYS_drawText_X exch def SYS_drawText_X c2p SYS_drawText_Y 1 add l2p moveto SYS_drawText_TEXT show } def % % end system definition % %---------------------------------------------------------------------- % % % overlay mesh on A4, portrait paper % % set mesh gray scale % .8 setGrayScale % % set 0 to OV_LINE % /OV_LINE 0 def % % repeat 33 times { ... } % 33 { % % overlay mesh on (0,OV_LINE)-(80,OV_LINE+1) rectangle % 0 OV_LINE 80 OV_LINE 1 add fillBox % % down mesh to 2 line % OV_LINE 2 add % % set OV_LINE % /OV_LINE exch def } repeat % % reset gray scale % 0 setGrayScale % % % 12 FONT_NORMAL setChar 0 0 (prov-1.0 -- print overlay utilities) drawText 0 1 (Copyright \(C\) 2003 Masahiko Ito) drawText 0 3 (These programs is free software; you can redistribute it and/or modify) drawText 0 4 (it under the terms of the GNU General Public License as published by) drawText 0 5 (the Free Software Foundation; either version 2 of the License, or) drawText 0 6 (\(at your option\) any later version.) drawText 0 8 (These programs is distributed in the hope that it will be useful,) drawText 0 9 (but WITHOUT ANY WARRANTY; without even the implied warranty of) drawText 0 10 (MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) drawText 0 11 (GNU General Public License for more details.) drawText 0 13 (You should have received a copy of the GNU General Public License) drawText 0 14 (along with these programs; if not, write to the Free Software) drawText 0 15 (Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA) drawText 0 17 (Mail suggestions and bug reports for these programs to) drawText 0 18 (m-ito@mbox.kyoto-inet.or.jp) drawText 0 20 (What is prov ?) drawText 0 21 (==============) drawText 2 23 (This is form overlay printing tool on UNIX-like systems.) drawText 0 25 (prerequisite) drawText 0 26 (============) drawText 2 28 (You must be able to print postscript file.) drawText 0 30 (Install) drawText 0 31 (=======) drawText 2 33 (o edit Makefile to set install directory to PROVDIR macro) drawText 4 34 (default install directory is ~/prov.) drawText 2 35 (o make) drawText 2 36 (o make install) drawText 2 37 (o edit ~/.profile to set install directory to PROVDIR environment variable.) drawText 2 38 (o edit ~/.profile to set ${PROVDIR}/bin to PATH environment variable.) drawText 0 40 (Sample print\(1\)) drawText 0 41 (===============) drawText 2 43 (prov -text mesh.ov README | lpr -Pps-printer) drawText 2 45 (or) drawText 2 47 (cat README | prov -text mesh.ov - | lpr -Pps-printer) drawText 2 49 (above operation printout README\(this document\) overlayed) drawText 2 50 (mesh.ov\(mesh overlay definition\) from ps-printer.) drawText 0 52 (Sample print\(2\)) drawText 0 53 (===============) drawText 2 55 (prov -csv table.ov member.def member.dat | lpr -Pps-printer) drawText 2 57 (or) drawText 2 59 (cat member.dat | prov -csv table.ov member.def - | lpr -Pps-printer) drawText 2 61 (above operation printout member.dat\(csv data file\) formatted by) drawText 2 62 (member.def\(format definition\) and overlayed table.ov\(table overlay) drawText 2 63 (definition\) from ps-printer.) drawText 0 65 (Adjust setting) drawText showpage % % overlay mesh on A4, portrait paper % % set mesh gray scale % .8 setGrayScale % % set 0 to OV_LINE % /OV_LINE 0 def % % repeat 33 times { ... } % 33 { % % overlay mesh on (0,OV_LINE)-(80,OV_LINE+1) rectangle % 0 OV_LINE 80 OV_LINE 1 add fillBox % % down mesh to 2 line % OV_LINE 2 add % % set OV_LINE % /OV_LINE exch def } repeat % % reset gray scale % 0 setGrayScale % % % 12 FONT_NORMAL setChar 0 0 (==============) drawText 2 2 (You can adjust setting by editing ${PROVDIR}/etc/a4v.ps.) drawText 0 4 (% start user definition) drawText 0 5 (%------------------------------------------------------------------) drawText 0 6 (% < X unit length \(point\) >) drawText 0 7 (%) drawText 0 8 (% default is 72/10 point \(=1/10 inch\).) drawText 0 9 (%) drawText 0 10 (/SYS_Char {72.00 10 div} def) drawText 0 11 (%) drawText 0 12 (%------------------------------------------------------------------) drawText 0 13 (% < Y unit length \(point\) >) drawText 0 14 (%) drawText 0 15 (% default is 72/6 point \(=1/6 inch\).) drawText 0 16 (%) drawText 0 17 (/SYS_Line {72.00 6 div} def) drawText 0 18 (%) drawText 0 19 (%------------------------------------------------------------------) drawText 0 20 (% < X bias \(Char\) >) drawText 0 21 (%) drawText 0 22 (% move page to right : plus value) drawText 0 23 (% move page to left : minus value) drawText 0 24 (%) drawText 0 25 (% for FUJITSU XL-5340) drawText 0 26 (%/SYS_Xbias {2 SYS_Char mul} def) drawText 0 27 (%) drawText 0 28 (/SYS_Xbias {0 SYS_Char mul} def) drawText 0 29 (%) drawText 0 30 (%------------------------------------------------------------------) drawText 0 31 (% < Y bias \(Line\) >) drawText 0 32 (% ) drawText 0 33 (% move page to down : plus value) drawText 0 34 (% move page to up : minus value) drawText 0 35 (%) drawText 0 36 (% for FUJITSU XL-5340) drawText 0 37 (%/SYS_Ybias {-2 SYS_Line mul} def) drawText 0 38 (%) drawText 0 39 (/SYS_Ybias {0 SYS_Line mul} def) drawText 0 40 (%) drawText 0 41 (%------------------------------------------------------------------) drawText 0 42 (% < max printable width \(Char\) >) drawText 0 43 (%) drawText 0 44 (/SYS_MaxWidth 80 def) drawText 0 45 (%) drawText 0 46 (%------------------------------------------------------------------) drawText 0 47 (% < max printable height \(Line\) >) drawText 0 48 (%) drawText 0 49 (/SYS_MaxHeight 66 def) drawText 0 50 (%) drawText 0 51 (%------------------------------------------------------------------) drawText 0 52 (% end user definition) drawText 0 54 (Customize) drawText 0 55 (=========) drawText 1 57 (In default ${PROVDIR}/etc/a4v.ps is for A4-porrait paper. if you want to) drawText 1 58 (use another paper, copy ${PROVDIR}/etc/a4v.ps to another.ps and edit it and) drawText 1 59 (set path to another.ps into PROVPS\(environment variable\).) drawText 1 61 (ex. ) drawText 2 63 (o cp ${PROVDIR}/etc/a4v.ps ./another.ps) drawText 2 64 (o vi ./another.ps # edit for another paper) drawText 2 65 (o PROVPS=./another.ps prov -text foo.ov foo.txt | lpr -Pps-printer) drawText showpage % % overlay mesh on A4, portrait paper % % set mesh gray scale % .8 setGrayScale % % set 0 to OV_LINE % /OV_LINE 0 def % % repeat 33 times { ... } % 33 { % % overlay mesh on (0,OV_LINE)-(80,OV_LINE+1) rectangle % 0 OV_LINE 80 OV_LINE 1 add fillBox % % down mesh to 2 line % OV_LINE 2 add % % set OV_LINE % /OV_LINE exch def } repeat % % reset gray scale % 0 setGrayScale % % % 12 FONT_NORMAL setChar 0 1 (Overlay definition) drawText 0 2 (==================) drawText 2 4 (You can use following postscript macro to define overlay.) drawText 2 6 (o DASH setLineStyle \(DASH is 0 or 1 or ... \)) drawText 4 8 (set line style \(solid, dash etc\). DASH=0 mean solid line, DASH>=1 mean dash line.) drawText 2 10 (o GRAY setGrayScale \(GRAY is 0 to 1\)) drawText 4 12 (set gray scale. 0=black -> 0.5=gray -> 1=white.) drawText 2 14 (o X0 Y0 X1 Y1 WIDTH drawLine) drawText 4 16 (draw line between \(X0,Y0\) to \(X1,Y1\) with WIDTH width.) drawText 4 17 (\(X0,Y0\),\(X1,Y1\) are \(character,line\) coordinate.) drawText 4 18 (WIDTH is point.) drawText 2 20 (o X0 Y0 X1 Y1 WIDTH XDELTA YDELTA REPEAT drawRepeatLine) drawText 4 22 (repeat to draw line from \(X0,Y0\)-\(X1,Y1\) REPEAT times with increasing XDELTA and YDELTA.) drawText 2 24 (o X0 Y0 X1 Y1 WIDTH drawBox) drawText 4 26 (draw box with WIDTH width.) drawText 2 28 (o X0 Y0 X1 Y1 fillBox) drawText 4 30 (draw box and fill inside.) drawText 2 32 (o POINT FONT_NORMAL setChar) drawText 10 33 (FONT_ITALIC) drawText 10 34 (FONT_BOLD) drawText 10 35 (FONT_BOLDITALIC) drawText 4 37 (set ank charset.) drawText 2 39 (o POINT KFONT_RYUMIN setKanjiChar) drawText 10 40 (KFONT_RYUMIN_V) drawText 10 41 (KFONT_GOTHIC) drawText 10 42 (KFONT_GOTHIC_V) drawText 4 44 (set kanji charset.) drawText 2 46 (o X Y \(TEXT\) drawText) drawText 4 48 (draw text with ank charset. \(X,Y\) mean \(left,top\) of charcter.) drawText 2 50 (o X Y drawText) drawText 4 52 (draw text with kanji charset. \(X,Y\) mean \(left,top\) of charcter.) drawText 0 54 (format definition) drawText 0 55 (=================) drawText 2 57 (format print layout from csv data file. each line of format definition) drawText 2 58 (is defined like following.) drawText 2 60 (o record_no field_no point column line) drawText 4 62 (record_no : set record number. usually record_no is 1, but a page is ) drawText 16 63 (formatted from multi record, over 2 are used too.) drawText 4 64 (field_no : set field number from csv data file record.) drawText 4 65 (point : set character point.) drawText showpage % % overlay mesh on A4, portrait paper % % set mesh gray scale % .8 setGrayScale % % set 0 to OV_LINE % /OV_LINE 0 def % % repeat 33 times { ... } % 33 { % % overlay mesh on (0,OV_LINE)-(80,OV_LINE+1) rectangle % 0 OV_LINE 80 OV_LINE 1 add fillBox % % down mesh to 2 line % OV_LINE 2 add % % set OV_LINE % /OV_LINE exch def } repeat % % reset gray scale % 0 setGrayScale % % % 12 FONT_NORMAL setChar 4 0 (column : set print column position.) drawText 4 1 (line : set print line position.) drawText 2 3 (field separater of format definition file is TAB.) drawText 0 5 (csv data file) drawText 0 6 (=============) drawText 2 8 (o field separater of csv data file is TAB.) drawText 2 9 (o a field can't hold ank/kanji together.) drawText 0 11 (-- ) drawText 0 12 (Masahiko Ito ) drawText 0 13 (http://myh.no-ip.org/~prov/) drawText showpage