Created
June 29, 2016 07:30
-
-
Save Mizzlr/e44378a455b30e7494f94c1eecf23681 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Letters. | |
* | |
* Draws letters to the screen. This requires loading a font, | |
* setting the font, and then drawing the letters. | |
*/ | |
PFont f; | |
void setup() { | |
size(571, 161); | |
// Create the font | |
printArray(PFont.list()); | |
noLoop(); | |
} | |
void draw() { | |
background(0); | |
// Set the left and top margin | |
int margin = 15; | |
translate(margin, margin); | |
int gap = 30 ; | |
for (int i = 1 ; i < PFont.list().length; i ++){ | |
background(0); | |
f = createFont(PFont.list()[i], 30); | |
textFont(f); | |
textAlign(CENTER, CENTER); | |
int counter = 35; | |
for (int y = 0; y < height-gap; y += gap) { | |
for (int x = 0; x < width-gap; x += gap) { | |
char letter = char(counter); | |
fill(255); | |
// Draw the letter to the screen | |
text(letter, x, y); | |
// Increment the counter | |
counter++; | |
} | |
} | |
saveFrame("dataset/"+str(i)+".png"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment