shithub: neatroff

Download patch

ref: ac60e4b6a01cc80ede183342be54f98117306a4a
parent: 33b7ad9aa1c7d555f6fd75030568c1f484121aa7
author: Ali Gholami Rudi <[email protected]>
date: Sun Jan 15 16:11:36 EST 2017

font: fix reading gsub scripts

Reported and tested by aksr <[email protected]>.

--- a/font.c
+++ b/font.c
@@ -404,7 +404,7 @@
 static void font_readfeat(struct font *fn, char *tok, int *feat, int *scrp)
 {
 	*scrp = -1;
-	if (strchr(tok, ':')) {
+	if (strchr(tok, ':')) {		/* "feature:script" */
 		*scrp = font_findscrp(fn, strchr(tok, ':') + 1);
 		strchr(tok, ':')[0] = '\0';
 	}
@@ -419,10 +419,8 @@
 	int i, n;
 	if (fscanf(fin, "%s %d", tok, &n) != 2)
 		return 1;
-	if (strchr(tok, ':'))		/* "feature:script" */
-		strchr(tok, ':')[0] = '\0';
 	font_readfeat(fn, tok, &feat, &scrp);
-	rule = font_gpos(fn, n, feat, scrp);
+	rule = font_gsub(fn, n, feat, scrp);
 	for (i = 0; i < n; i++) {
 		if (fscanf(fin, "%s", tok) != 1)
 			return 1;