struct width {
char const * option;
- char const * fontname;
char const * fullname;
int xpix;
int ttfwidth;
struct width const widths[] = {
{
"--normal",
- "Bedstead", "Bedstead",
+ "Bedstead",
100, /* xpix */
5, /* ttfwidth */
},
{
"--ultra-condensed",
- "Bedstead-UltraCondensed", "Bedstead Ultra Condensed",
+ "Bedstead Ultra Condensed",
50, /* xpix */
1, /* ttfwidth */
},
{
"--extra-condensed",
- "Bedstead-ExtraCondensed", "Bedstead Extra Condensed",
+ "Bedstead Extra Condensed",
62, /* xpix */
2, /* ttfwidth */
},
{
"--condensed",
- "Bedstead-Condensed", "Bedstead Condensed",
+ "Bedstead Condensed",
76, /* xpix */
3, /* ttfwidth */
},
{
"--semi-condensed",
- "Bedstead-Semicondensed", "Bedstead Semi Condensed",
+ "Bedstead Semi Condensed",
88, /* xpix */
4, /* ttfwidth */
},
{
"--extended",
- "Bedstead-Extended", "Bedstead Extended",
+ "Bedstead Extended",
124, /* xpix */
7, /* ttfwidth */
},
static bool plottermode = false;
+static char * fullname_to_fontname(char const *fullname)
+{
+#define FONTNAME_MAX 29 /* Adobe-recommended limit */
+ static char fontname[FONTNAME_MAX + 1], *op = fontname;
+ char const *p = fullname;
+ bool gotfamily = false;
+
+ while (*p != '\0') {
+ assert(op - fontname <= FONTNAME_MAX);
+ if (*p == ' ') {
+ if (!gotfamily) {
+ *op++ = '-';
+ gotfamily = true;
+ }
+ } else {
+ *op++ = *p;
+ }
+ ++p;
+ }
+ *op++ = '\0';
+ return fontname;
+}
+
int
main(int argc, char **argv)
{
if (glyphs[i].unicode == -1)
extraglyphs++;
printf("SplineFontDB: 3.0\n");
- printf("FontName: %s\n", width->fontname);
+ printf("FontName: %s\n", fullname_to_fontname(width->fullname));
printf("FullName: %s\n", width->fullname);
printf("FamilyName: Bedstead\n");
printf("Weight: Medium\n");