Category : DeskTop Publishing in the 1990's
Archive   : GS252INI.ZIP
Filename : GS_2ASC.PS

 
Output of file : GS_2ASC.PS contained in archive : GS252INI.ZIP
% Copyright (C) 1991, 1992 Aladdin Enterprises. All rights reserved.
% Distributed by Free Software Foundation, Inc.
%
% This file is part of Ghostscript.
%
% Ghostscript is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
% to anyone for the consequences of using it or for whether it serves any
% particular purpose or works at all, unless he says so in writing. Refer
% to the Ghostscript General Public License for full details.
%
% Everyone is granted permission to copy, modify and redistribute
% Ghostscript, but only under the conditions described in the Ghostscript
% General Public License. A copy of this license is supposed to have been
% given to you along with Ghostscript so you can know your rights and
% responsibilities. It should be in a file named COPYING. Among other
% things, the copyright notice and this notice must be preserved on all
% copies.

% Extract the ASCII text from a PostScript file. Nothing is displayed.
% Instead, lines are written to stdout as follows:
% F ()
% indicate font height and width of a space
% S ()
% display a string
% P
% end of page
%
% is an integer expressed in tenths of a point
% is an integer in tenths of a point.
% and are integer coordinates, in tenths of a point, with origin
% at lower left.
% and are string represented with the standard
% PostScript escape conventions.
% The idea is similar to Glenn Reid's `distillery', only a lot more
% simple-minded, and less robust.

% Note that this code will only work properly if systemdict is writable
% and if `binding' the definitions of operators defined as procedures
% is deferred. For this reason, it is normally invoked with
% gs -q -dNOBIND -dWRITESYSTEMDICT gs_2asc.ps

% Thanks to J Greely for improvements
% to this code.

/QUIET true def
systemdict wcheck { systemdict } { userdict } ifelse begin

% Disable the display operators.

/eofill { newpath } odef
/erasepage { } odef
/fill { newpath } odef
/stroke { newpath } odef

% The image operators must read the input, but do nothing.

/colorimage { gsave nulldevice //colorimage grestore } odef
/image { gsave nulldevice //image grestore } odef
/imagemask { gsave nulldevice //imagemask grestore } odef

% Redefine the end-of-page operators.

/copypage { (P\n) //print } odef
/showpage { copypage erasepage initgraphics } odef

% Redefine `show'.

% Set things up so our output will be in tenths of a point, with origin at
% lower left. This isolates us from the peculiarities of individual devices.
/.show.ident.matrix matrix def
/.show.ident
{ gsave initmatrix 0.1 dup scale .show.ident.matrix currentmatrix grestore
} def
/.coord { transform .show.ident itransform } odef
/.dcoord { dtransform .show.ident idtransform } odef
/.showfont
%old code - This didn't work right for me with all fonts.
%
% { 0 currentfont /FontBBox get dup 3 get exch 1 get sub
% currentfont /FontMatrix get dtransform dtransform
% exch abs exch abs max round
% (F ) //print //.stdout exch write==only (\n) //print
% } odef
%
%unfortunately, my way bombs on one of my test files in
%--%show_continue--(?!). It's from dvi2ps, which molests
%the fonts in some way. --jgreely
{ (F ) //print
gsave
% figure out (roughly) the maximum height of the current
% font. I picked this string for a mix of ascenders and
% descenders, with digits tossed in in case of oldstyle
newpath 0 0 moveto
(Xyhq69) false charpath flattenpath pathbbox newpath
exch 4 -1 roll sub 3 1 roll exch sub .dcoord
round abs //.stdout exch write==only pop
( ) //print
% oddly enough, the "charpath...pathbbox" stuff didn't work
% right for space in courier
( ) stringwidth
.dcoord pop
round //.stdout exch write==only
% ( ) //print
% //.stdout currentfont /FontName get
% dup type /nametype eq { =string cvs } if
% write==only
(\n) //print
grestore
} odef

/.showstring
{ (S ) //print
gsave
currentpoint .coord
exch round dup //.stdout exch write==only
( ) //print
exch round dup //.stdout exch write==only
( ) //print
moveto dup //.stdout exch write==only
( ) //print
grestore dup stringwidth pop 0 rmoveto
stringwidth .dcoord pop
round //.stdout exch write==only
(\n) //print
} odef

/show
{ .showfont .showstring
} odef

% Redefine the other string display operators in terms of `show'.

/.show1 { ( ) dup 0 3 index put exch pop .showstring } odef
/ashow
{ .showfont
{ .show1 2 copy rmoveto } forall
exch neg exch neg rmoveto
} odef
/widthshow
{ .showfont
{ 2 copy .show1 eq { 1 index 2 index rmoveto } if } forall
pop pop pop
} odef
/awidthshow
{ .showfont
{ dup .show1 3 index eq { 4 index 5 index rmoveto } if
2 copy rmoveto
} forall
exch neg exch neg rmoveto
pop pop pop
} odef
/kshow
{ .showfont
{ .show1 dup exec } forall pop
} odef

% Redirect the printing operators.

/.stdout (_temp_.out) (w) file def
/.stderr (_temp_.err) (w) file def
/print { //.stdout exch writestring } odef

end

% Bind the operators we just defined, and all the others if we didn't
% do it before.

bindoperators
NOBIND currentdict systemdict ne and
{ systemdict begin bindoperators end }
if

% Make systemdict read-only if it wasn't already.

systemdict wcheck { systemdict readonly pop } if


  3 Responses to “Category : DeskTop Publishing in the 1990's
Archive   : GS252INI.ZIP
Filename : GS_2ASC.PS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/