-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdumpfonts.c
55 lines (46 loc) · 1.22 KB
/
dumpfonts.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <stdlib.h>
#include "../bmp.h"
#include "bold.xbm"
#include "circuit.xbm"
#include "hand.xbm"
#include "infocom.xbm"
#include "normal.xbm"
#include "small.xbm"
#include "smallinv.xbm"
#include "thick.xbm"
#include "thinsans.xbm"
#include "italic.xbm"
typedef struct xbm_details {
const char *name;
unsigned char *bits;
int width, height;
} xbm_details;
#define STRUCT_CONTENTS(name) { #name, name ## _bits, name ## _width, name ## _height }
xbm_details xbms[] = {
STRUCT_CONTENTS(bold),
STRUCT_CONTENTS(circuit),
STRUCT_CONTENTS(hand),
STRUCT_CONTENTS(infocom),
STRUCT_CONTENTS(normal),
STRUCT_CONTENTS(italic),
STRUCT_CONTENTS(small),
STRUCT_CONTENTS(smallinv),
STRUCT_CONTENTS(thick),
STRUCT_CONTENTS(thinsans),
{NULL, NULL, 0, 0}
};
int main(int argc, char *argv[]) {
(void)argc;(void)argv;
xbm_details *d = xbms;
while(d->name) {
char outname[128];
Bitmap *b;
snprintf(outname, sizeof outname, "dump-%s.gif", d->name);
b = bm_from_Xbm(d->width, d->height, d->bits);
bm_save(b, outname);
bm_free(b);
printf("%s %d x %d: %s\n", d->name, d->width, d->height, outname);
d++;
}
}