summaryrefslogtreecommitdiff
path: root/hextobdf.c
diff options
context:
space:
mode:
authorJens Schweikhardt <schweikh@schweikhardt.net>2025-08-31 11:19:44 +0200
committerJens Schweikhardt <schweikh@schweikhardt.net>2025-08-31 11:19:44 +0200
commit1ba7b3a044045ea2aa91dd46acc3a1b4531a8bc1 (patch)
treef09f7fbc3f8d1c600ca03e7350aeea445c51b3e4 /hextobdf.c
parent1abec752a5f4d50ff1e77c870a63a2a194ab8374 (diff)
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.
Diffstat (limited to 'hextobdf.c')
-rw-r--r--hextobdf.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/hextobdf.c b/hextobdf.c
index f3f7580..1f3cb50 100644
--- a/hextobdf.c
+++ b/hextobdf.c
@@ -19,6 +19,13 @@
#include <wchar.h>
#include <unistd.h>
+#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");