Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/local/programs/bdfload limit the comment width in the head...



details:   https://anonhg.NetBSD.org/xsrc/rev/72f9e4dd4b3f
branches:  trunk
changeset: 7138:72f9e4dd4b3f
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Aug 23 19:09:15 2022 +0000

description:
limit the comment width in the header output to the size of the character cell

diffstat:

 local/programs/bdfload/bdfload.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 4452398329b9 -r 72f9e4dd4b3f local/programs/bdfload/bdfload.c
--- a/local/programs/bdfload/bdfload.c  Tue Aug 23 18:28:14 2022 +0000
+++ b/local/programs/bdfload/bdfload.c  Tue Aug 23 19:09:15 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bdfload.c,v 1.10 2022/08/23 18:28:14 macallan Exp $    */
+/*     $NetBSD: bdfload.c,v 1.11 2022/08/23 19:09:15 macallan Exp $    */
 
 /*
  * Copyright (c) 2018 Michael Lorenz
@@ -160,7 +160,7 @@
              char *buffer, int buflen)
 {
        FILE *output;
-       int i, j, x, y, idx;
+       int i, j, x, y, idx, pxls, left;
        char fontname[64], c, msk;
        
        /* now output as a header file */
@@ -203,14 +203,17 @@
                                fprintf(output, "0x%02x, ",buffer[idx + x]);
                        }
                        fprintf(output, "/* ");
+                       pxls = f->fontwidth;
                        for (x = 0; x < f->stride; x++) {
                                c = buffer[idx + x];
                                msk = 0x80;
-                               for (j = 0; j < 8; j++) {
+                               left = pxls > 8 ? 8 : pxls;
+                               for (j = 0; j < left; j++) {
                                        fprintf(output, "%s",
                                            (c & msk) != 0 ? "[]" : ". ");
                                        msk = msk >> 1;
                                }
+                               pxls -= 8;
                        }
                        fprintf(output, " */\n");
 



Home | Main Index | Thread Index | Old Index