mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-01 03:25:29 +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:
parent
6bf69b9358
commit
3219319716
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user