diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-07-18 14:40:08 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-07-18 14:40:08 (EDT) |
commit | 16332bd57b86edebaefa83c6ca8fb3d04048e93d (patch) | |
tree | 283397d9d80cd261402933f3d536e33abe946baa | |
parent | eb7115b77e55fb049edd5582b114eefb246edf40 (diff) |
font_list(): New function
-rw-r--r-- | src/font.c | 11 | ||||
-rw-r--r-- | src/font.h | 5 | ||||
-rw-r--r-- | src/main.c | 4 |
3 files changed, 20 insertions, 0 deletions
@@ -22,6 +22,7 @@ #include "font.h" #include <limits.h> +#include <stdio.h> #include <string.h> #include <png.h> @@ -47,6 +48,16 @@ static const struct font_desc *fonts[] = { &font_mplus_1mn_regular_16x22, }; +void +font_list(FILE *stream) +{ + size_t i; + + for (i = 0; i < *(&fonts + 1) - fonts; ++i) { + fprintf(stream, "%s\n", fonts[i]->name); + } +} + struct font * font_default(void) { @@ -22,10 +22,15 @@ #ifndef FONT_H_ #define FONT_H_ +#include <stdio.h> + #include <png.h> #include <linux/font.h> +void +font_list(FILE *stream); + struct font * font_default(void) __attribute__((pure)); @@ -60,6 +60,10 @@ main(int argc, char **argv) while ((opt = getopt(argc, argv, "f:w:h:")) != -1) { switch (opt) { case 'f': + if (strcmp(optarg, "list") == 0) { + font_list(stdout); + return 0; + } font = font_find(optarg); if (!font) { fprintf(stderr, _("Font \"%s\" not " |