Post Scriptum language

// Example 21

// Import bitmaps in PostScript format 
// as ready to use dictionary definition:
import( "cddi.inc" );

Encoding = array( 256 );
for ( i=0 to 255 ) 
        Encoding[ i ] = '.notdef';

Encoding[ 97 ] = 'a';
Encoding[ 98 ] = 'b';
Encoding[ 99 ] = 'c';
Encoding[ 100 ] = 'd';
Encoding[ 101 ] = 'e';
Encoding[ 102 ] = 'f';
Encoding[ 103 ] = 'g';
Encoding[ 104 ] = 'h';
Encoding[ 105 ] = 'i';
Encoding[ 108 ] = 'l';
Encoding[ 109 ] = 'm';
Encoding[ 110 ] = 'n';
Encoding[ 111 ] = 'o';
Encoding[ 112 ] = 'p';
Encoding[ 114 ] = 'r';
Encoding[ 115 ] = 's';
Encoding[ 116 ] = 't';
Encoding[ 117 ] = 'u';
Encoding[ 118 ] = 'v';
Encoding[ 119 ] = 'w';
Encoding[ 121 ] = 'y';
Encoding[ 32 ] = 'space';
Encoding[ 46 ] = 'period';
Encoding[ 44 ] = 'comma';

procedure BuildChar_fun( fontdict, char )
{
        charname = fontdict.Encoding[ char ];
        charinfo = fontdict.CharData[ charname ];
        wx = charinfo[ 0 ];
        charbbox = getinterval( charinfo, 1, 4 );
        setcachedevice( wx, 0, charbbox[0], charbbox[1], 
                        charbbox[2], charbbox[3] );

        fontdict.imagemaskmatrix[ 4 ] = charinfo[ 7 ];
        fontdict.imagemaskmatrix[ 5 ] = charinfo[ 8 ];

        imagemask( charinfo[5], charinfo[6], true,
                        fontdict.imagemaskmatrix,
                        cvx( getinterval( charinfo, 9, 1 )));
}

definefont( 'BitFont', 
[
        FontType        : 3,
        FontMatrix      : [1, 0, 0, 1, 0, 0],
        FontBBox        : [1.28, 1.2, -0.16, -0.24],
        Encoding        : Encoding,
        BuildChar       : BuildChar_fun,
        imagemaskmatrix : [25, 0, 0, -25, 0, 0],
        CharData        : CharDataDict
] );

setfont( scalefont( findfont( 'BitFont' ), 12 ));
moveto (72, 500); show( "the tendency of the best");
moveto (72, 488); show( "typography has been and");
moveto (72, 476); show( "still should be in the path of");
moveto (72, 464); show( "simplicity, legibility, and");
moveto (72, 452); show( "orderly arrangement.");

setfont( scalefont( findfont( 'BitFont' ), 8 ));

moveto( 72, 436 ); show( "theodore low de vinne" );

showpage();