AFMGetCharMetrics again

Ian Pilcher pilcher at concentric.net
Wed Feb 28 14:08:48 CST 2001


Hopefully this gets everything right.  The newline in the file stream
was causing the first AFMMETRICS structure to not be filled in and the
last character's metrics to not be read.  (The main while loop was being
skipped entirely in the first iteration of the for loop.)

The function should be able to handle blank (all whitespace) lines
anywhere in the character metrics section of the AFM file now.

Changelog:

    * dlls/wineps/afm.c
    Ian Pilcher <pilcher at concentric.net>
    Squash another AFM character metrics parsing bug

-- 
========================================================================
Ian Pilcher                                       pilcher at concentric.net
========================================================================
-------------- next part --------------
--- ../wine-20010228cvs/dlls/wineps/afm.c	Wed Feb 28 04:43:27 2001
+++ dlls/wineps/afm.c	Thu Mar  1 01:57:07 2001
@@ -43,15 +43,17 @@
                                        afm->NumofMetrics * sizeof(AFMMETRICS) );
     for(i = 0; i < afm->NumofMetrics; i++, metric++) {
 
-        if(!fgets(line, sizeof(line), fp)) {
-	   ERR("Unexpected EOF\n");
-	   return;
-	}
-	cp = line + strlen(line);
 	do {
-	    *cp = '\0';
-	    cp--;
-	} while(cp >= line && isspace(*cp));
+            if(!fgets(line, sizeof(line), fp)) {
+		ERR("Unexpected EOF\n");
+		return;
+	    }
+	    cp = line + strlen(line);
+	    do {
+		*cp = '\0';
+		cp--;
+	    } while(cp >= line && isspace(*cp));
+	} while (!(*line));
 
 	curpos = line;
 	while(*curpos) {
@@ -103,11 +105,9 @@
 	    curpos = endpos + 1;
 	}
 
-#if 0	
 	TRACE("Metrics for '%s' WX = %f B = %f,%f - %f,%f\n",
 	      metric->N, metric->WX, metric->B.llx, metric->B.lly,
 	      metric->B.urx, metric->B.ury);
-#endif
     }
 
     return;


More information about the wine-patches mailing list