[comp.lang.postscript] Reencoding Font Vectors

joeg@polygen.uucp (Joe Gaudreau) (07/27/89)

Howdy folks,

   I've got this wonderful bit of postscript (below) that I'm
having some difficulties with.  It *should* reencode a named
font vector with the character coding for multinational (ie X11
character sets).  My problem is that is doesn't.  I get an
"invalid font" error with an offending command of "show".  The
code itself is the reencode program from the greenbook.  The code
I wrote is somewhat simpler/more straight-forward but causes the
same error.  Any ideas?  TIA.

---
Joe Gaudreau @ Polygen Corporation, Waltham, MA 02254  (617)890-2888
UUCP: {princeton,mit-eddie,buita,sunne}!polygen!joeg

      o /                     o /                    o /
------ x ------ Cut Here ----- x ----- Cut Here ----- x ----- Cut Here ------
      o \                     o \                    o \
%!
%%Title: PostScript font reencoding procedure
%%EndComments

/F { findfont exch scalefont setfont } bind def

/R {
    findfont begin currentdict dup length dict begin
    { %forall
	1 index /FID ne {def} {pop pop} ifelse
    } forall
    /FontName exch def dup length 0 ne { %if
	/Encoding Encoding 256 array copy def
	0 exch { %forall
	    dup type /nametype eq { %ifelse
		Encoding 2 index 2 index put
		pop 1 add
	    }{ %else
		exch pop
	    } ifelse
	} forall
    } if pop
    currentdict dup end end
    /FontName get exch definefont pop
} bind def

/NewFontVect [ 128
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/space/exclamdown/cent/sterling/currency/yen/brokenbar/section
/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron
/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered
/cedilla/onesuperior/ordmasculine/guillemotright
/onequarter/onehalf/threequarters/questiondown
/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis
/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply
/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide
/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis ] def

NewFontVect /Courier-New /Courier R

14 /Courier-New F

100 600 moveto
(this is a test) show
100 580 moveto
(\260\300\320\340\360 and other \352) show

showpage