commit be557b4f011b90c1154a5e12ed2fea916e7da6e8
parent a1c2a042efc4362af1062de8e97622567bd12b41
Author: Frederic Cambus <fred@statdns.com>
Date: Mon, 23 Dec 2019 15:51:46 +0100
Parse number of characters in the input font, and append header to the output.
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/bdftosfd.c b/src/bdftosfd.c
@@ -105,12 +105,24 @@ main(int argc, char *argv[]) {
bool readglyph = false;
char *token = NULL;
- char *charname, *encoding;
+ char *chars, *charname, *encoding;
int32_t x, y;
while (fgets(lineBuffer, LINE_LENGTH_MAX, bdfFile)) {
if (*lineBuffer) {
+ if (!strncmp(lineBuffer, "CHARS ", 6)) {
+ token = strtok(lineBuffer, " \t");
+
+ if (token)
+ chars = strtok(NULL, " \n");
+
+ if (chars)
+ header(stdout, "Spleen", chars);
+
+ continue;
+ }
+
if (!strncmp(lineBuffer, "STARTCHAR", 9)) {
fprintf(stdout, "StartChar:");
token = strtok(lineBuffer, " \t");