line breaking
in
Programming Questions
•
2 years ago
Probably don't have to mention this, but I'm really new to processing and quite struggling with it.
I am trying to create a text to stand on a poster/page. But I also want it to break at the end of the text frame (and not care about where the end of a word might be). (i.e. I want the text to automaticly hyphenate (but not use an hyphen-symbol)
This is the code I am using now for it, but this doesn't have anything about the text breaking in it.
- String title= "BRAUN TUBE JAZZ BAND" ;
- textFont (font2,190);
- fill (255);
- textLeading (190);
- text (title, 50, height/11, width-50, height);
This code only breaks the words if they are too long to fit on one line. I thought it might be a good solution to rip the string apart and create different letters, like this. But I don't know what to do after the line hits the end of the text frame (at width-50). So Right now, the text just runs of the page.
- int x = 100;
- for (int i = 0; i < title.length(); i++) {
- text(titel.charAt(i),x,height/2);
- x += 100;
- }
So right now I am just kind of guessing what could be a way to solve it, but things I've tried (like textWidth) are not really working out.
I also thought of adding a space between every letter in the String, so that I could use some sort of wordspacing to make it look like words without spaces in between, but I cannot find a way to apply wordspacing, letterspacing or textspacing.
If anyone knows a solution to this, would be really cool. If you need a better description of my problem, feel free to tell me!
Thanks
1