Commit 988d1c23 authored by Peter H. Ganten's avatar Peter H. Ganten Committed by Alexandre Julliard

- only parse AFM-files, which start with "BeginFontMetrics"

- use fgetc instead of fgets to cope with AFM-Files with Macintosh-Style line-breaks ('\r') in the parser.
parent 38bed060
......@@ -130,6 +130,7 @@ static AFM *PSDRV_AFMParse(char const *file)
char *value;
AFM *afm;
char *cp;
int afmfile = 0;
TRACE("parsing '%s'\n", file);
......@@ -144,12 +145,32 @@ static AFM *PSDRV_AFMParse(char const *file)
return NULL;
}
while(fgets(buf, sizeof(buf), fp)) {
cp = buf + strlen(buf);
do {
*cp = '\0';
cp = buf;
while ( ( *cp = fgetc ( fp ) ) != EOF ) {
if ( *cp == '\r' || *cp == '\n' || cp - buf == sizeof(buf)-1 ) {
if ( cp == buf )
continue;
*(cp+1)='\0';
}
else {
cp ++;
continue;
}
cp = buf + strlen(buf);
do {
*cp = '\0';
cp--;
} while(cp > buf && isspace(*cp));
cp = buf;
if ( afmfile == 0 && strncmp ( buf, "StartFontMetrics", 16 ) ) {
HeapFree ( PSDRV_Heap, 0, afm );
return NULL;
}
else {
afmfile = 1;
}
value = strchr(buf, ' ');
if(value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment