Generate 'name' table for TTX

This commit is contained in:
Ben Harris 2024-11-02 15:26:04 +00:00
parent 030d9c36f9
commit 75ad9bc479

View 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"); */