From dd32ac5f62fde64c66f76179449baf1bfd0d3379 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 16 Jul 2015 08:20:24 +0200 Subject: [PATCH] unibdf2hex: preserve line width --- src/unibdf2hex.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/unibdf2hex.c b/src/unibdf2hex.c index bbd4dc1..17fd83d 100644 --- a/src/unibdf2hex.c +++ b/src/unibdf2hex.c @@ -42,13 +42,19 @@ main() int descent=2; /* font descent wrt baseline */ int startrow; /* row to start glyph */ - int rowlen=4; /* number of digits per row */ + int rowlen; /* number of digits per row */ unsigned rowout; while (fgets (inbuf, MAXBUF - 1, stdin)) { if (strncmp (inbuf, "ENCODING ", 9)) continue; sscanf (&inbuf[9], "%d", &thispoint); /* get code point */ + while (fgets (inbuf, MAXBUF - 1, stdin)) { + if (!strncmp (inbuf, "DWIDTH ", 7)) break; + } + sscanf (&inbuf[7], "%d", &rowlen); + rowlen >>= 2; + /* Read bounding box values from BBX line */ while (fgets (inbuf, MAXBUF - 1, stdin)) { if (!strncmp (inbuf, "BBX ", 4)) break; @@ -74,8 +80,7 @@ main() while (fgets (inbuf, MAXBUF - 1, stdin)) { if (!strncmp (inbuf, "END", 3)) break; sscanf (inbuf, "%X", &rowout); - /* Now force glyph to a 16x16 grid even if they'd fit in 8x16 */ - if (bbxx <= 8) rowout <<= 8; /* shift left for 16x16 glyph */ + if (rowlen >= 4 && bbxx <= 8) rowout <<= 8; /* force 8x16 input to 16x16 grid */ rowout >>= bbxxoff; fprintf (stdout, "%0*X", rowlen, rowout); rownum++; -- 2.30.0