chiark / gitweb /
Generate 'name' table for TTX
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 2 Nov 2024 15:26:04 +0000 (15:26 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 14 Nov 2024 22:27:18 +0000 (22:27 +0000)
bedstead.c

index e3a69b88125db1dd6c66527176ac9cce17776df1..632e3635c8ac09afad17712f2ac4c988ffefc52e 100644 (file)
@@ -2950,28 +2950,52 @@ main(int argc, char **argv)
        TTXI(usBreakChar, 32);
        TTXI(usMaxContext, 1); /* No pair subs. */
        printf(" </OS_2>\n");
+
+       printf(" <name>\n");
+       /* Encode each name in Mac Roman and Windows UTF-16. */
+#define NAMEF(id, f, ...) \
+       printf("  <namerecord nameID='%d' " \
+              " platformID='1' platEncID='0' langID='0x0' unicode='True'>" \
+              f "</namerecord>\n" \
+              "  <namerecord nameID='%d' " \
+              " platformID='3' platEncID='1' langID='0x409'>" \
+              f "</namerecord>\n", \
+              (int)(id), __VA_ARGS__, (int)(id), __VA_ARGS__)
+#define NAME(id, s) NAMEF(id, "%s", s)
+       NAME(0, "Dedicated to the public domain");
+       if ((weight->ttfweight == 500 || weight->ttfweight == 700) &&
+           width->suffix[0] == '\0') {
+               /* Normal width; regular or bold */
+               NAME(1, "Bedstead");
+               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",
+                     weight->ttfweight == 700 ? "" : weight->suffix,
+                     width->suffix);
+               NAME(2,
+                    weight->ttfweight == 700 ? weight->suffix+1 : "Regular");
+               NAME(16, "Bedstead");
+               NAMEF(17, "%s%s", weight->suffix[0] ? weight->suffix+1 : "",
+                     weight->suffix[0] ? width->suffix :
+                     width->suffix[0] ? width->suffix+1 : "");
+       }
+       NAME(4, get_fullname());
+       NAME(5, "Version " VERSION);
+       NAME(6, fullname_to_fontname(get_fullname()));
+       /* Stylistic set names. */
+       NAME(0x101, "SAA5051");
+       NAME(0x102, "SAA5052");
+       NAME(0x104, "SAA5054");
+       NAME(0x114, "4-cell separated graphics");
+       NAME(0x116, "6-cell separated graphics");
+       printf(" </name>\n");
        /* printf("FontName: %s\n", fullname_to_fontname(get_fullname())); */
        /* printf("FullName: %s\n", get_fullname()); */
        /* printf("FamilyName: Bedstead\n"); */
-       /* if ((weight->ttfweight == 500 || weight->ttfweight == 700) && */
-       /*     width->suffix[0] == '\0') */
-       /*      /\* Normal width; regular or bold *\/ */
-       /*      printf("LangName: 1033 \"\" \"Bedstead\" \"%s\"\n", */
-       /*             weight->suffix[0] ? weight->suffix + 1 : "Regular"); */
-       /* else */
-       /*      /\* */
-       /*       * Slightly unusual face, so we need to set the */
-       /*       * "Preferred" family and style. */
-       /*       *\/ */
-       /*      printf("LangName: 1033 \"\" \"Bedstead%s%s\" \"%s\" \"\" \"\" " */
-       /*             "\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" " */
-       /*             "\"\" \"Bedstead\" \"%s%s\"\n", */
-       /*             weight->ttfweight == 700 ? "" : weight->suffix, */
-       /*             width->suffix, */
-       /*             weight->ttfweight == 700 ? weight->suffix+1 : "Regular", */
-       /*             weight->suffix[0] ? weight->suffix+1 : "", */
-       /*             weight->suffix[0] ? width->suffix : */
-       /*             width->suffix[0] ? width->suffix+1 : ""); */
        /* printf("Weight:%s\n", weight->suffix[0] ? weight->suffix : " Medium"); */
        /* printf("Copyright: Dedicated to the public domain\n"); */
        /* printf("Version: 002.009\n"); */