DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T r

⟦27e669b8f⟧ TextFile

    Length: 3988 (0xf94)
    Types: TextFile
    Names: »reencode.psr«

Derivation

└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12
    └─⟦af5ba6c8e⟧ »unix3.0/DVIWARE.tar.Z« 
        └─⟦ca79c7339⟧ 
            └─⟦this⟧ »DVIware/laser-setters/dvi-to-ps/TeXPS/dvitps/psr/reencode.psr« 

TextFile

% Copyright (c) 1988 Stephan v. Bechtolsheim

% This file is part of the TeXPS Software Package.

% The TeXPS Software Package 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 TeXPS Software Package
% General Public License for full details.

% Everyone is granted permission to copy, modify and redistribute
% the TeXPS Software Package, but only under the conditions described in the
% TeXPS Software Package General Public License.   A copy of this license is
% supposed to have been given to you along with TeXPS Software Package so you
% can know your rights and responsibilities.  It should be in a
% file named CopyrightLong.  Among other things, the copyright notice
% and this notice must be preserved on all copies.

% Program 18 of the PostScript Cookbook, Page 211
% Modified for the needs of including it into the PostScript
% stuff of TeX.

/reencodedict 20 dict def	% get us a temporary directory

% @ReEncodeSmall
% ==============
% font-name new-font-name encoding-names-vector encoding-codes-vector
%					@ReEncodeSmall
%
% An encoding change vector looks as follows:
% [ 8#code-1 /name-1
%   8#code-2 /name-2
%   8#code-3 /name-3
% .....
% ]
% We have to build it from the encoding-names-vector and
%			   the encoding-codes-vector.
/@ReEncodeSmall {
    reencodedict begin
    /encoding-codes-vector	exch def
    /encoding-names-vector	exch def
    /new-font-name	exch def
    /base-font-name	exch def

#ifdef DEBUG
    encoding-codes-vector length encoding-names-vector length
    ne {(@ReEncodeSmall: unequal length of names and codes\n) print flush
	quit} if
#endif

% Allocate the encodings-change-vector
    /encoding-change-vector encoding-codes-vector length 2 mul array def

% prepare arguments for 'for' loop
    0 1 encoding-codes-vector length 1 sub
    {
	/LoopCounter exch def	% Now we can access the loop counter easier
	encoding-codes-vector LoopCounter get
	encoding-change-vector LoopCounter 2 mul       3 -1 roll put
	encoding-names-vector LoopCounter get
	encoding-change-vector LoopCounter 2 mul 1 add 3 -1 roll put
    } for

%   /encoding-change-vector	exch def
#ifdef	DEBUG
    (@ReEncodeSmall: name of new font: ) print
    new-font-name 50 string cvs print (\n) print flush
#endif

    /base-fontdict base-font-name findfont def	% get font dictionary you
    						% start out with
    /newfont base-fontdict maxlength dict def	% Create a new dictionary,
    						% same length
    base-fontdict
    {	exch dup /FID ne
%       (Looping\n) print flush
	{
%	    dup				% duplicate Key for printing
%	    (Key being copied: ) print
%	    (               ) cvs print
%	    (\n) print flush
	    dup /Encoding eq
	    {
		exch dup length array copy	% make a COPY of the
						% encoding vector elements
		newfont 3 1 roll put
	    }{
		exch newfont 3 1 roll put	% the rest is easy to copy
	    } ifelse
	}{
	    pop pop				% do not copy FID
	} ifelse
    } forall

    newfont /FontName new-font-name put		% put in the new name

% Now we start to modify the encoding vector
% The following four lines are the original code, which was in here
%   encoding-change-vector aload pop
%    encoding-change-vector length 2 idiv 
%    { newfont /Encoding get 3 1 roll put }
%	repeat
% Somebody's PS printer stack was overflowing, so this is the
% new code instead, which should work for everybody.
     encoding-change-vector length 2 idiv 1 sub
     -1 0
     { newfont /Encoding get exch
 	2 mul dup encoding-change-vector exch get exch
 	1 add  encoding-change-vector exch get
 	put } for
% That's it as far as this modification is concerned.

    new-font-name newfont definefont		% Declare the new font
    new-font-name
    end
% Dictionary from define font still on stack
    exch def
%   @PrintFontDicts
} def