bdf2sfd

BDF to SFD converter, allowing to vectorize bitmap fonts
Log | Files | Refs | README | LICENSE

commit 30e3189b95903e3c0cce5e8485037ab82e6504bd
parent ab47aa0a1ed8d92be19ef329184b35fb241da6eb
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 21 Jan 2020 12:17:12 +0100

Parse font version and emit the data in output.

Diffstat:
Msrc/bdftosfd.c | 14+++++++++++++-
Msrc/header.c | 2+-
Msrc/header.h | 1+
3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/bdftosfd.c b/src/bdftosfd.c @@ -108,7 +108,7 @@ main(int argc, char *argv[]) bool readglyph = false; char *token = NULL; - char *charname = NULL, *copyright = NULL, *name = NULL, *encoding = NULL; + char *charname = NULL, *copyright = NULL, *name = NULL, *encoding = NULL, *version = NULL; int32_t x, y; @@ -141,6 +141,18 @@ main(int argc, char *argv[]) continue; } + if (!strncmp(lineBuffer, "FONT_VERSION ", 13)) { + token = strtok(lineBuffer, " \t"); + + if (token) + version = strtok(NULL, "\n"); + + if (version) + font.version = strdup(version); + + continue; + } + if (!strncmp(lineBuffer, "CHARS ", 6)) { token = strtok(lineBuffer, " \t"); diff --git a/src/header.c b/src/header.c @@ -27,7 +27,7 @@ header(FILE *stream, struct fontinfo *font) fprintf(stream, "FamilyName: %s\n", font->name); fprintf(stream, "Weight: Medium\n"); fprintf(stream, "Copyright: %s\n", font->copyright); - fprintf(stream, "Version: 1.5.0\n"); + fprintf(stream, "Version: %s\n", font->version); fprintf(stream, "ItalicAngle: 0\n"); fprintf(stream, "UnderlinePosition: -100\n"); fprintf(stream, "UnderlineWidth: 40\n"); diff --git a/src/header.h b/src/header.h @@ -17,6 +17,7 @@ struct fontinfo { char *name; char *chars; char *copyright; + char *version; }; void header(FILE *, struct fontinfo *);