chiark / gitweb /
Have a defined constant for the family name "Bedstead"
authorBen Harris <bjh21@bjh21.me.uk>
Fri, 8 Nov 2024 09:30:44 +0000 (09:30 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 14 Nov 2024 22:27:18 +0000 (22:27 +0000)
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

index a88e0b342ad9830f249c301f4e393d69b53c4425..7cb49306575e338dc9a16e0220374d469fe2f766 100644 (file)
 #include <string.h>
 #include <time.h>
 
+#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");