[comp.lang.postscript] findfont.ps, new /Encoding in findfont

phk@kpd.DK (Poul-Henning Kamp) (07/14/88)

In Denmark, and I suppose elsewhere, people use "funny" glyphs in their
texts. This is a little hack to put these glyphs in the default
/Encoding of all fonts.

As usual with my programs, it lacks comments.

You might recognize the example with scandinavian glyphs in "blue book",
as base of this. (Honour them, who honour fits.)

If you load it from outside the serverloop, you can make it permanent,
until power down-up.

On our P400PS (Agfa, and good) printer It's loaded at boottime from
the printers disk, together with ehandler etc.
START------------- findfont.ps ---------------------
%!
/#findfont /findfont load def

/findfont { 
    dup
    #findfont
    dup
    /Encoding get
    8#340 get /.notdef eq { 
        12 dict begin
        /newcodesandnames
        [
        8#340 /Aring	% put changes to encoding here
        8#360 /aring
        ] def
        /basefontdict exch def
        /newfontname exch def
        /newfont basefontdict maxlength dict def
        basefontdict {
            exch dup /FID ne {
                dup /Encoding eq {
                    exch 256 array copy
                    newfont 3 1 roll put
                } {
                    exch newfont 3 1 roll put
                }
                ifelse
            } {
                pop pop
            }
            ifelse
        } forall
        newfont /FontName newfontname put
        newcodesandnames aload pop
        newcodesandnames length 2 idiv {
            newfont /Encoding get 3 1 roll put
        }
        repeat
        newfontname newfont definefont
        end
    } { 
        exch pop
    } ifelse
} def
END--------------- findfont.ps ---------------------
-- 
Poul-Henning Kamp     I Kuwait Petroleum (Denmark) I Phone:  +45(0)2859333x523
phk@q8.dk             I Hummeltoftevej 49          I Private:+45(0)3531224
..!mcvax!diku!kpd!phk I DK-2830 Virum              I Fax:    +45(0)2851418
"Cave canem -- Beware, I might sing !"