From 1ba7b3a044045ea2aa91dd46acc3a1b4531a8bc1 Mon Sep 17 00:00:00 2001 From: Jens Schweikhardt Date: Sun, 31 Aug 2025 11:19:44 +0200 Subject: Replace renumber.pl with hextosrc.c. Improved TTF. * Introduce VERSION and HASH for utility programs. * Fontlint complained about the + in BDF U+1234 character names, so I changed them to U1234. --- hextobdf.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'hextobdf.c') diff --git a/hextobdf.c b/hextobdf.c index f3f7580..1f3cb50 100644 --- a/hextobdf.c +++ b/hextobdf.c @@ -19,6 +19,13 @@ #include #include +#ifndef HASH +#define HASH "(undefined)" +#endif +#ifndef VERSION +#define VERSION "(undefined)" +#endif + #define PixelWidth 12 #define PixelHeight 22 #define MAX_LINE 1024 @@ -102,8 +109,8 @@ void output_bdf_preamble(void) { // Output data for a single STARTCHAR to stdout. // void output_bdf_char(int aChar) { - size_t hexdigits; - printf("STARTCHAR U+%04x\n", gGlyph[aChar].codepoint); + size_t hexdigits; + printf("STARTCHAR U%04x\n", gGlyph[aChar].codepoint); printf("ENCODING %d\n", gGlyph[aChar].codepoint); if (wcwidth(gGlyph[aChar].codepoint) == 2) { puts("SWIDTH 1000 0\nDWIDTH 24 0\nBBX 24 22 0 -5"); @@ -152,8 +159,12 @@ void parse_font_line(const char *aLine, struct glyph *aGlyph) { // void parse_options(int aArgc, char **aArgv) { int ch; - while ((ch = getopt(aArgc, aArgv, "w:h:")) != -1) { + while ((ch = getopt(aArgc, aArgv, "Vw:h:")) != -1) { switch (ch) { + case 'V': + printf("%s version %s, hash %s\n", aArgv[0], VERSION, HASH); + exit (EXIT_SUCCESS); + break; case 'h': if (sscanf(optarg, "%zu", &gHeight) != 1) errx("can't convert '%s' to height integer\n", optarg); @@ -195,6 +206,7 @@ void parse_font_dimensions(FILE *aFile) { void usage(int aStatus) { fprintf(stderr, "usage: hextobdf [options]\n"); fprintf(stderr, "Options [default]:\n"); + fprintf(stderr, " -V output version/hash and exit\n"); fprintf(stderr, " -h height height in pixels [%d]\n", PixelHeight); fprintf(stderr, " -w width width in pixels [%d]\n", PixelWidth); fprintf(stderr, "\nReads hex font from stdin and writes bdf font to stdout\n"); -- cgit v1.2.3