📄 ps2ascii.ps
字号:
8#010 /Phi
8#011 /Psi
8#012 /Omega
8#013 /ff
8#014 /fi
8#015 /fl
8#016 /ffi
8#017 /ffl
8#020 /dotlessi
8#021 /dotlessj
8#022 /grave
8#023 /acute
8#024 /caron
8#025 /breve
8#026 /macron
8#027 /ring
8#030 /cedilla
8#031 /germandbls
8#032 /ae
8#033 /oe
8#034 /oslash
8#035 /AE
8#036 /OE
8#037 /Oslash
8#040 /polishslash
8#042 /quotedblright
8#074 /exclamdown
8#076 /questiondown
8#134 /quotedblleft
8#137 /dotaccent
8#173 /endash
8#174 /emdash
8#175 /hungarumlaut
8#177 /dieresis
OT1.encode
%%* And add a few characters from the OT1Encoding
mark
/Gamma (\\Gamma )
/Delta (\\Delta )
/Theta (\\Theta )
/Lambda (\\Lambda )
/Xi (\\Xi )
/Pi (\\Pi )
/Sigma (\\Sigma )
/Upsilon (\\Upsilon )
/Phi (\\Phi )
/Psi (\\Psi )
/Omega (\\Omega )
/dotlessj (j)
/ff (ff)
/cwm ()
/perthousandzero (0)
/polishslash ()
/Abreve (A*)
/Aogonek (A,)
/Cacute (C')
/Ccaron (C^)
/Dcaron (D^)
/Ecaron (E^)
/Eogonek (E,)
/Gbreve (G*)
/Lacute (L')
/Lcaron (L^)
/Nacute (N')
/Ncaron (N^)
/Eng (NG)
/Ohungarumlaut (O"")
/Racute (R')
/Rcaron (R^)
/Sacute (S')
/Scaron (S^)
/Scedilla (S,)
/Tcaron (T^)
/Tcedilla (T,)
/Uhungarumlaut (U"")
/Uring (U*)
/Ydieresis (Y")
/Zacute (Z')
/Zcaron (Z^)
/Zdot (Z.)
/IJ (IJ)
/Idot (I.)
/dbar (d-)
/abreve (a*)
/aogonek (a,)
/cacute (c')
/ccaron (c^)
/dcaron (d^)
/ecaron (e^)
/eogonek (e,)
/gbreve (g*)
/lacute (l')
/lcaron (l^)
/nacute (n')
/ncaron (n^)
/eng (ng)
/ohungarumlaut (o"")
/racute (r')
/rcaron (r^)
/sacute (s')
/scaron (s^)
/scedilla (s,)
/tcaron (t^)
/tcedilla (t,)
/uhungarumlaut (u"")
/uring (u*)
/zacute (z')
/zcaron (z^)
/zdot (z.)
/ij (ij)
/Germandbls (SS)
.chars.def
%%* We extend the df-tail command to stick in an Encoding vector (see
%%* above for a discussion of the T1 and OT1 encodings), put in a
%%* FontName (which will just be dvips's name for the font, i.e., Fa,
%%* Fb, etc.) and give each font a separate FontBBox instead of
%%* letting them all share a single one.
/dvips.df-tail % id numcc maxcc df-tail
{
/nn 9 dict N
nn begin
%%
%% Choose an encoding based on the highest position occupied.
%%
dup 128 gt { T1Encoding } { OT1Encoding } ifelse
/Encoding X
/FontType 3 N
%%
%% It's ok for all the fonts to share a FontMatrix, but they
%% need to have separate FontBBoxes
%%
/FontMatrix fntrx N
/FontBBox [0 0 0 0] N
string /base X
array /BitMaps X
%%
%% And let's throw in a FontName for good measure
%%
dup ( ) cvs
%%
%% Make sure each font gets it own private FontName. -- dmj,
%% 12/23/97
%%
dup length string copy
/FontName X
/BuildChar {CharBuilder} N
end
dup { /foo setfont }
2 array copy cvx N
load
0 nn put
/ctr 0 N
[
} def
%%* This is functionally equivalent to dvips's /D procedure, but it
%%* also calculates the Font Bounding Box while defining the
%%* characters.
/dvips.D % char-data ch D - : define character bitmap in current font
{
/cc X % char-data
dup type /stringtype ne {]} if % char-data
/ch-data X
nn /base get cc ctr put % (adds ctr to cc'th position of BASE)
nn /BitMaps get
ctr
ch-data % BitMaps ctr char-data
sf 1 ne {
dup dup length 1 sub dup 2 index S get sf div put
} if
put % puts char-data into BitMaps at index ctr
/ctr ctr 1 add N
%%
%% Make sure the Font Bounding Box encloses the Bounding Box of the
%% current character
%%
nn /FontBBox get % BB
dup % calculate new llx
dup 0 get
ch-xoff
min
0 exch put
dup % calculate new lly
dup 1 get
ch-yoff ch-height sub
min
1 exch put
dup % calculate new urx
dup 2 get
ch-dx ch-width add
max
2 exch put
dup 3 get % calculate new ury
ch-yoff
max
3 exch put
} def
%%* Define start-hook to replace df-tail and D by our versions.
%%* Unfortunately, the user can redefine start-hook and thus bypass
%%* these changes, but I don't see an obvious way around that.
userdict /start-hook {
TeXDict /df-tail /dvips.df-tail load bind put
TeXDict /D /dvips.D load bind put
} put
%%* Introduce a symbolic constant for hyphens. (Need to make
%%* allowance for hyphen being in different place?)
/.hyphen 45 def
% Write out a string. If it ends in a letter and a hyphen,
% don't write the hyphen, and set .show.last to a hyphen;
% otherwise, set .show.last to the character (or \000 if it was a hyphen).
/.show.write % <string>
{
dup length 1 ge
{ dup dup length 1 sub get % string last_char
dup .hyphen eq % string last_char hyphen?
{ % string last_char
1 index length 1 gt
{ 1 index dup length 2 sub get }
{ //.show.last 0 get }
ifelse % string last_char prev-char
currentfont /Encoding get exch get % look up prev-char
//.letter.chars exch known % is it a letter?
{ % Remove the hyphen % string last_char
exch % last_char string
dup length 1 sub % last_char string len-1
0 exch getinterval % last_char string-1
exch % string-1 last_char
}
{ pop 0 } % string 0
ifelse
}
if
//.show.last 0 3 -1 roll put % store last_char
% in .show.last
% If .show.last ==
% hyphen, then
% last char of
% previous string
% was a hyphen
}
if % string
{ % begin forall % c
dup % c c
currentfont /Encoding get % c c vec
exch get % c name
dup //.char.map exch known % c name bool
{ exch pop }
{ pop OT1Encoding exch get }
ifelse % name
//.char.map exch get % translation
.show.stdout exch writestring
}
forall
} odef
/.showstring1 { % string
currentpoint .coord % string x y
3 -1 roll dup .showwidth % x y string dx dy
1 index % x y string dx dy dx
0 rmoveto % x y string dx dy
.dcoord pop % x y string width
SIMPLE
{ % x y string width
2 index % x y string width y
//.show.y .iget % x y string width y old.y
%%*
%%* Replaced test "has y changed" by "has y changed by more
%%* than the current font height" so that subscripts and
%%* superscripts won't cause line/paragraph breaks
%%*
sub abs dup % x y string width dy dy
//.show.height .iget
gt
{ % x y string width dy
%%* Vertical position has changed by more than the font
%%* height, so we now try to figure out whether we've
%%* started a new paragraph or merely a new line, using a
%%* variety of heuristics.
%%* If any of the following is true, we start a new
%%* paragraph:
%%* (a) the current vertical shift is more than 1.1 times
%%* the previous vertical shift, where 1.1 is an
%%* arbitrarily chosen factor that could probably be
%%* refined.
dup % x y string width dy dy
//.show.dy .iget 1.1 mul
gt
exch
%%* Save the new vertical shift
//.show.dy exch .iput
%%* (b) The vertical shift is more than 1.3 times the
%%* "size" of the current font. I've removed this
%%* test since it's not really very useful.
%%* //.show.dy .iget
%%* //.show.height .iget 1.4 mul
%%* gt % x y string width bool
%%* .show.height .iget 0 gt and % only perform test if font
%%* % height is nonzero
%%* or
%%* (c) the first character of the new line is one of the
%%* .break.chars
2 index length % x y string width newpar? len
0 gt % x y string width newpar? len>0?
{
2 index 0 get % x y string width newpar? s
currentfont /Encoding get
exch get % x y string width newpar? s_enc
//.break.chars exch known { pop true } if
}
if % x y string width newpar?
%%* (d) The indentation of the new line is greater than
%%* the indentation of the previous line.
4 index
//.show.indent .iget
gt
or
%%* HOWEVER, if the line ends in a hyphen, we do NOT begin
%%* a new paragraph (cf. comment at end of BF2). --dmj,
%%* 12/23/97
//.show.last 0 get .hyphen ne
and
% newpar?
{ (\n\n) } % Paragraph
{ % Line
%%*
%%* BF2: If last character on a line is
%%* a hyphen, we omit the hyphen and
%%* run the lines together. Of
%%* course, this will fail if a word
%%* with an explicit hyphen (e.g.,
%%* X-ray) is split across two lines.
%%* Oh, well. (What should we do
%%* about a hyphen that ends a
%%* "paragraph"? Perhaps that should
%%* inhibit a paragraph break.)
%%*
//.show.last 0 get .hyphen eq
{ () }
{ ( ) }
ifelse % x y string width char
}
ifelse
//print
//.show.y 3 index .iput % x y string width
//.show.x 4 index .iput % x y string width
//.show.indent 4 index .iput
}
{ % x y string width dy
% If the word processor split a hyphenated word within
% the same line, put out the hyphen now.
pop
//.show.last 0 get .hyphen eq { (-) //print } if
}
ifelse
%%*
%%* If have moved more than 1 point to
%%* the right, interpret it as a
%%* space? This need to be looked at
%%* more closely.
%%*
3 index % x y string width x
//.show.x .iget 10 add gt % x y string width bool
{ ( ) //print }
if
% x y string width
4 1 roll % width x y string
.show.write pop % width x
add //.show.x exch .iput % <empty>
}
{ (S ) //print .show==4 }
ifelse
} odef
/.showstring
{ dup () eq { pop } { .showstring1 } ifelse
} bind def
% Redefine all the string display operators.
/show {
.showfont
.showcolor
.showstring
} codef
% We define all the other operators in terms of .show1.
/.show1.string ( ) def
/.show1 { //.show1.string exch 0 exch put //.show1.string .showstring } odef
/ashow
{ .showfont .showcolor
{ .show1 2 copy rmoveto } forall
pop pop
} codef
/awidthshow
{ .showfont .showcolor
{ dup .show1 4 index eq { 4 index 4 index rmoveto } if
2 copy rmoveto
}
forall
pop pop pop pop pop
} codef
/widthshow
{ .showfont .showcolor
//.show1.string 0 4 -1 roll put
{ //.show1.string search not { exit } if
.showstring .showstring
2 index 2 index rmoveto
} loop
.showstring pop pop
} codef
/kshow
{ .showfont .showcolor
%**************** Should construct a closure, in case the procedure
%**************** affects the o-stack.
{ .show1 dup exec } forall pop
} codef
% We don't really do the right thing with the Level 2 show operators,
% but we do something semi-reasonable.
/xshow { pop show } codef
/yshow { pop show } codef
/xyshow { pop show } codef
/glyphshow
{ currentfont /Encoding .knownget not { {} } if
0 1 2 index length 1 sub
{ % Stack: glyph encoding index
2 copy get 3 index eq { exch pop exch pop null exit } if
}
for null eq { (X) dup 0 4 -1 roll put show } { pop } ifelse
} codef
end
% Bind the operators we just defined, and all the others if we didn't
% do it before. Also reenable 'bind' for future files.
.bindoperators
NOBIND currentdict systemdict ne and
{ systemdict begin .bindoperators end }
if
NOBIND
{ /bind /.bind load def }
if
% Make systemdict read-only if it wasn't already.
systemdict wcheck { systemdict readonly pop } if
% Restore the current local/global VM mode.
exec
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -