static int parsePairKernData(FILE *fp, FontInfo *fi)
{  
    BOOL cont = TRUE, save = (fi->pkd != NULL);
    int pos = 0, error = ok, pcount = 0;
    register char *keyword;
  
    while (cont)
    {
        keyword = token(fp);
        
        if (keyword == NULL)
        {
            error = earlyEOF;
            break; /* get out of loop */
        }
        if (!save)
          /* get tokens until the end of the Pair Kerning Data */
          /* section without saving any of the data */
            switch(recognize(keyword))
            {
                case ENDKERNPAIRS:
                case ENDKERNDATA:
                    cont = FALSE;
                    break;
                case ENDFONTMETRICS:
                    cont = FALSE;
                    error = normalEOF;
                    break;
                default:
                    break;
            } /* switch */
	else
          /* otherwise parse entire Pair Kerning Data section, */
          /* saving the data */
            switch(recognize(keyword))
            {
                case COMMENT:
                    keyword = linetoken(fp);
                    break;
                case KERNPAIR:
                    if (pcount < fi->numOfPairs)
                    {
                        keyword = token(fp);
                        fi->pkd[pos].name1 = (char *) 
                            malloc(strlen(keyword) + 1);
                        strcpy(fi->pkd[pos].name1, keyword);
                        keyword = token(fp);
                        fi->pkd[pos].name2 = (char *) 
                            malloc(strlen(keyword) + 1);
                        strcpy(fi->pkd[pos].name2, keyword);
                        keyword = token(fp);
                        fi->pkd[pos].xamt = atoi(keyword);
                        keyword = token(fp);
                        fi->pkd[pos++].yamt = atoi(keyword);
                        pcount++;
                    }
                    else
                    {
                        error = parseError;
                        cont = FALSE;
                    }
                    break;
                case KERNPAIRXAMT:
                    if (pcount < fi->numOfPairs)
                    {
                        keyword = token(fp);
                        fi->pkd[pos].name1 = (char *) 
                            malloc(strlen(keyword) + 1);
                        strcpy(fi->pkd[pos].name1, keyword);
                        keyword = token(fp);
                        fi->pkd[pos].name2 = (char *) 
                            malloc(strlen(keyword) + 1);
                        strcpy(fi->pkd[pos].name2, keyword);
                        keyword = token(fp);
                        fi->pkd[pos++].xamt = atoi(keyword);
                        pcount++;
                    }
                    else
                    {
                        error = parseError;
                        cont = FALSE;
                    }
                    break;
                case ENDKERNPAIRS:
                case ENDKERNDATA:
                    cont = FALSE;
                    break;
                case ENDFONTMETRICS:
                    cont = FALSE;
                    error = normalEOF;
                    break;
                case NOPE:
                default:
                    error = parseError;
                    break;
            } /* switch */
    } /* while */
    
    if (error == ok && pcount != fi->numOfPairs)
        error = parseError;
        
    return(error);
    
} /* parsePairKernData */    
static int parsePairKernData(FILE *fp, FontInfo *fi)
{  
    BOOL cont = TRUE, save = (fi->pkd != NULL);
    int pos = 0, error = ok, pcount = 0;
    register char *keyword;
  
    while (cont)
    {
        keyword = token(fp);
        
        if (keyword == NULL)
        {
            error = earlyEOF;
            break;  
        }
        if (!save)
           
           
            switch(recognize(keyword))
            {
                case ENDKERNPAIRS:
                case ENDKERNDATA:
                    cont = FALSE;
                    break;
                case ENDFONTMETRICS:
                    cont = FALSE;
                    error = normalEOF;
                    break;
                default:
                    break;
            }  
	else
           
           
            switch(recognize(keyword))
            {
                case COMMENT:
                    keyword = linetoken(fp);
                    break;
                case KERNPAIR:
                    if (pcount < fi->numOfPairs)
                    {
                        keyword = token(fp);
                        fi->pkd[pos].name1 = (char *) 
                            malloc(strlen(keyword) + 1);
                        strcpy(fi->pkd[pos].name1, keyword);
                        keyword = token(fp);
                        fi->pkd[pos].name2 = (char *) 
                            malloc(strlen(keyword) + 1);
                        strcpy(fi->pkd[pos].name2, keyword);
                        keyword = token(fp);
                        fi->pkd[pos].xamt = atoi(keyword);
                        keyword = token(fp);
                        fi->pkd[pos++].yamt = atoi(keyword);
                        pcount++;
                    }
                    else
                    {
                        error = parseError;
                        cont = FALSE;
                    }
                    break;
                case KERNPAIRXAMT:
                    if (pcount < fi->numOfPairs)
                    {
                        keyword = token(fp);
                        fi->pkd[pos].name1 = (char *) 
                            malloc(strlen(keyword) + 1);
                        strcpy(fi->pkd[pos].name1, keyword);
                        keyword = token(fp);
                        fi->pkd[pos].name2 = (char *) 
                            malloc(strlen(keyword) + 1);
                        strcpy(fi->pkd[pos].name2, keyword);
                        keyword = token(fp);
                        fi->pkd[pos++].xamt = atoi(keyword);
                        pcount++;
                    }
                    else
                    {
                        error = parseError;
                        cont = FALSE;
                    }
                    break;
                case ENDKERNPAIRS:
                case ENDKERNDATA:
                    cont = FALSE;
                    break;
                case ENDFONTMETRICS:
                    cont = FALSE;
                    error = normalEOF;
                    break;
                case NOPE:
                default:
                    error = parseError;
                    break;
            }  
    }  
    
    if (error == ok && pcount != fi->numOfPairs)
        error = parseError;
        
    return(error);
    
}      