Geomerative - vertical typography
in
Contributed Library Questions
•
2 years ago
Hi!
Is there a simple solution for constant space between letters if they are written vertically? I figure out how to do it, it works good if there is no animation, in animation it slows down whole application (I don't know why). There is no option for obtaining the height of a font, so I treat them as a RShape. Part of the code:
import geomerative.*;
import processing.opengl.*;
String message="Hello world!";
RShape grp,grp2;
void setup(){
size(600,600);
frameRate(24);
background(255);
fill(255,102,0);
stroke(0);
RG.init(this);
smooth();
}
void draw(){
background(255);
noFill();
stroke(0,0,200,150);
float y=50;
float y2;
translate (200,y);
for (int m=0; m<message.length(); m++)
{
if (message.length()-m>1)
{
String bla2=Character.toString(message.charAt(m+1));
stroke(255,255,255);
grp2 = RG.getText(bla2, "FreeSans.ttf", 30, CENTER);
grp2.draw();
};
stroke(0);
String bla=Character.toString(message.charAt(m));
grp = RG.getText(bla, "FreeSans.ttf", 30, CENTER);
grp.draw();
if (grp2.getOrigHeight()>-100000)
{
y2= 20+grp2.getOrigHeight();
}
else
{ y2=30;};
println(y);
println(y2);
translate (0,y2);
y=y2;
};
}
Is there a simple solution for constant space between letters if they are written vertically? I figure out how to do it, it works good if there is no animation, in animation it slows down whole application (I don't know why). There is no option for obtaining the height of a font, so I treat them as a RShape. Part of the code:
import geomerative.*;
import processing.opengl.*;
String message="Hello world!";
RShape grp,grp2;
void setup(){
size(600,600);
frameRate(24);
background(255);
fill(255,102,0);
stroke(0);
RG.init(this);
smooth();
}
void draw(){
background(255);
noFill();
stroke(0,0,200,150);
float y=50;
float y2;
translate (200,y);
for (int m=0; m<message.length(); m++)
{
if (message.length()-m>1)
{
String bla2=Character.toString(message.charAt(m+1));
stroke(255,255,255);
grp2 = RG.getText(bla2, "FreeSans.ttf", 30, CENTER);
grp2.draw();
};
stroke(0);
String bla=Character.toString(message.charAt(m));
grp = RG.getText(bla, "FreeSans.ttf", 30, CENTER);
grp.draw();
if (grp2.getOrigHeight()>-100000)
{
y2= 20+grp2.getOrigHeight();
}
else
{ y2=30;};
println(y);
println(y2);
translate (0,y2);
y=y2;
};
}
1