Multiple Lines of Text in Geomerative?
in
Contributed Library Questions
•
2 years ago
- /*
- * geomerative example
- * http://www.ricardmarxer.com/geomerative/
- *
- * einen font laden aus einer (win) truetype datei
- *
- * fjenett 20080417
- * fjenett 20081203 - updated to geomerative 19
- */
- import geomerative.*;
- RFont font;
- void setup()
- {
- size(400,400);
- smooth();
- RG.init(this);
- font = new RFont( "lucon.ttf", 80, RFont.CENTER);
- }
- void draw()
- {
- background(255);
- translate(width/2,height/2.0+font.size/3.0); // optische mitte?
- font.draw("Hell\no");
- }
Renders:
without having to use
String[]
like this?
- /*
- * geomerative example
- * http://www.ricardmarxer.com/geomerative/
- *
- * einen font laden aus einer (win) truetype datei
- *
- * fjenett 20080417
- * fjenett 20081203 - updated to geomerative 19
- */
- import geomerative.*;
- int textHeight = 80;
- RFont font;
- String[] lines = {
- "hell",
- "o"
- };
- void setup()
- {
- size(400,400);
- smooth();
- RG.init(this);
- font = new RFont( "lucon.ttf", textHeight, RFont.CENTER);
- }
- void draw()
- {
- background(255);
- translate(width/2,height/2.0+font.size/3.0); // optische mitte?
- for(int i = 0; i < lines.length; i++) {
- pushMatrix();
- translate(0, i * textHeight);
- font.draw(lines[i]);
- popMatrix();
- }
- }
1