shithub: neatpost

Download patch

ref: defe8978301dc27c9aabc302d325f113ac80b9ea
parent: ae31390de112361acbd73725f0e82b5a0358f38e
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Mar 21 09:18:00 EDT 2014

font: initialize glyph->pos

--- a/font.c
+++ b/font.c
@@ -40,6 +40,18 @@
 	return g;
 }
 
+static void tilloel(FILE *fin, char *s)
+{
+	int c = fgetc(fin);
+	while (c != EOF && c != '\n') {
+		*s++ = c;
+		c = fgetc(fin);
+	}
+	*s = '\0';
+	if (c != EOF)
+		ungetc(c, fin);
+}
+
 static int font_readchar(struct font *fn, FILE *fin)
 {
 	char tok[ILNLEN];
@@ -58,8 +70,12 @@
 		if (fscanf(fin, "%d %s", &type, id) != 2)
 			return 1;
 		glyph = font_glyph(fn, id);
-		if (!glyph)
+		if (!glyph) {
 			glyph = font_glyphput(fn, id, name, wid, type);
+			tilloel(fin, tok);
+			if (sscanf(tok, "%d", &glyph->pos) < 1)
+				glyph->pos = 0;
+		}
 	} else {
 		glyph = fn->g[fn->n - 1];
 	}