float w = 10, h = 20; float x = 10, y =5; Map map = new TreeMap(); void setup(){ size(150,150); strokeWeight(2); map.put("0",new int[] {1,2,5,6,9,10,13,14}); map.put("1",new int[] {4,11} ); map.put("2",new int[] {1,6,8,7,9,14} ); map.put("3",new int[] {1,6,8,7,13,14} ); map.put("4",new int[] {2,7,8,6,13} ); map.put("5",new int[] {1,2,7,8,13,14} ); map.put("6",new int[] {1,2,7,8,13,14,9} ); map.put("7",new int[] {1,6,13} ); map.put("8",new int[] {1,2,6,7,8,9,13,14} ); map.put("9",new int[] {1,2,6,7,8,13,14} ); map.put("A",new int[] {9,2,1,6,13,7,8} ); map.put("B",new int[] {1,14,4,6,11,13,8} ); map.put("C",new int[] {1,2,9,14} ); map.put("D",new int[] {1,14,4,11,6,13} ); map.put("E",new int[] {1,2,7,9,14} ); map.put("F",new int[] {1,2,7,9} ); map.put("G",new int[] {1,2,9,14,13,8} ); map.put("H",new int[] {2,9,6,13,7,8} ); map.put("I",new int[] {1,4,11,14} ); map.put("J",new int[] {9,14,13,6} ); map.put("K",new int[] {2,9,7,5,12} ); map.put("L",new int[] {2,9,14} ); map.put("M",new int[] {9,2,3,5,6,13} ); map.put("N",new int[] {9,2,3,12,13,6} ); map.put("O",new int[] {1,2,9,14,13,6} ); map.put("P",new int[] {1,2,6,7,8,9} ); map.put("Q",new int[] {1,2,6,9,14,13,12} ); map.put("R",new int[] {1,2,6,7,8,9,12} ); map.put("S",new int[] {1,2,7,8,13,14} ); map.put("T",new int[] {1,4,11} ); map.put("U",new int[] {2,9,14,13,6} ); map.put("V",new int[] {2,9,10,5} ); map.put("W",new int[] {2,9,14,13,6,11} ); map.put("X",new int[] {3,10,5,12} ); map.put("Y",new int[] {3,5,11} ); map.put("Z",new int[] {1,5,10,14} ); map.put(" ",new int[] {} ); map.put(".",new int[] {0} ); map.put(",",new int[] {10} ); map.put("!",new int[] {4,11,0} ); map.put("?",new int[] {1,2,6,8,11,0} ); Iterator i = map.keySet().iterator(); while(i.hasNext()){ String s = (String)i.next(); stroke(0); if(s.equals("?")){stroke(255,0,0); } drawChar(s, x,y,w,h); x+= w*1.5; if(x >= width-w){ x = 10; y += 30; } } } void draw(){ } void drawChar(String c, float x, float y, float w, float h){ int[] segs = (int[])map.get(c); if(segs == null) return; for(int i = 0; i < segs.length; i++){ switch(segs[i]){ case 1: line(x,y,x+w,y); break; case 2: line(x,y,x,y+(h/2));break; case 3: line(x,y,x+(w/2),y+(h/2));break; case 4: line(x+(w/2),y,x+(w/2),y+(h/2));break; case 5: line(x+w,y,x+(w/2),y+(h/2)); break; case 6: line(x+w,y,x+w,y+(h/2));break; case 7: line(x,y+(h/2),x+(w/2),y+(h/2));break; case 8: line(x+(w/2),y+(h/2),x+w,y+(h/2));break; case 9: line(x,y+(h/2),x,y+h);break; case 10: line(x,y+h,x+w/2,y+h/2);break; case 11: line(x+w/2,y+h/2,x+w/2,y+h);break; case 12: line(x+w/2,y+h/2,x+w,y+h);break; case 13: line(x+w,y+h/2,x+w,y+h);break; case 14: line(x,y+h,x+w,y+h);break; case 0: line(x+w/2-w/6,y+h+h/6,x+w/2+w/6,y+h+h/6);break; default: break; } } }