mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-22 20:00:17 +02:00
tools/libtxt/edit.c (do_edit): move font loading logic to load_font
This commit is contained in:
parent
817145bcdc
commit
6bf69b9358
@ -71,6 +71,17 @@ static struct image *find_font_image(const char *name, const char **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct font *load_font(const char *name, const char **error)
|
||||||
|
{
|
||||||
|
struct image *img;
|
||||||
|
|
||||||
|
img = find_font_image(name, error);
|
||||||
|
if (!img)
|
||||||
|
return NULL;
|
||||||
|
return make_font(img, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int do_edit(uint8_t *canvas, int width, int height,
|
static int do_edit(uint8_t *canvas, int width, int height,
|
||||||
const struct edit *e, const char **error)
|
const struct edit *e, const char **error)
|
||||||
{
|
{
|
||||||
@ -95,10 +106,7 @@ static int do_edit(uint8_t *canvas, int width, int height,
|
|||||||
break;
|
break;
|
||||||
case edit_font:
|
case edit_font:
|
||||||
free_font(font);
|
free_font(font);
|
||||||
img = find_font_image(e->u.s, error);
|
font = load_font(e->u.s, error);
|
||||||
if (!img)
|
|
||||||
return 0;
|
|
||||||
font = make_font(img, error);
|
|
||||||
if (!font)
|
if (!font)
|
||||||
goto fail;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user