shithub: neatroff

Download patch

ref: a3377daa639dc73982a432af4f79b0fe90852396
parent: 869f33d8f99b927b726898ef17fbadd327cac082
author: Ali Gholami Rudi <[email protected]>
date: Tue Jun 15 20:51:07 EDT 2021

font: read font section in gsub command

--- a/font.c
+++ b/font.c
@@ -206,7 +206,7 @@
 						src + i, i, &idx);
 			if (r < 0)		/* no rule found */
 				break;
-			if (gpos[r].sec > 0 && gpos[r].sec == lastsec)
+			if (gpos[r].sec > 0 && gpos[r].sec <= lastsec)
 				continue;	/* perform at most one rule from each lookup */
 			lastsec = gpos[r].sec;
 			pats = gpos[r].pats;
@@ -609,6 +609,7 @@
 	FILE *fin;
 	char ligs[512][GNLEN];
 	int ligs_n = 0;
+	int sec;
 	int i;
 	fin = fopen(path, "r");
 	if (!fin)
@@ -636,7 +637,8 @@
 					ligs_n++;
 			}
 		} else if (!strcmp("gsec", tok)) {
-			fn->secs++;
+			if (fscanf(fin, "%d", &sec) != 1)
+				fn->secs++;
 		} else if (!strcmp("gsub", tok)) {
 			font_readgsub(fn, fin);
 		} else if (!strcmp("gpos", tok)) {