bdf2sfd

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

commit bb359ab2b75434f2cecebabeff6916adb97693a6
parent df4eb7aad316bf35189341eb91907b95ada44314
Author: Frederic Cambus <fred@statdns.com>
Date:   Sun, 26 Jan 2020 19:47:38 +0100

Parse FONTBOUNDINGBOX data to get character height and weight.

Diffstat:
Msrc/bdftosfd.c | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/bdftosfd.c b/src/bdftosfd.c @@ -111,6 +111,7 @@ main(int argc, char *argv[]) char *charname = NULL, *copyright = NULL, *name = NULL, *encoding = NULL, *version = NULL; char *value = NULL; + int32_t height = 0, weight = 0; int32_t ascent = 0, descent = 0; int32_t x = 0, y = 0; @@ -144,6 +145,29 @@ main(int argc, char *argv[]) continue; } + if (!strncmp(lineBuffer, "FONTBOUNDINGBOX ", 16)) { + token = strtok(lineBuffer, " \t"); + + if (token) + value = strtok(NULL, " \t"); + + if (value) + weight = strtonum(value, 0, 8, &errstr); + + if (errstr) + errx(EXIT_FAILURE, "Invalid value for FONTBOUNDINGBOX."); + + value = strtok(NULL, " \t"); + + if (value) + height = strtonum(value, 0, 16, &errstr); + + if (errstr) + errx(EXIT_FAILURE, "Invalid value for FONTBOUNDINGBOX."); + + continue; + } + if (!strncmp(lineBuffer, "FONT_ASCENT ", 12)) { token = strtok(lineBuffer, " \t");