You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
toaster-oven-bluepill/Lib/ufb/Src/fontedit_render.inc.c

48 lines
1.4 KiB

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
void generate_glyph_tables() {
printf("static const font%dx_bitmap_t PROGMEM font%d%d_ascii[] = {\n", FONT_W, FONT_W, FONT_H);
for (int i = 32; i < 127; i++) {
uint8_t line[8] = {};
for(int j = 0; j < FONT_H; j++) {
const char *row = font_ascii[(i - 32)*FONT_H + j];
for(int k = 0; k < FONT_W; k++) {
line[k] |= (row[k] != 32) << j;
}
}
printf(" {{");
for(int k = 0; k < FONT_W; k++) {
if (k > 0) printf(", ");
printf("0x%02x", line[k]);
}
printf("}},\n");
}
printf("};\n\n");
printf("static const struct utf_glyph%dx PROGMEM font%d%d_extra[] = {\n", FONT_W, FONT_W, FONT_H);
for (int i = 0; i < sizeof(font_extras) / (sizeof(font_extras[0]) * FONT_H); i++) {
uint8_t line[8] = {};
for(int j = 0; j < FONT_H; j++) {
const char *row = font_extras[i*FONT_H + j];
for(int k = 0; k < FONT_W; k++) {
line[k] |= (row[k] != 32) << j;
}
}
printf(" {.utf={.symbol=\"%s\"}, {{", font_extras_utf[i]);
for(int k = 0; k < FONT_W; k++) {
if (k > 0) printf(", ");
printf("0x%02x", line[k]);
}
printf("}}},\n");
}
printf("};\n");
}
void main() {
generate_glyph_tables();
}