From 1cce3bbeaf336289254728badc6d02b7b840cf08 Mon Sep 17 00:00:00 2001 From: KikooDX Date: Wed, 26 May 2021 15:45:03 +0200 Subject: [PATCH] custom font for monochrome targets <3 Kenney --- CMakeLists.txt | 1 + assets-fx/fxconv-metadata.txt | 6 ++++++ assets-fx/kenney_mini.png | Bin 0 -> 490 bytes src/disp/display.c | 22 ++++++++++++++++++---- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 assets-fx/fxconv-metadata.txt create mode 100644 assets-fx/kenney_mini.png diff --git a/CMakeLists.txt b/CMakeLists.txt index a46d30a..3adb271 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ set(ASSETS ) set(ASSETS_fx + assets-fx/kenney_mini.png ) set(ASSETS_cg diff --git a/assets-fx/fxconv-metadata.txt b/assets-fx/fxconv-metadata.txt new file mode 100644 index 0000000..4b4d74f --- /dev/null +++ b/assets-fx/fxconv-metadata.txt @@ -0,0 +1,6 @@ +kenney_mini.png: + name: font_kenney_mini + type: font + charset: print + grid.size: 6x9 + proportional: true diff --git a/assets-fx/kenney_mini.png b/assets-fx/kenney_mini.png new file mode 100644 index 0000000000000000000000000000000000000000..392cbf67b2f557c126d1346f508aece6ffee72b1 GIT binary patch literal 490 zcmVnsBY7)0c`vncr;Eb2?<_humRipZN_uCt{|qM@ zI9hb~+W8xpow5?TmETw^W;@cH405#qQK)!NS_YWyRnP?>V`Zo}k!u(MAZcG)I3K|l zDv0hYnwYZUOPBNW&7x1qO$HSJ2V)n0LgxK-02u?RL8#l+*RT4c4=x@bJ_J!%RVy~D z?f~lhiHhsN4PpM4ow4p4R(xZvnCZxHIcP0))N4H8v$GZq73bbc^DX3MieB; z4mZiYe+pn30K5_)$y4iBpIj*{c*=+5%H0Z(9%{n?5@$AFJpEXha7v_HH$RNc*y?74 g09Yf*aGE540R~Ra^n`BO7ytkO07*qoM6N<$f&}B!CIA2c literal 0 HcmV?d00001 diff --git a/src/disp/display.c b/src/disp/display.c index 9f3c02f..3ea228b 100644 --- a/src/disp/display.c +++ b/src/disp/display.c @@ -1,27 +1,41 @@ #include "disp.h" #include -#include + +#ifdef FX9860G +extern font_t font_kenney_mini; +#endif + +static int line_height = 0; static void draw_line(int x, int y, char *buffer, int len); void disp_display(void) { - static int line_height = 0; const int x = 2; +#ifdef FX9860G + int y = -2; +#else int y = 2; +#endif char *buffer_cursor = disp_buffer; int line_length = 0; - if (!line_height) + if (!line_height) { +#ifdef FX9860G + dfont(&font_kenney_mini); + line_height = 6; +#else line_height = dfont_default()->line_height; +#endif + } while (buffer_cursor[line_length] != '\0') { if (buffer_cursor[line_length] == '\n') { draw_line(x, y, buffer_cursor, line_length); buffer_cursor += line_length + 1; line_length = 0; - y += line_height; + y += line_height + 1; } else line_length += 1; }