Post Scriptum language

// Example 7

procedure findscale() {
	gsave();
	newpath();
	moveto(0, 0);
	charpath( "X", true );
	flattenpath();
//  Yet another example of multivalued built-in operator:
	pb = [ pathbbox() ];    
	capheight = pb[ 3 ];  //  We take the fourth result.
	newpath();
	moveto(0, 0);
	charpath( "x", true );
	flattenpath();
	pb = [ pathbbox() ];
	xheight = pb[ 3 ];
	grestore();

	return (xheight + (capheight-xheight)/3) / capheight;
}

procedure scshow( string ) {
	gsave();
	setfont( makefont( currentfont(), 
                          [0.9, 0, 0, findscale(), 0, 0] ));
	show( string );
	ptt = astore( currentpoint(), [0, 0] );
	grestore();

	moveto( pop( aload( ptt )));
}

setfont( scalefont( findfont( 'Times-Roman' ), 18 ));
moveto( 72, 500 );  
show( "To read means to obtain meaning from" );
show( " words, and" );

moveto( 72, 500-20 );
show( "legibility is " );
scshow( "THAT QUALITY WHICH" );
show( " enables words" );

moveto( 72, 500-40 );
show( "to be read easily, quickly, and accurately." );
moveto( 72, 500-70 );

show( "JOHN C. TARR" );

showpage();