PImage pxl; final int OFFSET = 10; final int OVERLAP_X = 5; final int OVERLAP_Y = 5; int[][][] glyphs = {{{0,0,1,1,0}, {0,1,0,1,0}, {0,0,0,1,0}, {0,0,0,1,0}, {0,0,0,1,0}, {0,0,0,1,0}, {0,0,0,1,0}}, {{0,1,1,1,0}, {1,0,0,0,1}, {0,0,0,1,0}, {0,0,1,0,0}, {0,1,0,0,0}, {1,0,0,0,0}, {1,1,1,1,1}}, {{0,1,1,1,0}, {1,0,0,0,1}, {0,0,0,0,1}, {0,0,1,1,0}, {0,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0}}, {{0,0,0,1,0}, {0,0,1,1,0}, {0,1,0,1,0}, {1,0,0,1,0}, {1,1,1,1,1}, {0,0,0,1,0}, {0,0,0,1,0}}, {{1,1,1,1,1}, {1,0,0,0,0}, {1,1,1,1,0}, {0,0,0,0,1}, {0,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0}}, {{0,1,1,1,0}, {1,0,0,0,0}, {1,0,0,0,0}, {1,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0}}, {{1,1,1,1,1}, {0,0,0,0,1}, {0,0,0,1,0}, {0,0,1,0,0}, {0,1,0,0,0}, {0,1,0,0,0}, {0,1,0,0,0}}, {{0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0}}, {{0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,1}, {0,0,0,0,1}, {0,0,0,0,1}, {0,1,1,1,0}}, {{0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {1,0,1,0,1}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0}}, {{0,0,1,0,0}, {0,1,0,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {1,1,1,1,1}, {1,0,0,0,1}, {1,0,0,0,1}}, {{1,1,1,1,0}, {1,0,0,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1,1,1,1}, {0,0,0,0,1}, {0,0,0,1,0}, {0,0,1,0,0}, {0,1,0,0,0}, {1,0,0,0,0}, {1,1,1,1,1}}, {{0,1,0,0,0}, {0,1,0,0,0}, {0,1,0,0,0}, {0,1,0,0,0}, {0,1,0,0,0}, {0,0,0,0,0}, {0,1,0,0,0}}, {{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,1,0,0,0}}, {{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,1,0,0}, {0,1,0,0,0}, {0,1,0,0,0}}, {{0,0,0,0,0}, {1,1,1,1,1}, {1,0,0,0,1}, {1,0,0,0,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,0,0,0,0}} }; void draw_glyph(int[][] g, int x, int y) { for(int i=0; i < g.length; i++) { for(int j=0; j < g[i].length; j++) { if(g[i][j] == 1) { image(pxl,j*(pxl.width - OVERLAP_X) + x,i*(pxl.height - OVERLAP_Y) + y); } } } } void bernstein_setup() { pxl = loadImage("pixel8x8.png"); } void bernstein_draw_char(char c, int x, int y) { if((c>='A')&&(c<='Z')) draw_glyph(glyphs[c-'A'+10], x, y); else if((c>='a')&&(c<='z')) draw_glyph(glyphs[c-'a'+10], x, y); else if((c>='1')&&(c<='9')) draw_glyph(glyphs[c-'0'-1], x, y); else if(c=='0') draw_glyph(glyphs[c-'0'+9], x, y); else if(c=='!') draw_glyph(glyphs[36], x, y); else if(c=='.') draw_glyph(glyphs[37], x, y); else if(c==',') draw_glyph(glyphs[38], x, y); else if(c=='%') draw_glyph(glyphs[39], x, y); } int bernstein_get_glyph_width() { return (pxl.width-OVERLAP_X)*6; } int bernstein_get_glyph_height() { return (pxl.height-OVERLAP_Y)*7; }