📄 postscript.ps
字号:
%!PS-Adobe-1.0%%Title: plain.txt%%Creator: Id: a2ps,v 1.44 1999/03/09 16:12:17 utashiro Exp %%CreationDate: Thu Dec 28 14:47:31 2000%%Pages: (atend)%%PageOrder: Ascend%%DocumentPaperSizes: A4%%Orientation: Landscape%%EndComments/$a2psdict 100 dict def$a2psdict begin% Initialize page description variables./inch {72 mul} bind def%% SelectTraystatusdict /a4tray known { statusdict begin a4tray end } if/landscape true def/twinpage true def/sheetheight 11.64 inch def/sheetwidth 8.27 inch def/lmargin 1.2 inch def/smargin 1.2 inch def/paper_adjust 0.05 inch def/noborder false def/noheader false def/headersize 0.22 inch def/nofooter false def/nopunchmark true def/bodyfontsize 6.6 def/kanjiAsciiRatio 1 def/lines 66 def/columns 86 def/date (Dec 28 2000 14:47) def/doasciimag false def%! PostScript Source Code%% File: imag:/users/local/a2ps/header.ps% Created: Tue Nov 29 12:14:02 1988 by miguel@imag (Miguel Santana)% Version: 2.0% Description: PostScript prolog for a2ps ascii to PostScript program.% % Edit History:% - Original version by evan@csli (Evan Kirshenbaum).% - Modified by miguel@imag to:% 1) Correct an overflow bug when printing page number 10 (operator% cvs).% 2) Define two other variables (sheetwidth, sheetheight) describing% the physical page (by default A4 format).% 3) Minor changes (reorganization, comments, etc).% - Modified by tullemans@apolloway.prl.philips.nl% 1) Correct stack overflows with regard to operators cvs and copy.% The resulting substrings where in some cases not popped off % the stack, what can result in a stack overflow.% 2) Replaced copypage and erasepage by showpage. Page througput% degrades severely (see red book page 140) on our ps-printer% after printing sheet 16 (i.e. page 8) of a file which was % actually bigger. For this purpose the definitions of startdoc% and startpage are changed.% - Modified by Tim Clark <T.Clark@uk.ac.warwick> to:% 1) Print one page per sheet (portrait) as an option.% 2) Reduce size of file name heading, if it's too big.% 3) Save and restore PostScript state at begining/end. It now uses% conventional %%Page %%Trailer markers.% 4) Print one wide page per sheet in landscape mode as an option.% - Modified by miguel@imag.fr to% 1) Add new option to print n copies of a file.% 2) Add new option to suppress heading printing.% 3) Add new option to suppress page surrounding border printing.% 4) Add new option to change font size. Number of lines and columns% are now automatically adjusted, depending on font size and% printing mode used.% 5) Minor changes (best layout, usage message, etc).% - Modified by kanazawa@sra.co.jp to:% 1) Handle Japanese code% - Modified by utashiro@sra.co.jp to:% 1) Fix bug in printing long label% 2) Handle carriage-return% 3) Specify kanji-ascii character retio% 4) Add footer label% 5) Change filename->fname becuase ghostscript has operator filename% 6) Support three different font style% 7) Incorporate B4 paper support and punchmark contributed% by Masami Ueno <cabbage@kki.esi.yamanashi.ac.jp>%% Copyright (c) 1988, Miguel Santana, miguel@imag.imag.fr%% Permission is granted to copy and distribute this file in modified% or unmodified form, for noncommercial use, provided (a) this copyright% notice is preserved, (b) no attempt is made to restrict redistribution% of this file, and (c) this file is not distributed as part of any% collection whose redistribution is restricted by a compilation copyright.%% General macros./xdef {exch def} bind def/getfont {exch findfont exch scalefont} bind def% Page description variables and inch function are defined by a2ps program.% Character size for differents fonts. landscape { /filenamefontsize 12 def } { /filenamefontsize 16 def }ifelse/datefontsize filenamefontsize 0.8 mul def/headermargin filenamefontsize 0.25 mul def/bodymargin bodyfontsize 0.7 mul def% Font assignment to differents kinds of "objects"/filenamefontname /Helvetica-Bold def/stdfilenamefont filenamefontname filenamefontsize getfont def/datefont /Helvetica datefontsize getfont def/footerfont /Helvetica-Bold datefontsize getfont def/mag { doasciimag { [ 1 0 0 asciimagsize 0 0 ] makefont } if } def/bodynfont /Courier bodyfontsize getfont mag def/bodybfont /Courier-Bold bodyfontsize getfont mag def/bodyofont /Courier-BoldOblique bodyfontsize getfont mag def/fontarray [ bodynfont bodybfont bodyofont ] def/bodyfont bodynfont def% Initializing kanji fonts/kanji_initialized false def/kanji_init { kanji_initialized not { /bodykfontsize bodyfontsize kanjiAsciiRatio mul def /bodyknfont /Ryumin-Light-H bodykfontsize getfont def /bodykbfont /GothicBBB-Medium-H bodykfontsize getfont def /bodykofont bodykbfont [ 1 0 .2 1 0 0 ] makefont def /KanjiRomanDiff 1.2 bodyfontsize mul 1.0 bodykfontsize mul sub def /KanjiRomanDiffHalf KanjiRomanDiff 2 div def /kfontarray [ bodyknfont bodykbfont bodykofont ] def /kanji_initialized true def } if} def% Backspace width/backspacewidth bodyfont setfont (0) stringwidth pop def% Logical page attributs (a half of a real page or sheet)./pagewidth bodyfont setfont (0) stringwidth pop columns mul bodymargin dup add add def/pageheight bodyfontsize 1.1 mul lines mul bodymargin dup add add headersize add def% Coordinates for upper corner of a logical page and for sheet number.% Coordinates depend on format mode used.% In twinpage mode, coordinate x of upper corner is not the same for left% and right pages: upperx is an array of two elements, indexed by sheetside./rightmargin smargin 3 div def/leftmargin smargin 2 mul 3 div def/topmargin lmargin twinpage {3} {2} ifelse div deflandscape{ % Landscape format /punchx .4 inch def % for PunchMark /punchy sheetwidth 2 div def % for PunchMark /uppery rightmargin pageheight add bodymargin add def /sheetnumbery sheetwidth leftmargin pageheight add datefontsize add sub def twinpage { % Two logical pages /upperx [ topmargin 2 mul % upperx for left page dup topmargin add pagewidth add % upperx for right page ] def /sheetnumberx sheetheight topmargin 2 mul sub def } { /upperx [ topmargin dup ] def /sheetnumberx sheetheight topmargin sub datefontsize sub def } ifelse}{ % Portrait format /punchx .3 inch def /punchy sheetheight 2 div def /uppery topmargin pageheight add def /upperx [ leftmargin dup ] def /sheetnumberx sheetwidth rightmargin sub datefontsize sub def /sheetnumbery sheetheight topmargin pageheight add datefontsize add headermargin add sub def}ifelse% Strings used to make easy printing numbers/pnum 12 string def/empty 12 string def% Other initializations.datefont setfont/datewidth date stringwidth pop def/pagenumwidth (Page 999) stringwidth pop def/filenameroom pagewidth filenamefontsize 4 mul datewidth add pagenumwidth add sub def% Function startdoc: initializes printer and global variables./startdoc { /sheetside 0 def % sheet side that contains current page } bind def% Function setlabel: initialize label in header/setlabel { stdfilenamefont setfont /fname xdef /filenamewidth fname stringwidth pop def /filenamefont filenamewidth filenameroom gt { filenamefontname filenamefontsize filenameroom mul filenamewidth div getfont } { stdfilenamefont } ifelse def } bind def% Function printpage: Print a physical page./printpage { /sheetside 0 def twinpage { sheetnumber } { noheader noborder not and { sheetnumber } if } ifelse showpage % pagesave restore% /sheet sheet 1 add def } bind def% Function cleanup: terminates printing, flushing last page if necessary./cleanup { twinpage sheetside 1 eq and { printpage } if } bind def%% Function startpage: prints page header and page border and initializes% printing of the file lines. Page number is stored on the top of stack,% and file name is next./startpage { /pagenum exch def sheetside 0 eq { % /pagesave save def landscape { sheetwidth 0 inch translate % new coordinates system origin 90 rotate % landscape format paper_adjust neg 0 translate } if } if noborder not { printborder } if noheader not { printheader } if nofooter not { printfooter } if nopunchmark not { punchmark } if upperx sheetside get bodymargin add uppery bodymargin bodyfontsize add noheader {0} {headersize} ifelse add sub moveto } bind def% Function printheader: prints page header./printheader { upperx sheetside get uppery headersize sub 1 add moveto datefont setfont gsave datefontsize headermargin rmoveto date show % date/hour grestore gsave pagenum pnum cvs pop pagewidth pagenumwidth sub headermargin rmoveto (Page ) show pnum show % page number grestore empty pnum copy pop gsave filenamefont setfont filenameroom fname stringwidth pop sub 2 div datewidth add filenamefontsize 2 mul add headermargin rmoveto fname show % file name grestore } bind def% Function printfooter: prints page footer./printfooter { upperx 0 get sheetnumbery moveto footerfont setfont fname show } bind def% Function printborder: prints border page./printborder { upperx sheetside get uppery moveto gsave % print the four sides pagewidth 0 rlineto % of the square 0 pageheight neg rlineto pagewidth neg 0 rlineto closepath stroke grestore noheader not { 0 headersize neg rmoveto pagewidth 0 rlineto stroke } if } bind def% Punch Marker/punchmark { gsave newpath punchx punchy moveto punchx 2 add punchy -0.5 add lineto punchx 2 add punchy 0.5 add lineto punchx punchy lineto closepath 0 setgray .8 setlinewidth stroke grestore } bind def%% Function endpage: adds a sheet number to the page (footnote) and prints% the formatted page (physical impression). Activated at the end of each% source page (lines reached or FF character)./endpage { twinpage sheetside 0 eq and { /sheetside 1 def } { printpage } ifelse } bind def% Function sheetnumber: prints the sheet number./sheetnumber { sheetnumberx sheetnumbery moveto datefont setfont sheet pnum cvs dup stringwidth pop (0) stringwidth pop sub neg 0 rmoveto show empty pnum copy pop } bind def% Function bs: go back one character width to emulate BS/bs { backspacewidth neg 0 rmoveto } bind def% Function s: print a source string/s { fontarray fonttype get setfont show } bind def% Function ks: print a kanji source string/ks { kfontarray fonttype get setfont KanjiRomanDiffHalf 0 rmoveto KanjiRomanDiff 0 3 -1 roll ashow KanjiRomanDiffHalf neg 0 rmoveto } def% Function bl: beginning of line/bl { gsave } bind def% Function nl: newline/nl { grestore 0 bodyfontsize 1.1 mul neg rmoveto } bind def% Function cr: carriage return/cr { grestore } bind def% Function hlr: half-line up/hlr { 0 bodyfontsize 0.55 mul rmoveto } bind def% Function hlr: half-line down/hlf { 0 bodyfontsize 0.55 mul neg rmoveto } bind def% Function hlr: half-character backward/hcr { backspacewidth 2 div neg 0 rmoveto } bind def% Function hlr: half-character forward/hcf { backspacewidth 2 div 0 rmoveto } bind def/R { /fonttype 0 def } bind def/B { /fonttype 1 def } bind def/I { /fonttype 2 def } bind defR/docsave save defstartdoc%%EndProlog%%Page: 1 1/sheet 1 def(plain.txt) setlabel1 startpagebl ( ) s (Test for Namazu) s nlbl ( ) s nlbl ( ) s (Namazu is a full-text search system intended for easy) s nlbl ( ) s (use. This file is for testing.) s nlbl ( ) s nlbl ( ) s (test@namazu.org) s nlendpagecleanup%%Trailerdocsave restore end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -