1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-25 19:10:18 +02:00

tools/libtxt/edit.c (do_edit): load a default font if user doesn't set one

Before, we simply segfaulted.
This commit is contained in:
Werner Almesberger 2012-07-01 21:10:15 -03:00
parent 6bf69b9358
commit 3219319716

View File

@ -20,6 +20,9 @@
#include "libtxt.h"
#define DEFAULT_FONT "5x7"
/* ----- Render a list of editing instructions ----------------------------- */
@ -95,6 +98,11 @@ static int do_edit(uint8_t *canvas, int width, int height,
while (e) {
switch (e->type) {
case edit_string:
if (!font) {
font = load_font(DEFAULT_FONT, error);
if (!font)
goto fail;
}
for (s = e->u.s; *s; s++) {
xo = draw_char(canvas, width, height,
font, *s, x, y);