*/
struct param {
+ char const * option;
char const * fontname;
char const * fullname;
int xpix;
int ttfwidth;
};
-struct param default_param = {
- "Bedstead", "Bedstead",
- 100, /* xpix */
- 5, /* ttfwidth */
+struct param const params[] = {
+ {
+ "--normal",
+ "Bedstead", "Bedstead",
+ 100, /* xpix */
+ 5, /* ttfwidth */
+ },
+ {
+ "--extended",
+ "Bedstead-Extended", "Bedstead Extended",
+ 124, /* xpix */
+ 7, /* ttfwidth */
+ },
+ {
+ "--condensed",
+ "Bedstead-Condensed", "Bedstead Condensed",
+ 50, /* xpix */
+ 1, /* ttfwidth */
+ },
+ {
+ "--semicondensed",
+ "Bedstead-Semicondensed", "Bedstead Semicondensed",
+ 62, /* xpix */
+ 2, /* ttfwidth */
+ },
};
-struct param extended_param = {
- "Bedstead-Extended", "Bedstead Extended",
- 124, /* xpix */
- 7, /* ttfwidth */
-};
-
-struct param condensed_param = {
- "Bedstead-Condensed", "Bedstead Condensed",
- 50, /* xpix */
- 1, /* ttfwidth */
-};
-
-struct param semicondensed_param = {
- "Bedstead-Semicondensed", "Bedstead Semicondensed",
- 62, /* xpix */
- 2, /* ttfwidth */
-};
-
-struct param *param = &default_param;
+struct param const *param = ¶ms[0];
/* Size of pixels in font design units (usually 1000/em) */
#define XPIX (param->xpix)
{
int i;
int const nglyphs = sizeof(glyphs) / sizeof(glyphs[0]);
+ int const nparams = sizeof(params) / sizeof(params[0]);
int extraglyphs = 0;
char *endptr;
while (argc > 1) {
- if (strcmp(argv[1], "--extended") == 0) {
- param = &extended_param;
- argv++; argc--;
- } else if (strcmp(argv[1], "--condensed") == 0) {
- param = &condensed_param;
- argv++; argc--;
- } else if (strcmp(argv[1], "--semicondensed") == 0) {
- param = &semicondensed_param;
- argv++; argc--;
- } else if (strcmp(argv[1], "--") == 0) {
+ for (i = 0; i < nparams; i++)
+ if (strcmp(argv[1], params[i].option) == 0) {
+ param = ¶ms[i];
+ argv++; argc--;
+ goto next;
+ }
+ if (strcmp(argv[1], "--") == 0) {
argv++; argc--;
break;
} else if (argv[1][0] == '-') {
return 1;
} else break;
argv++; argc--;
+ next:;
}
if (argc > 1) {