% Header file for sdop PostScript output
% Created: July 06 2005

% Blank lines and lines starting with a single % are not copied to the output.

%%BeginProlog


% Ensure that the pdfmark stuff is ignored by interpreters that do not
% support it.

/pdfmark where                    % Is pdfmark already available?
   { pop }                        % Yes: do nothing (use that definition)
   {                              % No: define pdfmark as follows:
   /globaldict where              % globaldict is preferred because
       { pop globaldict }         % globaldict is always visible; else,
       { userdict }               % use userdict otherwise.
   ifelse
   /pdfmark /cleartomark load put
   }                              % Define pdfmark to remove all objects
ifelse                            % up to and including the mark object.


% ====================== Font Encoding Stuff ==================================
% For fonts that use Adobe's standard encoding (that is, normal text fonts),
% we are going to bind each font twice, to give us 512 characters to play with.
% This is sufficient to encode all existing characters in the normal fonts.

% Here are the two encoding vectors. The first 256 characters are encoded with
% the Unicode encoding.

/LowerEncoding 256 array def
LowerEncoding 0 [
% 00 - 0F
/currency/currency/currency/currency
/currency/currency/currency/currency
/currency/currency/currency/currency
/currency/currency/currency/currency
% 10 - 1F
/currency/currency/currency/currency
/currency/currency/currency/currency
/currency/currency/currency/currency
/currency/currency/currency/currency
% 20 - 2F
/space/exclam/quotedbl/numbersign
/dollar/percent/ampersand/quotesingle
/parenleft/parenright/asterisk/plus
/comma/hyphen/period/slash
% 30 - 3F
/zero/one/two/three
/four/five/six/seven
/eight/nine/colon/semicolon
/less/equal/greater/question
% 40 - 4F
/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
% 50 - 5F
/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft
/backslash/bracketright/asciicircum/underscore
% 60 - 6F
/grave/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o
% 70 - 7F
/p/q/r/s/t/u/v/w/x/y/z/braceleft
/bar/braceright/asciitilde/currency
% 80 - 8F
/currency/currency/currency/currency
/currency/currency/currency/currency
/currency/currency/currency/currency
/currency/currency/currency/currency
% 90 - 9F
/currency/currency/currency/currency
/currency/currency/currency/currency
/currency/currency/currency/currency
/currency/currency/currency/currency
% A0 - AF
/space/exclamdown/cent/sterling
/currency/yen/brokenbar/section
/dieresis/copyright/ordfeminine/guillemotleft
/logicalnot/hyphen/registered/macron
% B0 - BF
/degree/plusminus/twosuperior/threesuperior
/acute/mu/paragraph/bullet
/cedilla/onesuperior/ordmasculine/guillemotright
/onequarter/onehalf/threequarters/questiondown
% C0 - CF
/Agrave/Aacute/Acircumflex/Atilde
/Adieresis/Aring/AE/Ccedilla
/Egrave/Eacute/Ecircumflex/Edieresis
/Igrave/Iacute/Icircumflex/Idieresis
% D0 - DF
/Eth/Ntilde/Ograve/Oacute
/Ocircumflex/Otilde/Odieresis/multiply
/Oslash/Ugrave/Uacute/Ucircumflex
/Udieresis/Yacute/Thorn/germandbls
% E0 - EF
/agrave/aacute/acircumflex/atilde
/adieresis/aring/ae/ccedilla
/egrave/eacute/ecircumflex/edieresis
/igrave/iacute/icircumflex/idieresis
% F0 - FF
/eth/ntilde/ograve/oacute
/ocircumflex/otilde/odieresis/divide
/oslash/ugrave/uacute/ucircumflex
/udieresis/yacute/thorn/ydieresis
]putinterval

% The next encoding vector uses Unicode for the first 128 characters (Latin
% Extended-A). The remainder are used arbitrarily for the remaining Adobe
% standardly encoded characters. This latter part of the encoding must be kept
% in step with the appropriate table in the code.

