We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I'm using the below function to display text, but I'm displaying it on a letter-by-letter basis.
void displayText(String message, int x, int y, int w){
int h = 0;
for (int i = 0; i < message.length(); i++) {
if(message.charAt(i) == (' ') && x > w-50){
h += 8;
}
}
tbTranslate();
rotateY(radians(6));
fill(50,160);
noStroke();
rectMode(CORNER);
rect((x-40)-((x+80)/2), (y-40)-((y+20)/2), w+80, h+60);
fill(255);
translate(-30,-30,1);
textSize(32);
textFont(font);
for (int i = 0; i < message.length(); i++) {
text(message.charAt(i), x+textBoxX/2, y-(textBoxY/2-40));
x += textWidth(message.charAt(i));
if(message.charAt(i) == (' ') && x > w-50){
y += 32;
x=0;
}
}
}
But the letter spacing is very weird, it's inconsistent. I've found that it spaces individual characters consistently (example, it always spaces the "n" very far from the next character and the "a" very close to the next character), but is there something I can do for this function to space the letters a bit more naturally?
Anyone interested can check out the full project here: https://www.dropbox.com/sh/uy3jtdov9s153wd/AACEYyk8QT7YdqNe8QpRGU-Ea?dl=0
Thanks in advance!
Answers
I'm struggling to understand your code and when I try to run the whole code (trough the link you provided) It keeps on using more memory until it crashes, at one point it used 1.5GB ram.
Concerning your problem, I think you wanna space letters based of text width, that's how I would space letters if I wanted to display them letter by letter
I really like the art style your using and I'm also dutch so I can easily follow the story :P