Correct TTF names for bold faces

Unlike other weights, "Bold" can be represented in the normal TTF
Family/Subfamily structure, so it should be put there.  To avoid making
the single printf call for LangName unbearably complex, I've split it
into two, one for the case where the typographic family/subfamily names
(16/17) differ from the basic ones, and one for when they don't.
This commit is contained in:
Ben Harris 2021-10-16 16:04:47 +01:00
parent 58eebbf5f8
commit 03f5cbbf1a

View File

@ -2196,14 +2196,25 @@ main(int argc, char **argv)
printf("FontName: %s\n", fullname_to_fontname(get_fullname()));
printf("FullName: %s\n", get_fullname());
printf("FamilyName: Bedstead\n");
printf("LangName: 1033 \"\" \"Bedstead%s%s\" \"%s\" \"\" \"\" \"\" "
"\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" "
"\"%s\" \"%s%s\"\n\n", weight->suffix, width->suffix,
"Regular",
weight->suffix[0] || width->suffix[0] ? "Bedstead" : "",
weight->suffix[0] ? weight->suffix+1 : "",
weight->suffix[0] ? width->suffix :
width->suffix[0] ? width->suffix+1 : "");
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("OS2_WeightWidthSlopeOnly: 1\n");
printf("Copyright: Dedicated to the public domain\n");