2009/11/13

PostScript forall, aload, get

8.2-ArrayOperators.ps8.2-ArrayOperators-forall.ps8.2-ArrayOperators-aload.ps

 

8.2-ArrayOperators.ps

% --- variables ------------------------
/LM 72 def % Left margin
/Tempstr 30 string def
/nextline-height 50 def
/Helvetica findfont 60 scalefont setfont

% --- procedures -----------------------
/crlf { % next line
    currentpoint nextline-height sub
    exch pop
    LM exch
    moveto
} def

/aryshow {
    /ary exch def
    0 1 ary length 1 sub
    {
        ary exch get
        Tempstr cvs
        show crlf
    } for
} def

% --- main -----------------------------
LM 600 moveto

[
    (mouse)
    27
    /aName
    [
        6
        12
    ]
    { crlf }
    LM
    /Helvetica findfont
]
aryshow
showpage

 

8.2-ArrayOperators-forall.ps 

% --- variables ------------------------
/LM 72 def
/RM 512 def
/ypos 720 def
/lineheight 50 def
/font-size 50 def

% --- procedure ------------------------
/crlf {
    ypos lineheight sub
    /ypos exch def
    LM ypos moveto
} def

/prtstr {
    dup stringwidth pop
    currentpoint pop
    add RM gt
    {
        crlf
    } if
    show
} def

/format {
    {
        prtstr ( ) show
    } forall
} def

% --- main -----------------------------
/Times-Italic findfont font-size scalefont setfont
LM ypos moveto

[(Concience)(is)(inner)(voice)
    (that)(warns)(us)(somebody)(many)(be)
    (looking)( - Mencken)] format

showpage

 

8.2-ArrayOperators-aload.ps

% --- variables ------------------------
/LM 30 def
/font-size 30 def
/line-hight 30 def
/msg (The five boxing wizards jump quickly.) def

% --- procedures ------------------------
/newline {
    currentpoint line-hight sub
    exch pop LM exch
    moveto
} def

/PrintSample {
    aload pop
    findfont font-size scalefont setfont
    show
    newline
} def

/FontList [
    [msg /Helvetica]
    [msg /Times-Roman]
    [msg /Symbol]
] def

% --- main -----------------------------
LM 600 moveto
FontList { PrintSample } forall
showpage

 

 

PostScript(R) Language Tutorial and Cookbook (APL)

PostScript(R) Language Tutorial and Cookbook (APL)

posted with amazlet at 09.10.07

Adobe Systems Inc.
Addison-Wesley Professional
売り上げランキング: 235737

おすすめ度の平均: 5.0

5 まず最初に読むべき入門書
5 効率の良いPostScript書くなら…

Amazon.co.jp で詳細を見る

 

0 件のコメント:

コメントを投稿