shithub: neatpost

Download patch

ref: 7d3154844e8436f8c82d933f607dff3e70e69b25
parent: d583417dd0afd135d14680ebe244c31077ae1f9c
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sat Mar 31 06:33:59 EDT 2018

pdf: initialize the character map in psfont_write() lazily

--- a/pdf.c
+++ b/pdf.c
@@ -142,8 +142,8 @@
 	int enc_obj;
 	char *ext = strrchr(ps->path, '.');
 	struct font *fn = dev_fontopen(ps->desc);
-	int map[256] = {0};
-	char gcnt = ps->lastfn == ix ? ps->lastgl : 256;
+	int map[256];
+	int gcnt = ix < ps->lastfn ? 256 : ps->lastgl;
 	/* finding out the mapping */
 	for (i = 0; i < 256; i++)
 		map[i] = -1;