Catakig/More-Resources/IbsenUtils.ps

189 lines
4.4 KiB
PostScript

%-----------------------------------------------------------------------------
/kfItalics 16#001 def
/kfUnderline 16#002 def
/kfExpanded 16#004 def
/kfExpanded1L 16#008 def
/kfCompressed 16#010 def
/kfEmphasized 16#020 def
/kfElite 16#040 def
/kfDblStrike 16#080 def
/kfSubscript 16#100 def
/kfSuperscript 16#200 def
/Scale 30 def
/Inch 72 Scale mul def
/PageHeight Inch 11 mul def
/CR-implies-LF false def
/ToFontCode 16#300 string def
0 1 16#2FF {
ToFontCode exch dup
16#003 and
<00 04 04 04> 2 index -2 bitshift 3 and get or
<00 18 08 08 10 10 10 10> 2 index -4 bitshift 7 and get or %??
<00 20 40 40 60 60> 2 index -7 bitshift get or
put
} for
/BlessString % string -- string
{
dup 0 EscChar put % T0 esc code
dup 1 ToFontCode Style get put
} def
/G % sData nDotsPerHorizInch --
{
Inch exch idiv exch 0 exch
dup 0 EscChar put % T0 esc code
dup 1 128 put % number of the graphics font!!
ashow
} def
/Down % nDeltaY --
{
neg 0 exch rmoveto
CurrentY PageHeight -1 {
pop 0 PageHeight rmoveto gsave showpage grestore
} for
} def
/SetFormLength % nY --
{ % incomplete!!
pop
} def
/ClampX % --
{
currentpoint exch cvi
dup LMargin lt {pop LMargin} if
dup RMargin gt {pop RMargin} if
exch moveto
} def
/C-I % nReps --
{ % temporary!!
TabWidth mul CurrentX TabWidth mod sub 0 rmoveto
ClampX
} def
/CurrentX {currentpoint pop cvi} def % -- nX
/CurrentY {currentpoint exch pop cvi} def % -- nY
/TurnOff {not Style and /Style exch def} def % nFlags --
/TurnOn { Style or /Style exch def} def % nFlags --
/T {BlessString show} def % string --
/CR {LMargin CurrentY moveto} def % --
/SpcWidth {(-- ) BlessString stringwidth pop mul} def % nSpaces -- width
/G0 { 60 G} def % sData --
/G1 {120 G} def % sData --
/G2 {120 G} def % sData --
/G3 {240 G} def % sData --
/G4 { 80 G} def % sData --
/G6 { 90 G} def % sData --
/E-4 {kfItalics TurnOn} def % --
/E-5 {kfItalics TurnOff} def % --
/E--1 {kfUnderline TurnOn} def % --
/E--0 {kfUnderline TurnOff} def % --
/E-E {kfEmphasized TurnOn} def % --
/E-F {kfEmphasized TurnOff} def % --
/E-G {kfDblStrike TurnOn} def % --
/E-H {kfDblStrike TurnOff} def % --
/C-O {kfCompressed TurnOn} def % --
/C-R {kfCompressed TurnOff} def % --
/C-N {kfExpanded1L TurnOn} def % --
/C-T {kfExpanded1L TurnOff} def % --
/E-W1 {kfExpanded TurnOn} def % --
/E-W0 {kfExpanded kfExpanded1L or TurnOff} def % --
/E-M {kfElite TurnOn} def % --
/E-P {kfElite TurnOff} def % --
/E-S0 {kfSuperscript TurnOn kfSubscript TurnOff} def % --
/E-S1 {kfSubscript TurnOn kfSuperscript TurnOff} def % --
/E-T {kfSuperscript kfSubscript or TurnOff} def % --
/E-3 {Scale mul 3 idiv /LFDY exch def} def % n-216ths-inch --
/E-A {Scale mul /LFDY exch def} def % n-72nds-inch --
/E-0 { 9 E-A} def % --
/E-1 { 7 E-A} def % --
/E-2 {12 E-A} def % --
/E-J {Scale mul 3 idiv Down} def % n-216ths-inch --
/C-J {LFDY mul Down} def % nReps --
%/E-f1 {LFDY mul Down} def % nLines --
% None of these work yet!!
/C-K {pop} def % nReps --
/E-O { } def % --
/E-N {pop} def % nLines --
/E-e0 {pop} def % n --
/E-e1 {pop} def % n --
/E-f0 {pop} def % n --
/C-H {SpcWidth neg 0 rmoveto ClampX} def % nReps --
/E-l {SpcWidth /LMargin exch def} def % nSpaces --
/E-Q {SpcWidth /RMargin exch def} def % nSpaces --
/E-C {LFDY mul SetFormLength} def % nLines --
/E-C0 {Inch mul SetFormLength} def % nInches --
/C-M % nReps --
{
kfExpanded1L TurnOff
CR
CR-implies-LF {C-J} {pop} ifelse
} def
/C-L % nReps --
{
{showpage} repeat
CurrentX 780 Scale mul moveto % 780 pt == 65 standard lines
% 0 or CurrentX ??
} def
/Reset % --
{
/TabWidth Inch 4 mul 5 idiv def % fixed-size tabs!!
% /TabStops <00 08 10 18 20 28 30 38 40 48 50 58 60 68> def %??
% 0 E-l 80 E-Q
/LMargin 0 def
/RMargin 8 Inch mul def
/Style 0 def
E-2 %E-O
} def
/BeginDocument % --
{
18 4 translate
0 780 moveto
1. Scale div dup scale
/Ibsen findfont /T0Font get 10 Scale mul scalefont setfont
currentfont begin userdict begin
Reset
} def
/EndDocument % --
{
showpage
end end
/pdfmark where { pop [
/Creator (Catakig 2)
/Producer (http://catakig.sourceforge.net/)
/DOCINFO pdfmark } if
/setdistillerparams where { pop <<
%/CompatibilityLevel 1.4
%/NeverEmbed [/Courier]
%/EmbedAllFonts true
/SubsetFonts true
/CompressFonts true
/CompressPages true
>> setdistillerparams } if
} def
%-----------------------------------------------------------------------------