ref: c74a408b9b3aa71a716a10496a72a8da707fa2eb
parent: 801ff4c1769a417308965b9bbf64630ec91a981a
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Sat Apr 13 07:38:32 EDT 2024
add new fonts, edit font system to use webdisplay font files
--- a/src/SDL2_inprint.h
+++ b/src/SDL2_inprint.h
@@ -1,13 +1,13 @@
-// Bitmap font routine by driedfruit, https://github.com/driedfruit/SDL_inprint
+// Based on bitmap font routine by driedfruit, https://github.com/driedfruit/SDL_inprint
// Released into public domain.
-// Modified to support adding a background to text.
#ifndef SDL2_inprint_h
#define SDL2_inprint_h
+#include "inline_font.h"
#include <SDL.h>
-extern void prepare_inline_font(unsigned char bits[],int font_width, int font_height);
+extern void prepare_inline_font(struct inline_font *font);
extern void kill_inline_font(void);
extern void inrenderer(SDL_Renderer *renderer);
--- a/src/command.c
+++ b/src/command.c
@@ -58,6 +58,7 @@
{decodeInt16(recv_buf, 5), decodeInt16(recv_buf, 7)}, // size w/h {recv_buf[9], recv_buf[10], recv_buf[11]}}; // color r/g/b+ //SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION,"x:%i, y:%i, w:%i, h:%i",rectcmd.pos.x,rectcmd.pos.y,rectcmd.size.width,rectcmd.size.height);
draw_rectangle(&rectcmd);
return 1;
}
@@ -144,7 +145,8 @@
break;
}
- char *hwtype[4] = {"Headless", "Beta M8", "Production M8", "Production M8 Model:02"};+ char *hwtype[4] = {"Headless", "Beta M8", "Production M8",+ "Production M8 Model:02"};
static int system_info_printed = 0;
@@ -155,22 +157,18 @@
}
if (recv_buf[1] == 0x03) {- set_mk2_mode(1);
+ set_m8_model(1);
} else {- set_mk2_mode(0);
+ set_m8_model(0);
}
- if (recv_buf[5] == 0x01) {- set_large_mode(1);
- } else {- set_large_mode(0);
- }
+ set_font_mode(recv_buf[5]);
+
return 1;
break;
}
default:
-
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Invalid packet\n");
dump_packet(size, recv_buf);
return 0;
--- /dev/null
+++ b/src/font1.h
@@ -1,0 +1,15 @@
+#include "inline_font.h"
+
+struct inline_font font_v1_small = {+ 470,
+ 7,
+ 8,
+ 10,
+ 0,
+ 0,
+ 3,
+ 9938,
+ {66,77,210,38,0,0,0,0,0,0,54,0,0,0,40,0,0,0,214,1,0,0,7,0,0,0,1,0,24,0,0,0,0,0,156,38,0,0,196,14,0,0,196,14,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,0,0,0,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,2\ No newline at end of file
+ };
+
+
--- /dev/null
+++ b/src/font2.h
@@ -1,0 +1,13 @@
+#include "inline_font.h"
+
+struct inline_font font_v1_large = {+ 752,
+ 9,
+ 10,
+ 12,
+ 0,
+ -40,
+ 4,
+ 20358,
+ {66,77,134,79,0,0,0,0,0,0,54,0,0,0,40,0,0,0,240,2,0,0,9,0,0,0,1,0,24,0,0,0,0,0,80,79,0,0,196,14,0,0,196,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,\ No newline at end of file
+ };
--- /dev/null
+++ b/src/font3.h
@@ -1,0 +1,13 @@
+#include "inline_font.h"
+
+struct inline_font font_v2_small = {+ 846,
+ 9,
+ 12,
+ 14,
+ 0,
+ -2,
+ 3,
+ 22914,
+ {66,77,130,89,0,0,0,0,0,0,54,0,0,0,40,0,0,0,78,3,0,0,9,0,0,0,1,0,24,0,0,0,0,0,76,89,0,0,196,14,0,0,196,14,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255\ No newline at end of file
+};
--- /dev/null
+++ b/src/font4.h
@@ -1,0 +1,13 @@
+#include "inline_font.h"
+
+struct inline_font font_v2_large = {+940,
+10,
+12,
+14,
+0,
+-2,
+4,
+28254,
+{66,77,94,110,0,0,0,0,0,0,54,0,0,0,40,0,0,0,172,3,0,0,10,0,0,0,1,0,24,0,0,0,0,0,40,110,0,0,196,14,0,0,196,14,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,\ No newline at end of file
+};
--- /dev/null
+++ b/src/font5.h
@@ -1,0 +1,13 @@
+#include "inline_font.h"
+
+struct inline_font font_v2_huge = {+1128,
+12,
+15,
+16,
+0,
+-54,
+4,
+ 40662,
+ {66,77,214,158,0,0,0,0,0,0,54,0,0,0,40,0,0,0,104,4,0,0,12,0,0,0,1,0,24,0,0,0,0,0,160,158,0,0,196,14,0,0,196,14,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\ No newline at end of file
+ };
--- a/src/inline_font.h
+++ b/src/inline_font.h
@@ -2,9 +2,15 @@
#define INLINE_FONT_H_
struct inline_font {- int width;
- int height;
- unsigned char bits[];
+ const int width;
+ const int height;
+ const int glyph_x;
+ const int glyph_y;
+ const int screen_offset_x;
+ const int screen_offset_y;
+ const int text_offset_y;
+ const long image_size;
+ const unsigned char image_data[];
};
#endif
--- a/src/inline_font_large.h
+++ /dev/null
@@ -1,133 +1,0 @@
-#ifndef INLINE_FONT_LARGE_H_
-#define INLINE_FONT_LARGE_H_
-
-#include "inline_font.h"
-
-struct inline_font inline_font_large = {- 144,
- 88,
- {-0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfd, 0xf8, 0xf1, 0xe3, 0xc7, 0x8f, 0x1f,
-0x3f, 0x7e, 0xfc, 0xf8, 0xf1, 0xe3, 0xc7, 0x8f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ff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xe7, 0x4f, 0xfe, 0x7f, 0xfe, 0xff, 0xff, 0xf3, 0x3f,
-0xf3, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x4f, 0xfe, 0x0f,
-0x70, 0xef, 0xf8, 0xf3, 0x9f, 0xe7, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f,
-0xff, 0xe7, 0x4f, 0xde, 0x4e, 0xbe, 0x76, 0xf2, 0xf3, 0xcf, 0xcf, 0xcf, 0x3f,
-0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xe7, 0xff, 0x0f, 0x4c, 0x7e, 0x7b, 0xf2,
-0xff, 0xcf, 0xcf, 0x87, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xe7, 0xff,
-0xdf, 0x0e, 0xf0, 0xfd, 0xf8, 0xff, 0xcf, 0xcf, 0x33, 0x0f, 0xfc, 0x3f, 0xf0,
-0xff, 0xf3, 0xff, 0xe7, 0xff, 0xdf, 0x7e, 0xf2, 0x76, 0xf8, 0xff, 0xcf, 0xcf,
-0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0x0f, 0x7c, 0x72,
-0x2b, 0xc3, 0xff, 0xcf, 0xcf, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff,
-0xff, 0xff, 0xdf, 0x0e, 0xb0, 0x37, 0xe7, 0xff, 0x9f, 0xe7, 0xff, 0xff, 0x3f,
-0xff, 0xff, 0x7f, 0xfe, 0xff, 0xe7, 0xff, 0xff, 0x7f, 0xfe, 0x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0xfc, 0x99, 0x32, 0xff, 0x79, 0x9e, 0x67, 0x66, 0x80, 0x99,
-0xcf, 0xe7, 0x7f, 0xfe, 0x7c, 0xfe, 0xff, 0xff, 0xfc, 0x39, 0x73, 0xe6, 0x79,
-0x9e, 0xe7, 0x70, 0x8c, 0x3c, 0xcf, 0xf3, 0x7f, 0xfe, 0x79, 0xfe, 0xff, 0xff,
-0xfc, 0x43, 0xf2, 0x0c, 0x7c, 0x3e, 0xf0, 0x79, 0x9e, 0x3c, 0xcf, 0x03, 0x7c,
-0xf8, 0x13, 0xfe, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xfc, 0xff, 0xf3, 0xff, 0xff, 0xf3, 0x7f, 0xc0, 0xff, 0xfc, 0xcf,
-0xff, 0xe4, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xf3, 0xff, 0xff, 0xf3,
-0x7f, 0xfe, 0xff, 0xfc, 0xff, 0xff, 0xe7, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xf3,
-0x01, 0x02, 0x04, 0x08, 0x10, 0x60, 0x7e, 0x80, 0x00, 0xc3, 0x07, 0xe4, 0x39,
-0x1f, 0x20, 0x40, 0x80, 0xff, 0x7f, 0xf2, 0xe4, 0xcf, 0x93, 0x27, 0x40, 0x9e,
-0x3c, 0xcf, 0xff, 0xe4, 0x3c, 0x9f, 0x24, 0x4f, 0x9e, 0xff, 0x7f, 0xf2, 0xe4,
-0xcf, 0x93, 0x67, 0x7e, 0x9e, 0x3c, 0xcf, 0xff, 0x64, 0x3e, 0x9f, 0x24, 0x4f,
-0x9e, 0xff, 0x01, 0xf2, 0xe4, 0xcf, 0x13, 0x60, 0x7e, 0x80, 0x3c, 0xcf, 0xff,
-0x04, 0x3f, 0x9f, 0x24, 0x4f, 0x9e, 0xff, 0x79, 0xf2, 0xe4, 0xcf, 0x93, 0x7f,
-0xfe, 0x9f, 0x3c, 0xcf, 0xff, 0x64, 0x3e, 0x9f, 0x24, 0x4f, 0x9e, 0xff, 0x79,
-0xf2, 0xe4, 0xcf, 0x93, 0x7f, 0xfe, 0x9f, 0x3c, 0xcf, 0xff, 0xe4, 0x3c, 0x9f,
-0x24, 0x4f, 0x9e, 0xff, 0x01, 0x02, 0x04, 0x08, 0x10, 0x60, 0x7e, 0x80, 0x3c,
-0x01, 0x02, 0xe4, 0x09, 0x90, 0x24, 0x4f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0x07, 0x78, 0x1e, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x79, 0x9e, 0xe7,
-0xff, 0xff, 0x00, 0x01, 0x02, 0x04, 0x08, 0x90, 0x27, 0x4f, 0x92, 0x3c, 0x79,
-0x02, 0xe4, 0x79, 0x9e, 0xe7, 0xff, 0xff, 0x3c, 0x79, 0xf2, 0xe7, 0x9f, 0x9f,
-0x27, 0x67, 0x92, 0x99, 0x79, 0x7e, 0xe6, 0x79, 0x9e, 0x67, 0xfc, 0xff, 0x3c,
-0x79, 0xf2, 0xe7, 0x9f, 0x9f, 0x27, 0x73, 0x92, 0xc3, 0x79, 0x3e, 0xe7, 0x79,
-0x9e, 0x27, 0xc9, 0xff, 0x00, 0x01, 0xf2, 0x07, 0x98, 0x9f, 0x27, 0x79, 0x92,
-0xe7, 0x01, 0x9e, 0xe7, 0x79, 0x9e, 0xe7, 0xe3, 0xff, 0xfc, 0x7f, 0xf2, 0xff,
-0x99, 0x9f, 0x27, 0x7c, 0x92, 0xc3, 0x7f, 0xce, 0xe7, 0x79, 0x9e, 0xe7, 0xff,
-0xff, 0xfc, 0x7f, 0xf2, 0xff, 0x99, 0x9f, 0x27, 0x7e, 0x92, 0x99, 0x7f, 0xe6,
-0xe7, 0x79, 0x9e, 0xe7, 0xff, 0xff, 0xfc, 0x7f, 0xf2, 0x07, 0x18, 0x10, 0x20,
-0x7f, 0x80, 0x3c, 0x01, 0x02, 0x04, 0x78, 0x1e, 0xe0, 0xff, 0xff }};
-
-#endif
--- a/src/inline_font_small.h
+++ /dev/null
@@ -1,84 +1,0 @@
-/*
-The FontStruction “M8stealth57”
-(https://fontstruct.com/fontstructions/show/2043303) by “trash80” is licensed
-under a Creative Commons Attribution Share Alike license
-(http://creativecommons.org/licenses/by-sa/3.0/). “M8stealth57” was originally
-cloned (copied) from the FontStruction “stealth57”
-(https://fontstruct.com/fontstructions/show/413734) by “trash80”, which is
-licensed under a Creative Commons Attribution Share Alike license
-(http://creativecommons.org/licenses/by-sa/3.0/).
-
-Used with permission from the author.
-*/
-
-#ifndef INLINE_FONT_SMALL_H_
-#define INLINE_FONT_SMALL_H_
-
-#include "inline_font.h"
-
-struct inline_font inline_font_small = {- 96,
- 64,
- {-0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf,
-0x65, 0x59, 0x96, 0x65, 0x59, 0x96, 0x65, 0x59, 0x96, 0x65, 0x59, 0x3f, 0x45,
-0x51, 0x14, 0x45, 0x51, 0x14, 0x45, 0x51, 0x14, 0x45, 0x51, 0xbf, 0xa6, 0x69,
-0x9a, 0xa6, 0x69, 0x9a, 0xa6, 0x69, 0x9a, 0xa6, 0x69, 0x3f, 0x45, 0x51, 0x14,
-0x45, 0x51, 0x14, 0x45, 0x51, 0x14, 0x45, 0x51, 0xbf, 0x65, 0x59, 0x96, 0x65,
-0x59, 0x96, 0x65, 0x59, 0x96, 0x65, 0x59, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x96, 0x65, 0x59, 0x96, 0x65, 0x59, 0x96, 0x65, 0x59,
-0x96, 0x65, 0x59, 0x14, 0x45, 0x51, 0x14, 0x45, 0x51, 0x14, 0x45, 0x51, 0x14,
-0x45, 0x51, 0x9a, 0xa6, 0x69, 0x9a, 0xa6, 0x69, 0x9a, 0xa6, 0x69, 0x9a, 0xa6,
-0x69, 0x14, 0x45, 0x51, 0x14, 0x45, 0x51, 0x14, 0x45, 0x51, 0x14, 0x45, 0x51,
-0x96, 0x65, 0x59, 0x96, 0x65, 0x59, 0x96, 0x65, 0x59, 0x96, 0x65, 0x59, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0x5f, 0xff,
-0xfb, 0x9f, 0xef, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0x5f, 0xd7, 0x20,
-0x6b, 0xef, 0x77, 0x5f, 0xef, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0x83, 0x3a, 0xad,
-0xff, 0x77, 0xbf, 0xef, 0xff, 0xff, 0xdf, 0xbf, 0xff, 0xd7, 0xe0, 0xde, 0xfe,
-0x77, 0x5f, 0x83, 0x3f, 0xf8, 0xef, 0xbf, 0xff, 0x83, 0x6b, 0xa9, 0xfe, 0x77,
-0xff, 0xef, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xd7, 0xa0, 0x69, 0xff, 0x77, 0xff,
-0xef, 0xfb, 0xff, 0xfb, 0xbf, 0xff, 0xff, 0xfb, 0x9f, 0xfe, 0xaf, 0xff, 0xff,
-0xfb, 0xbf, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xe0, 0x0e, 0x82, 0x2e, 0x08, 0x82, 0x21, 0xf8, 0xff, 0xff, 0xff,
-0xc7, 0x2e, 0xfe, 0xbe, 0xae, 0xef, 0xbf, 0xae, 0xfb, 0xff, 0xf7, 0xdf, 0xbb,
-0xe6, 0xfe, 0xbe, 0xae, 0xef, 0xbf, 0xae, 0xdb, 0xf7, 0x33, 0x98, 0xbf, 0xea,
-0x0e, 0x82, 0x20, 0x08, 0xde, 0x20, 0xf8, 0xff, 0xf1, 0x1f, 0xdf, 0xec, 0xee,
-0xbf, 0xef, 0xeb, 0xee, 0xee, 0xfb, 0xff, 0x33, 0x98, 0xef, 0xee, 0xee, 0xbf,
-0xef, 0xeb, 0xee, 0xee, 0xdb, 0xf7, 0xf7, 0xdf, 0xff, 0x20, 0x08, 0x82, 0x2f,
-0x08, 0xee, 0xf0, 0xfb, 0xf7, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x71, 0x0c, 0xc7, 0x30, 0x08, 0xc6,
-0x2e, 0xf8, 0xba, 0xbe, 0xeb, 0xc6, 0xae, 0xeb, 0xba, 0xae, 0xef, 0xbb, 0xee,
-0xfe, 0xda, 0x3e, 0xc9, 0xba, 0xa2, 0xeb, 0xfa, 0xae, 0xef, 0xfb, 0xee, 0xfe,
-0xea, 0xbe, 0xaa, 0xba, 0x2a, 0x08, 0xfb, 0x2e, 0x0c, 0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0xbb, 0x3b, 0x08,
-0x82, 0xff, 0xeb, 0xfa, 0xae, 0xbb, 0xbb, 0xee, 0x7e, 0xdb, 0xbb, 0xea, 0xba,
-0x3f, 0xe8, 0xfa, 0x2e, 0xb8, 0x83, 0xee, 0x7e, 0xeb, 0xbb, 0xea, 0xba, 0xbf,
-0xeb, 0xfa, 0xae, 0xbf, 0xbf, 0xee, 0x7e, 0xd3, 0xbb, 0xea, 0xba, 0x3f, 0x08,
-0x82, 0x20, 0xb8, 0x83, 0x6e, 0x8c, 0xbb, 0xb1, 0xea, 0x82, 0xff, 0xff, 0xff,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb,
-0xff, 0xff, 0xff, 0xff, 0x83, 0x3b, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff,
-0xff, 0xff, 0xff, 0xbb, 0xbb, 0xdb, 0xfe, 0x20, 0x08, 0x82, 0xa0, 0xeb, 0xaa,
-0xae, 0x0b, 0xba, 0xbb, 0x2b, 0xff, 0xae, 0xeb, 0xfb, 0xbb, 0xeb, 0xaa, 0xb5,
-0x7b, 0xbb, 0xbb, 0xfa, 0xff, 0xae, 0xeb, 0x83, 0xbb, 0x6b, 0xab, 0x3b, 0xb8,
-0xbb, 0xbb, 0xfb, 0xff, 0x20, 0xe8, 0xbf, 0xbb, 0xab, 0xab, 0xf5, 0xdb, 0xbb,
-0xbb, 0xfb, 0xff, 0xfe, 0xeb, 0x83, 0x23, 0xc8, 0x83, 0x2e, 0x08, 0x82, 0x3b,
-0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-0xff }};
-
-#endif
--- a/src/inprint2.c
+++ b/src/inprint2.c
@@ -2,25 +2,24 @@
// https://github.com/driedfruit/SDL_inprint Released into public domain.
// Modified to support multiple fonts & adding a background to text.
+#include "inline_font.h"
#include <SDL.h>
-#define CHARACTERS_PER_ROW 16 /* I like 16 x 8 fontsets. */
-#define CHARACTERS_PER_COLUMN 8 /* 128 x 1 is another popular format. */
+#define CHARACTERS_PER_ROW 94
+#define CHARACTERS_PER_COLUMN 1
static SDL_Renderer *selected_renderer = NULL;
static SDL_Texture *inline_font = NULL;
static SDL_Texture *selected_font = NULL;
+static struct inline_font *selected_inline_font;
static Uint16 selected_font_w, selected_font_h;
-void prepare_inline_font(unsigned char * bits, int font_width,
- int font_height) {- Uint32 *pix_ptr, tmp;
- int i, len, j;
+void prepare_inline_font(struct inline_font *font) {SDL_Surface *surface;
- Uint32 colors[2];
- selected_font_w = font_width;
- selected_font_h = font_height;
+ selected_font_w = font->width;
+ selected_font_h = font->height;
+ selected_inline_font = font;
if (inline_font != NULL) {selected_font = inline_font;
@@ -27,40 +26,28 @@
return;
}
- surface = SDL_CreateRGBSurface(0, font_width, font_height, 32,
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
-#else
- 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
-#endif
- );
- colors[0] = SDL_MapRGBA(surface->format, 0xFF, 0xFF, 0xFF, 0xFF);
- colors[1] = SDL_MapRGBA(surface->format, 0x00, 0x00, 0x00,
- 0x00 /* or 0xFF, to have bg-color */);
+ SDL_RWops *font_bmp = SDL_RWFromConstMem(selected_inline_font->image_data,
+ selected_inline_font->image_size);
- /* Get pointer to pixels and array length */
- pix_ptr = (Uint32 *)surface->pixels;
- len = surface->h * surface->w / 8;
+ surface = SDL_LoadBMP_RW(font_bmp, 1);
- /* Copy */
- for (i = 0; i < len; i++) {- tmp = (Uint8)bits[i];
- for (j = 0; j < 8; j++) {- Uint8 mask = (0x01 << j);
- pix_ptr[i * 8 + j] = colors[(tmp & mask) >> j];
- }
- }
+ // Black is transparent
+ SDL_SetColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 0, 0, 0));
inline_font = SDL_CreateTextureFromSurface(selected_renderer, surface);
+
SDL_FreeSurface(surface);
selected_font = inline_font;
}
+
void kill_inline_font(void) {SDL_DestroyTexture(inline_font);
inline_font = NULL;
}
+
void inrenderer(SDL_Renderer *renderer) { selected_renderer = renderer; }+
void infont(SDL_Texture *font) {Uint32 format;
int access;
@@ -103,12 +90,14 @@
s_rect.h = selected_font_h / CHARACTERS_PER_COLUMN;
d_rect.w = s_rect.w;
d_rect.h = s_rect.h;
+ // d_rect.w = selected_inline_font->glyph_x;
+ // d_rect.h = selected_inline_font->glyph_y;
if (dst == NULL)
dst = selected_renderer;
for (; *str; str++) {- int id = (int)*str;
+ int id = (int)*str - 33;
#if (CHARACTERS_PER_COLUMN != 1)
int row = id / CHARACTERS_PER_ROW;
int col = id % CHARACTERS_PER_ROW;
@@ -134,16 +123,15 @@
(Uint8)((bgcolor & 0x0000FF00) >> 8),
(Uint8)((bgcolor & 0x000000FF)), 0xFF);
bg_rect = d_rect;
- bg_rect.w = selected_font_w / CHARACTERS_PER_ROW - 1;
- // Silly hack to get big font background aligned correctly.
- if (bg_rect.h == 11) {- bg_rect.y++;
- }
+ bg_rect.w = selected_inline_font->glyph_x - 1;
+ bg_rect.h = selected_inline_font->glyph_y;
+ bg_rect.x--;
+ bg_rect.y--;
SDL_RenderFillRect(dst, &bg_rect);
}
SDL_RenderCopy(dst, selected_font, &s_rect, &d_rect);
- d_rect.x += s_rect.w;
+ d_rect.x += selected_inline_font->glyph_x;
}
}
SDL_Texture *get_inline_font(void) { return selected_font; }--- a/src/main.c
+++ b/src/main.c
@@ -3,7 +3,7 @@
/* Uncomment this line to enable debug messages or call make with `make
CFLAGS=-DDEBUG_MSG` */
-// #define DEBUG_MSG
+#define DEBUG_MSG
#include <SDL.h>
#include <signal.h>
--- a/src/render.c
+++ b/src/render.c
@@ -7,13 +7,15 @@
#include <stdio.h>
#include "SDL2_inprint.h"
-#include "SDL_video.h"
#include "command.h"
#include "fx_cube.h"
#include "inline_font.h"
-#include "inline_font_large.h"
-#include "inline_font_small.h"
+#include "font1.h"
+#include "font2.h"
+#include "font3.h"
+#include "font4.h"
+#include "font5.h"
SDL_Window *win;
SDL_Renderer *rend;
@@ -23,15 +25,17 @@
static uint32_t ticks_fps;
static int fps;
-static int large_font_enabled = 0;
-static int mk2_mode_enabled = 0;
+static int font_mode = -1;
+static int m8_hardware_model = 0;
static int screen_offset_y = 0;
+static int text_offset_y = 0;
+static int waveform_max_height = 20;
-static const int m8_mk1_texture_width = 320;
-static const int m8_mk1_texture_height = 240;
-static const int m8_mk2_texture_width = 480;
-static const int m8_mk2_texture_height = 320;
+static int texture_width = 320;
+static int texture_height = 240;
+struct inline_font *fonts[5] = {&font_v1_small, &font_v1_large, &font_v2_small,+ &font_v2_large, &font_v2_huge};
uint8_t fullscreen = 0;
@@ -39,19 +43,17 @@
// Initializes SDL and creates a renderer and required surfaces
int initialize_sdl(int init_fullscreen, int init_use_gpu) {- // ticks = SDL_GetTicks();
-
-
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "SDL_Init: %s\n", SDL_GetError());
return -1;
}
+
// SDL documentation recommends this
atexit(SDL_Quit);
win = SDL_CreateWindow("m8c", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,- m8_mk1_texture_width * 2, m8_mk1_texture_height * 2,
+ texture_width * 2, texture_height * 2,
SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL |
SDL_WINDOW_RESIZABLE | init_fullscreen);
@@ -58,10 +60,13 @@
rend = SDL_CreateRenderer(
win, -1, init_use_gpu ? SDL_RENDERER_ACCELERATED : SDL_RENDERER_SOFTWARE);
- SDL_RenderSetLogicalSize(rend, m8_mk1_texture_width, m8_mk1_texture_height);
+ SDL_RenderSetLogicalSize(rend, texture_width, texture_height);
+ maintexture = NULL;
+
maintexture = SDL_CreateTexture(rend, SDL_PIXELFORMAT_ARGB8888,
- SDL_TEXTUREACCESS_TARGET, 320, 240);
+ SDL_TEXTUREACCESS_TARGET, texture_width,
+ texture_height);
SDL_SetRenderTarget(rend, maintexture);
@@ -70,10 +75,7 @@
SDL_RenderClear(rend);
- // Initialize a texture for the font and read the inline font bitmap
- inrenderer(rend);
- struct inline_font *font = &inline_font_small;
- prepare_inline_font(font->bits, font->width, font->height);
+ set_font_mode(0);
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_INFO);
@@ -84,68 +86,64 @@
static void change_font(struct inline_font *font) {kill_inline_font();
- prepare_inline_font(font->bits, font->width, font->height);
+ inrenderer(rend);
+ prepare_inline_font(font);
}
-void set_mk2_mode(int enabled) {+static void
+check_and_adjust_window_and_texture_size(const unsigned int new_width,
+ const unsigned int new_height) {int h, w;
- if (enabled) {- mk2_mode_enabled = 1;
- // Query window size and resize if smaller than default
- SDL_GetWindowSize(win, &w, &h);
- if (w < (m8_mk2_texture_width * 2) || h < (m8_mk2_texture_height * 2)) {- SDL_SetWindowSize(win, (m8_mk2_texture_width * 2),
- (m8_mk2_texture_height * 2));
- }
+ texture_width = new_width;
+ texture_height = new_height;
- SDL_RenderSetLogicalSize(rend, m8_mk2_texture_width, m8_mk2_texture_height);
+ // Query window size and resize if smaller than default
+ SDL_GetWindowSize(win, &w, &h);
+ if (w < (texture_width * 2) || h < (texture_height * 2)) {+ SDL_SetWindowSize(win, (texture_width * 2), (texture_height * 2));
+ }
- SDL_DestroyTexture(maintexture);
- maintexture = SDL_CreateTexture(rend, SDL_PIXELFORMAT_ARGB8888,
- SDL_TEXTUREACCESS_TARGET, m8_mk2_texture_width, m8_mk2_texture_height);
+ SDL_RenderSetLogicalSize(rend, texture_width, texture_height);
- // Initialize and activate the MK2 font
- set_large_mode(large_font_enabled);
- } else if (mk2_mode_enabled == 1) {- // In the rare case that a MK2 is changed to MK1 without quitting first
-
- mk2_mode_enabled = 0;
- // Query window size and resize if smaller than default
- SDL_GetWindowSize(win, &w, &h);
- if (w < (m8_mk1_texture_width * 2) || h < (m8_mk1_texture_height * 2)) {- SDL_SetWindowSize(win, (m8_mk1_texture_height * 2),
- (m8_mk1_texture_width * 2));
- }
+ SDL_DestroyTexture(maintexture);
+ maintexture = SDL_CreateTexture(rend, SDL_PIXELFORMAT_ARGB8888,
+ SDL_TEXTUREACCESS_TARGET, texture_width,
+ texture_height);
- SDL_DestroyTexture(maintexture);
- maintexture = SDL_CreateTexture(rend, SDL_PIXELFORMAT_ARGB8888,
- SDL_TEXTUREACCESS_TARGET, m8_mk1_texture_width, m8_mk1_texture_height);
+ SDL_SetRenderTarget(rend, maintexture);
+}
- // Initialize and activate the MK2 font
- set_large_mode(large_font_enabled);
+// Set M8 hardware model in use. 0 = MK1, 1 = MK2
+void set_m8_model(unsigned int model) {+
+ switch (model) {+ case 1:
+ m8_hardware_model = 1;
+ waveform_max_height = 38;
+ check_and_adjust_window_and_texture_size(480, 320);
+ break;
+ default:
+ m8_hardware_model = 0;
+ waveform_max_height = 20;
+ check_and_adjust_window_and_texture_size(320, 240);
+ break;
}
}
-void set_large_mode(int enabled) {- if (enabled) {- large_font_enabled = 1;
- if (mk2_mode_enabled == 1) {- // TODO mk2 changes
- } else {- screen_offset_y = 40;
- change_font(&inline_font_large);
+void set_font_mode(unsigned int mode) {+ if (font_mode == mode) return;
+ if (mode >= 0 && mode <= 2) {+ if (m8_hardware_model == 1) {+ mode += 2;
}
- } else {- if (mk2_mode_enabled == 1) {- // TODO mk2 changes
- } else {- large_font_enabled = 0;
- screen_offset_y = 0;
- change_font(&inline_font_small);
- }
+ font_mode = mode;
+ screen_offset_y = fonts[mode]->screen_offset_y;
+ text_offset_y = fonts[mode]->text_offset_y;
+ change_font(fonts[mode]);
}
+ SDL_LogDebug(SDL_LOG_CATEGORY_RENDER,"Font mode %i, Screen offset %i", mode, screen_offset_y);
}
void close_renderer() {@@ -180,8 +178,8 @@
both*/
inprint(rend, (char *)&command->c, command->pos.x,
- command->pos.y + (large_font_enabled ? 2 : 3) - screen_offset_y,
- fgcolor, (bgcolor == fgcolor) ? -1 : bgcolor);
+ command->pos.y + text_offset_y + screen_offset_y, fgcolor,
+ (bgcolor == fgcolor) ? -1 : bgcolor);
dirty = 1;
@@ -193,17 +191,13 @@
SDL_Rect render_rect;
render_rect.x = command->pos.x;
- if (large_font_enabled == 1) {- render_rect.y = command->pos.y - screen_offset_y;
- } else {- render_rect.y = command->pos.y;
- }
+ render_rect.y = command->pos.y + screen_offset_y;
render_rect.h = command->size.height;
render_rect.w = command->size.width;
// Background color changed
- if (render_rect.x == 0 && render_rect.y <= 0 && render_rect.w == 320 &&
- render_rect.h >= 240) {+ if (render_rect.x == 0 && render_rect.y <= 0 &&
+ render_rect.w == texture_width && render_rect.h >= texture_height) {SDL_LogDebug(SDL_LOG_CATEGORY_SYSTEM, "BG color change: %d %d %d",
command->color.r, command->color.g, command->color.b);
background_color.r = command->color.r;
@@ -210,6 +204,7 @@
background_color.g = command->color.g;
background_color.b = command->color.b;
background_color.a = 0xFF;
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION,"x:%i, y:%i, w:%i, h:%i",render_rect.x,render_rect.y,render_rect.w,render_rect.h);
#ifdef __ANDROID__
int bgcolor =
@@ -219,7 +214,7 @@
}
SDL_SetRenderDrawColor(rend, command->color.r, command->color.g,
- command->color.b, 0xFF);
+ command->color.b, 0xFF);
SDL_RenderFillRect(rend, &render_rect);
dirty = 1;
@@ -236,12 +231,12 @@
SDL_Rect wf_rect;
if (command->waveform_size > 0) {- wf_rect.x = 320 - command->waveform_size;
+ wf_rect.x = texture_width - command->waveform_size;
wf_rect.y = 0;
wf_rect.w = command->waveform_size;
wf_rect.h = 21;
} else {- wf_rect.x = 320 - prev_waveform_size;
+ wf_rect.x = texture_width - prev_waveform_size;
wf_rect.y = 0;
wf_rect.w = prev_waveform_size;
wf_rect.h = 21;
@@ -261,8 +256,8 @@
for (int i = 0; i < command->waveform_size; i++) {// Limit value because the oscilloscope commands seem to glitch
// occasionally
- if (command->waveform[i] > 20) {- command->waveform[i] = 20;
+ if (command->waveform[i] > waveform_max_height) {+ command->waveform[i] = waveform_max_height;
}
waveform_points[i].x = i + wf_rect.x;
waveform_points[i].y = command->waveform[i];
@@ -352,7 +347,7 @@
}
void screensaver_init() {- set_large_mode(1);
+ set_font_mode(1);
fx_cube_init(rend, (SDL_Color){255, 255, 255, 255});SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Screensaver initialized");
}
@@ -364,6 +359,6 @@
void screensaver_destroy() {fx_cube_destroy();
- set_large_mode(0);
+ set_font_mode(0);
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Screensaver destroyed");
}
--- a/src/render.h
+++ b/src/render.h
@@ -12,8 +12,8 @@
void draw_waveform(struct draw_oscilloscope_waveform_command *command);
void draw_rectangle(struct draw_rectangle_command *command);
int draw_character(struct draw_character_command *command);
-void set_large_mode(int enabled);
-void set_mk2_mode(int enabled);
+void set_font_mode(unsigned int mode);
+void set_m8_model(unsigned int model);
void view_changed(int view);
void render_screen();
--
⑨