#include #include "fonts.h" int render(unsigned char *input, int input_len, unsigned char *output, int max_output_len, int skip_unprintables) { memset(output, 0, max_output_len); int output_i = 0; for (int input_i=0; (input_i < input_len) && (output_i*(SYMBOL_WIDTH+1) < max_output_len); input_i++) { unsigned char c = input[input_i]; if (c >= 0x7f) { if (c <= 0xaf) { output_i += !!skip_unprintables; continue; } c -= 0xaf - 0x7f + 1; } c -= 0x20; if ((c < 0) || (c >= (sizeof(symbols) / SYMBOL_WIDTH))) { output_i += !!skip_unprintables; continue; } for (int i=0; (i