From: Ben Harris Date: Sat, 16 Oct 2021 15:04:47 +0000 (+0100) Subject: Correct TTF names for bold faces X-Git-Tag: bedstead-002.003~7 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=03f5cbbf1a9151db861724df5153bd5cb1ba6e29;p=bedstead.git 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. --- diff --git a/bedstead.c b/bedstead.c index c2b89d4..4079ca3 100644 --- a/bedstead.c +++ b/bedstead.c @@ -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");