From 2ce31fb1333ce6a8ffe62c49cb9f42aac5547ae2 Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 2 Jan 2014 15:55:36 +0100 Subject: mbrtowc behaves strange. or i'm just dumb. --- host/matelight/font.c | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) (limited to 'host/matelight/font.c') diff --git a/host/matelight/font.c b/host/matelight/font.c index 753c442..53d27b9 100644 --- a/host/matelight/font.c +++ b/host/matelight/font.c @@ -5,15 +5,9 @@ #include #include -void render_glyph(glyph_t *g, char *buf, unsigned int bufwidth, unsigned int offx, unsigned int offy){ +void render_glyph(glyph_t *g, uint8_t *buf, unsigned int bufwidth, unsigned int offx, unsigned int offy){ unsigned int bitmap_row_width = g->width/8; uint8_t *bitmap = ((uint8_t *)g) + sizeof(glyph_t); - printf("READING GLYPH FROM %016lx (BITMAP %016lx) SIZE %d ROW WIDTH %d\n", g, bitmap, sizeof(glyph_t), bitmap_row_width); - char *p = bitmap; - for(int i=0; iheight; i++){ - printf("%02x ", *p++); - } - printf("\n"); for(unsigned int y=0; y < g->height; y++){ long int data = 0; for(unsigned int i=0; iwidth; x++){ - if(data&1) - printf("█"); - else - printf(" "); - *p++ = (data&1) ? 1 : 0; - data >>= 1; + *p++ = (data&(1<<(g->width-1))) ? 1 : 0; + data <<= 1; } - printf("\n"); } } @@ -175,31 +163,12 @@ int read_bdf(FILE *f, glyph_t **glyph_table, unsigned int glyph_table_size){ // Right-align data data >>= ((read-1)*4 - dwidth); // Copy rightmost bytes of data to destination buffer - if(encoding == 'A') - printf("%02d %04lx ", i, data); for(unsigned int j=0; j>= 8; } - if(encoding == 'A') - printf("\n"); i++; } - if(encoding == 'A'){ - printf("WRITING GLYPH %d TO %016lx (BITMAP %016lx) SIZE %d ROW WIDTH %d\n", encoding, glyph_data, bitmap, sizeof(glyph_t), row_bytes); - char *p = bitmap; - for(int i=0; i