From 7d3154844e8436f8c82d933f607dff3e70e69b25 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Sat, 31 Mar 2018 10:33:59 +0430 Subject: [PATCH] pdf: initialize the character map in psfont_write() lazily --- pdf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdf.c b/pdf.c index 0e4c9ae..68fbd9f 100644 --- a/pdf.c +++ b/pdf.c @@ -142,8 +142,8 @@ static void psfont_write(struct psfont *ps, int ix) 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; -- 2.11.4.GIT