/UpperEncoding 256 array def
UpperEncoding 0 [
% 100 - 10F
/Amacron/amacron/Abreve/abreve
/Aogonek/aogonek/Cacute/cacute
/currency/currency/currency/currency
/Ccaron/ccaron/Dcaron/dcaron
% 110 - 11F
/Dcroat/dcroat/Emacron/emacron
/currency/currency/Edotaccent/edotaccent
/Eogonek/eogonek/Ecaron/ecaron
/currency/currency/Gbreve/gbreve
% 120 - 12F
/currency/currency/Gcommaaccent/gcommaaccent
/currency/currency/currency/currency
/currency/currency/Imacron/imacron
/currency/currency/Iogonek/iogonek
% 130 - 13f
/Idotaccent/dotlessi/currency/currency
/currency/currency/Kcommaaccent/kcommaaccent
/currency/Lacute/lacute/Lcommaaccent
/lcommaaccent/Lcaron/lcaron/currency
% 140 - 14F
/currency/Lslash/lslash/Nacute
/nacute/Ncommaaccent/ncommaaccent/Ncaron
/ncaron/currency/currency/currency
/Omacron/omacron/currency/currency
% 150 - 15F
/Ohungarumlaut/ohungarumlaut/OE/oe
/Racute/racute/Rcommaaccent/rcommaaccent
/Rcaron/rcaron/Sacute/sacute
/currency/currency/Scedilla/scedilla
% 160 - 16F
/Scaron/scaron/currency/currency
/Tcaron/tcaron/currency/currency
/currency/currency/Umacron/umacron
/currency/currency/Uring/uring
% 170 - 17F
/Uhungarumlaut/uhungarumlaut/Uogonek/uogonek
/currency/currency/currency/currency
/Ydieresis/Zacute/zacute/Zdotaccent
/zdotaccent/Zcaron/zcaron/currency
% --------------------------------------------------------------------
% These are the remaining characters in the Adobe standard encoding,
% in alphabetic order (seems as good as any other).
% --------------------------------------------------------------------
% 180 - 18F
/Delta/Euro/Scommaaccent/Tcommaaccent
/breve/caron/circumflex/commaaccent
/dagger/daggerdbl/dotaccent/ellipsis
/emdash/endash/fi/fl
% 190 - 19F
/florin/fraction/greaterequal/guilsinglleft
/guilsinglright/hungarumlaut/lessequal/lozenge
/minus/notequal/ogonek/partialdiff
/periodcentered/perthousand/quotedblbase/quotedblleft
% 1A0 - 1AF
/quotedblright/quoteleft/quoteright/quotesinglbase
/radical/ring/scommaaccent/summation
/tcommaaccent/tilde/trademark
]putinterval


% Routine to initially find a font and re-encode it if necessary.
% On the stack we should have two names, for the two differently encoded
% versions of the font. When the font is not re-encoded, the two will end
% up the same. Following the two names is the font name.

% We find the font first, and then look to see if it's in the directory,
% to cope with the case of loading from an auxiliary store.

/inf{dup dup findfont 3 1 roll FontDirectory exch known {pop}{(**** Font ")print
100 string cvs print (" is not loaded ****\r\n)print stop}ifelse

% At this point we have on the stack the two names, followed by the font.
% Duplicate it, and test to see whether it uses the Adobe Standard encoding.

dup dup/Encoding get StandardEncoding eq

% If the result is true, we obey the following.

% Find the maximum length of the font's dictionary, and make two new 
% dictionaries of the same length.

{maxlength dup dict/newfont0 exch def dict/newfont1 exch def

% Copy the original font into the two new ones, ommitting only the FID.

dup
{1 index/FID eq{pop pop}{newfont0 3 1 roll put}ifelse}forall
{1 index/FID eq{pop pop}{newfont1 3 1 roll put}ifelse}forall

% Now set up the two new encodings and define the names.

newfont1/Encoding UpperEncoding put dup newfont1 definefont def
newfont0/Encoding LowerEncoding put dup newfont0 definefont def
}

% If the font does not use the Standard Encoding, we set both names to
% the unmodified font.

{3 1 roll def def}ifelse

}bind def

% ==================== End of Font Encoding Stuff =============================


% Set font from the array of fonts in the vf variable.

/Sf{vf exch get setfont}bind def

% Relative x movement for kerning

/R{0 rmoveto}bind def

% Straightforward abbreviations

/Mt/moveto load def
/RMt/rmoveto load def
/RLt/rlineto load def
/S/show load def
/Slw/setlinewidth load def
/St/stroke load def





%%EndProlog

% End of PostScript header for sdop
