mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-01 05:35:20 +02:00
tools/libtxt/: create library instead of executable
This commit is contained in:
parent
758d9e7fc4
commit
350283375c
@ -11,7 +11,7 @@
|
||||
#
|
||||
|
||||
|
||||
MAIN = libtxt.a
|
||||
LIB = libtxt.a
|
||||
|
||||
CFLAGS = -g -Wall
|
||||
|
||||
@ -19,13 +19,13 @@ OBJS = edit.o font.o
|
||||
|
||||
.PHONY: all clean spotless
|
||||
|
||||
all: $(MAIN)
|
||||
all: $(LIB)
|
||||
|
||||
$(MAIN): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS)
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) cr $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
spotless: clean
|
||||
rm -f $(MAIN)
|
||||
rm -f $(LIB)
|
||||
|
@ -305,48 +305,3 @@ int char_height(const struct font *font, char c)
|
||||
sym = font->sym+(cp-charset);
|
||||
return sym->h;
|
||||
}
|
||||
|
||||
|
||||
/* ----- Testing ----------------------------------------------------------- */
|
||||
|
||||
|
||||
#define W 64
|
||||
#define H 20
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct font *font;
|
||||
struct image *img;
|
||||
const char *error;
|
||||
uint8_t canvas[W*H/8] = { 0 };
|
||||
char *s;
|
||||
int x, xo, y;
|
||||
|
||||
img = load_image(argv[1], &error);
|
||||
if (!img) {
|
||||
fprintf(stderr, "%s\n", error);
|
||||
return 1;
|
||||
}
|
||||
font = make_font(img, &error);
|
||||
if (!font) {
|
||||
fprintf(stderr, "%s\n", error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
x = 0;
|
||||
for (s = argv[2]; *s; s++) {
|
||||
xo = draw_char(canvas, W, H, font, *s, x, 0);
|
||||
if (xo)
|
||||
x += xo+1;
|
||||
}
|
||||
for (y = 0; y != H; y++) {
|
||||
for (x = 0; x != W; x++)
|
||||
if (canvas[(y*W+x) >> 3] & (1 << (x & 7)))
|
||||
putchar('#');
|
||||
else
|
||||
putchar('.');
|
||||
putchar('\n');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user