From eb2175ef3fd0a03ab7fa6f465e151dc85578cca8 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Fri, 8 Nov 2024 09:30:44 +0000 Subject: [PATCH] Have a defined constant for the family name "Bedstead" All occurrences of the name in the OTF and BDF files are now derived from that definition so that they can conveniently be changed together. --- bedstead.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/bedstead.c b/bedstead.c index a88e0b3..7cb4930 100644 --- a/bedstead.c +++ b/bedstead.c @@ -106,6 +106,7 @@ #include #include +#define FAMILY_NAME "Bedstead" #define VERSION "002.009" /* Metrics expressed in pixels. */ @@ -2692,7 +2693,7 @@ get_fullname(void) #define FULLNAME_MAX 100 static char fullname[FULLNAME_MAX]; - sprintf(fullname, "Bedstead%s%s", weight->suffix, width->suffix); + sprintf(fullname, FAMILY_NAME "%s%s", weight->suffix, width->suffix); return fullname; } @@ -3009,19 +3010,19 @@ main(int argc, char **argv) if ((weight->ttfweight == 500 || weight->ttfweight == 700) && width->suffix[0] == '\0') { /* Normal width; regular or bold */ - NAME(1, "Bedstead"); + NAME(1, FAMILY_NAME); NAME(2, weight->suffix[0] ? weight->suffix + 1 : "Regular"); } else { /* * Slightly unusual face, so we need to set the * "Preferred" family and style. */ - NAMEF(1, "Bedstead%s%s", + NAMEF(1, FAMILY_NAME "%s%s", weight->ttfweight == 700 ? "" : weight->suffix, width->suffix); NAME(2, weight->ttfweight == 700 ? weight->suffix+1 : "Regular"); - NAME(16, "Bedstead"); + NAME(16, FAMILY_NAME); NAMEF(17, "%s%s", weight->suffix[0] ? weight->suffix+1 : "", weight->suffix[0] ? width->suffix : width->suffix[0] ? width->suffix+1 : ""); @@ -3067,7 +3068,7 @@ main(int argc, char **argv) TTXS("version", VERSION); TTXS("Notice", "Dedicated to the public domain"); TTXS("FullName", get_fullname()); - TTXS("FamilyName", "Bedstead"); + TTXS("FamilyName", FAMILY_NAME); TTXS("Weight", *weight->suffix ? weight->suffix + 1 : "Medium"); TTXI("isFixedPitch", 1); TTXI("UnderlinePosition", -3 * YPIX / 2); @@ -4117,10 +4118,10 @@ glyph_complement() qsort(sorted, nglyphs, sizeof(sorted[0]), &byunicode); printf("%%!PS-Adobe\n"); printf("%%%%Creator: bedstead\n"); - printf("%%%%Title: Bedstead Glyph Complement\n"); - printf("/xfont /Bedstead findfont 20 scalefont def\n"); - printf("/nfont /Bedstead findfont 10 scalefont def\n"); - printf("/lfont /Bedstead findfont 4 scalefont def\n"); + printf("%%%%Title: %s Glyph Complement\n", FAMILY_NAME); + printf("/xfont /%s findfont 20 scalefont def\n", FAMILY_NAME); + printf("/nfont /%s findfont 10 scalefont def\n", FAMILY_NAME); + printf("/lfont /%s findfont 4 scalefont def\n", FAMILY_NAME); printf("/str 50 string def\n"); printf("/centre {\n"); printf(" dup stringwidth pop 2 div neg 0 rmoveto show\n"); @@ -4207,8 +4208,8 @@ bdf_gen(int px_height) printf("/buf %d string def\n", (px_width + 7) / 8); printf("(\\\n"); printf("STARTFONT 2.1\n"); - printf("FONT -bjh21-Bedstead-%s-R-%s--" - "%d-%d-75-75-C-%d-ISO10646-1\n", + printf("FONT -bjh21-%s-%s-R-%s--" + "%d-%d-75-75-C-%d-ISO10646-1\n", FAMILY_NAME, *weight->suffix ? weight->suffix + 1 : "Medium", *width->suffix ? width->suffix + 1 : "Normal", dpt_height, px_height, px_width * 10); @@ -4216,7 +4217,7 @@ bdf_gen(int px_height) printf("FONTBOUNDINGBOX %d %d 0 %d\n", px_width, px_height, -base); printf("STARTPROPERTIES 23\n"); printf("FOUNDRY \"bjh21\"\n"); - printf("FAMILY_NAME \"Bedstead\"\n"); + printf("FAMILY_NAME \"%s\"\n", FAMILY_NAME); printf("WEIGHT_NAME \"%s\"\n", *weight->suffix ? weight->suffix + 1 : "Medium"); printf("SLANT \"R\"\n"); -- 2.30.2