Croissant Runtime
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.
 
 
crsn/examples/font/convert.c

40 lines
860 B

// Convert the xbm file to crsn
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "font.xbm"
void main() {
uint64_t digits[256];
printf("(sym FONT r15)\n");
printf("(mkbf FONT (\n");
for (int ch = 0; ch < 256; ch++) {
uint64_t symbol = 0;
for(int row = 0; row<8;row++) {
symbol <<= 8ull;
unsigned char slice = psf_bits[row*32 + (ch/32)*(32*8) + (ch%32)];
symbol |= slice;
/* // show the symbol
printf(" ; ");
for(int j=0;j<8;j++) {
if(slice&0x1) {
printf("█");
} else {
printf(" ");
}
slice >>= 1;
}
printf("\n");
//*/
}
digits[ch] = symbol;
printf(" 0x%016lx ; %d", symbol, ch);
if (ch >= 32 && ch <= 126) {
printf(" '%c'\n", ch);
} else {
printf("\n", ch);
}
}
printf("))\n");
}