procedure ReEncode( basefontname, newfontname, newencoding )
{
basefontdict = findfont( basefontname );
newfont = dict( maxlength( basefontdict ) );
for ( id:val in basefontdict ) {
if ( id != 'FID' )
newfont[ id ] = val;
}
newfont.FontName = newfontname;
newfont.Encoding = newencoding;
definefont( newfontname, newfont );
}
EBCDIC = array( 256 );
for ( i=0 to 255 )
EBCDIC[ i ] = '.notdef';
EBCDIC[ 0100 ] = 'space';
EBCDIC[ 0112 ] = 'cent';
EBCDIC[ 0113 ] = 'period';
EBCDIC[ 0114 ] = 'less';
EBCDIC[ 0115 ] = 'parenleft';
EBCDIC[ 0116 ] = 'plus';
EBCDIC[ 0117 ] = 'bar';
EBCDIC[ 0120 ] = 'ampersand';
EBCDIC[ 0132 ] = 'exclam';
EBCDIC[ 0133 ] = 'dollar';
EBCDIC[ 0134 ] = 'asterisk';
EBCDIC[ 0135 ] = 'parenright';
EBCDIC[ 0136 ] = 'semicolon';
EBCDIC[ 0137 ] = 'asciitilde';
EBCDIC[ 0140 ] = 'hyphen';
EBCDIC[ 0141 ] = 'slash';
EBCDIC[ 0153 ] = 'comma';
EBCDIC[ 0154 ] = 'percent';
EBCDIC[ 0155 ] = 'underscore';
EBCDIC[ 0156 ] = 'greater';
EBCDIC[ 0157 ] = 'question';
EBCDIC[ 0172 ] = 'colon';
EBCDIC[ 0173 ] = 'numbersign';
EBCDIC[ 0174 ] = 'at';
EBCDIC[ 0175 ] = 'quoteright';
EBCDIC[ 0176 ] = 'equal';
EBCDIC[ 0177 ] = 'quotedbl';
EBCDIC[ 0201 ] = 'a'; EBCDIC[ 0206 ] = 'f';
EBCDIC[ 0202 ] = 'b'; EBCDIC[ 0207 ] = 'g';
EBCDIC[ 0203 ] = 'c'; EBCDIC[ 0210 ] = 'h';
EBCDIC[ 0204 ] = 'd'; EBCDIC[ 0211 ] = 'i';
EBCDIC[ 0205 ] = 'e';
EBCDIC[ 0221 ] = 'j'; EBCDIC[ 0226 ] = 'o';
EBCDIC[ 0222 ] = 'k'; EBCDIC[ 0227 ] = 'p';
EBCDIC[ 0223 ] = 'l'; EBCDIC[ 0230 ] = 'q';
EBCDIC[ 0224 ] = 'm'; EBCDIC[ 0231 ] = 'r';
EBCDIC[ 0225 ] = 'n';
EBCDIC[ 0242 ] = 's'; EBCDIC[ 0246 ] = 'w';
EBCDIC[ 0243 ] = 't'; EBCDIC[ 0247 ] = 'x';
EBCDIC[ 0244 ] = 'u'; EBCDIC[ 0250 ] = 'y';
EBCDIC[ 0245 ] = 'v'; EBCDIC[ 0251 ] = 'z';
EBCDIC[ 0301 ] = 'A'; EBCDIC[ 0306 ] = 'F';
EBCDIC[ 0302 ] = 'B'; EBCDIC[ 0307 ] = 'G';
EBCDIC[ 0303 ] = 'C'; EBCDIC[ 0310 ] = 'H';
EBCDIC[ 0304 ] = 'D'; EBCDIC[ 0311 ] = 'I';
EBCDIC[ 0305 ] = 'E';
EBCDIC[ 0321 ] = 'J'; EBCDIC[ 0326 ] = 'O';
EBCDIC[ 0322 ] = 'K'; EBCDIC[ 0327 ] = 'P';
EBCDIC[ 0323 ] = 'L'; EBCDIC[ 0330 ] = 'Q';
EBCDIC[ 0324 ] = 'M'; EBCDIC[ 0331 ] = 'R';
EBCDIC[ 0325 ] = 'N';
EBCDIC[ 0342 ] = 'S'; EBCDIC[ 0346 ] = 'W';
EBCDIC[ 0343 ] = 'T'; EBCDIC[ 0347 ] = 'X';
EBCDIC[ 0344 ] = 'U'; EBCDIC[ 0350 ] = 'Y';
EBCDIC[ 0345 ] = 'V'; EBCDIC[ 0351 ] = 'Z';
EBCDIC[ 0360 ] = 'zero'; EBCDIC[ 0365 ] = 'five';
EBCDIC[ 0361 ] = 'one'; EBCDIC[ 0366 ] = 'six';
EBCDIC[ 0362 ] = 'two'; EBCDIC[ 0367 ] = 'seven';
EBCDIC[ 0363 ] = 'three'; EBCDIC[ 0370 ] = 'eight';
EBCDIC[ 0364 ] = 'four'; EBCDIC[ 0371 ] = 'nine';
TR = scalefont( findfont( 'Times-Roman' ), 10 );
ReEncode( 'Times-Roman', 'Times-Roman-EBCDIC', EBCDIC );
TRE = scalefont( findfont( 'Times-Roman-EBCDIC' ), 10 );
setfont( TR );
for ( counter = 0 to 3 )
{
moveto( 40 + counter*133, 720 );
show( " Octal Standard EBCDIC" );
moveto( 40 + counter*133, 720-10 );
show( "Number Char Char" );
}
showstring = string( 1 );
counterstring = string( 3 );
yline = 690;
xstart = 52;
for ( counter = 0 to 255 )
{
showstring[ 0 ] = counter;
charstring = showstring;
setfont( TR );
moveto( xstart, yline );
show( cvrs( counter, 8, counterstring ));
moveto( xstart + 42, yline );
show( charstring );
setfont( TRE );
moveto( xstart + 86, yline );
show( charstring );
yline -= 10;
if ( mod( counter+1, 64 ) == 0 ) {
xstart += 133;
yline = 690;
}
}
showpage(); |