From 03f5cbbf1a9151db861724df5153bd5cb1ba6e29 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 16 Oct 2021 16:04:47 +0100 Subject: [PATCH] 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. --- bedstead.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) 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"); -- 2.30.2