117,120d116
< int     make_enc = FALSE;
< int     code_idx[256];
< FILE    *idx_file;
< 
503,527d498
< int getIndex(UShort char_Code) 
< {
<   int idx;
<   if ( GBK == TRUE ) {
<      int pos;
<      UShort unicode;
<      pos = ((char_Code>>8)-0x81)*192 + ((char_Code&0x00FF)-0x40);
<      unicode = gbk2uni[pos];
< 
<      idx = TT_Char_Index (cmap, unicode);
<   } else if ( BIG5 == TRUE ) {
<      int pos;
<      UShort unicode;
<      if ((char_Code&0x00FF)<=0x7F)
<          pos = ((char_Code>>8)-0xa1)*160 + ((char_Code&0x00FF)-0x40);
<      else
<          pos = ((char_Code>>8)-0xa1)*160 + ((char_Code&0x00FF)-0x60);
<      unicode = big52uni[pos];
<      idx = TT_Char_Index (cmap, unicode);
<   } else {
<      idx = TT_Char_Index (cmap, char_Code);
<   }
<   return idx;
< }
< 
541,542d511
<   if (make_enc)
<       goto encoding_vector;
576d544
< encoding_vector:
584,585c552
<           fprintf(out, "dup %d /cjk%02X%02X put\n",ich,ipl,ich),
<           code_idx[ich] = getIndex(ipl*256 + ich);
---
>           fprintf(out, "dup %d /cjk%02X%02X put\n",ich,ipl,ich);
591,592c558
<             fprintf(out, "dup %d /cjk%02X%02X put\n",cjk,ipl,ich),
<             code_idx[cjk] = getIndex(ipl*256 + ich);
---
>             fprintf(out, "dup %d /cjk%02X%02X put\n",cjk,ipl,ich);
597,599d562
<   if (make_enc)
<       return;
< 
799,831d761
< void openEncFile(char *psfile)
< {
<     int i;
<     char idx_name[1024], *idx_basename, *p;
<     if (psfile != NULL)
<         strcpy(idx_name, psfile);
<     else
<         strcpy(idx_name, "stdout");
<     if ((p = strrchr(idx_name, '.')) == NULL)
<         p = strchr(idx_name, 0);
<     *p = 0;
<     idx_basename = strdup(idx_name);
<     strcpy(p, ".enc");
<     if ((idx_file = fopen(idx_name, "wt")) == 0)
<         fatal("%s: unable to open the encoding file '%s' for writing.\n",
<                 prog, idx_name);
<     fprintf(idx_file, "/%sEncoding [\n", idx_basename);
<     for (i = 0; i < 256; i++)
<         code_idx[i] = 0;
< }
< 
< void closeEncFile()
< {
<     int i;
<     for (i = 0; i < 256; i++)
<         if (code_idx[i] == 0)
<             fprintf(idx_file, "/.notdef\n");
<         else
<             fprintf(idx_file, "/index0x%X\n", code_idx[i]);
<     fprintf(idx_file, "] def\n");
<     fclose(idx_file);
< }
< 
847c777,796
<   idx = getIndex(char_Code);
---
> 
>   if ( GBK == TRUE ) {
>      int pos;
>      UShort unicode;
>      pos = ((char_Code>>8)-0x81)*192 + ((char_Code&0x00FF)-0x40);
>      unicode = gbk2uni[pos];
> 
>      idx = TT_Char_Index (cmap, unicode);
>   } else if ( BIG5 == TRUE ) {
>      int pos;
>      UShort unicode;
>      if ((char_Code&0x00FF)<=0x7F)
>          pos = ((char_Code>>8)-0xa1)*160 + ((char_Code&0x00FF)-0x40);
>      else
>          pos = ((char_Code>>8)-0xa1)*160 + ((char_Code&0x00FF)-0x60);
>      unicode = big52uni[pos];
>      idx = TT_Char_Index (cmap, unicode);
>   } else {
>      idx = TT_Char_Index (cmap, char_Code);
>   }
1166d1114
< 
1168,1170d1115
< 
<   if (make_enc)
<       return TRUE;
1224,1226d1168
<       case 'a': case 'A':
<         make_enc = TRUE;
<         break;
1355d1296
< 
1378,1381d1318
< 
<   if (make_enc)
<       openEncFile(outfile);
< 
