We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Stoke and Rotate Text
Page Index Toggle Pages: 1
Stoke and Rotate Text (Read 1704 times)
Stoke and Rotate Text
Nov 22nd, 2005, 3:55am
 
Is anyone aware of a way to stroke and/or rotate text? I appreciate your thoughts on this frustratingly simple question...

Matt
Re: Stoke and Rotate Text
Reply #1 - Nov 22nd, 2005, 2:27pm
 
Re: Stoke and Rotate Text
Reply #2 - Nov 22nd, 2005, 4:09pm
 
Hahaha. Very nicely done.

Thank you for the help with the rotate. Anyone have any ideas on how to stroke (outline) text?

Matt
Re: Stoke and Rotate Text
Reply #3 - Nov 22nd, 2005, 4:52pm
 
I think outlining text may have to go in the suggestion box. I tried cheating by putting smaller text in front of larger text but it really doesn't work at all.
Code:

PFont font;
textOutline hello;
void setup(){
size(400,200);
font = loadFont("BookmanOldStyle-Bold-48.vlw");
hello = new textOutline("Hello World");
textFont(font, 70);
textAlign(CENTER);
}
void draw(){
background(0);

translate(20,height/2);
hello.draw();
}
class textOutline{
String label;
textOutline(String label){
this.label = label;
}
void draw(){
float xStep = 0.0;
for(int i = 0; i < label.length(); i++){
String letter = str(label.charAt(i));
fill(255);
text(letter,xStep,0);
textSize(52);
fill(0);
text(letter,xStep,-2);
textSize(60);
xStep += textWidth(letter);
}
}
}

You'll need to look up pushMatrix() and popMatrix() for moving you text around though so you can get on with some stacked moving about routines.
Re: Stoke and Rotate Text
Reply #4 - Nov 22nd, 2005, 6:53pm
 
Thanks for that. I was working on the same thing. Indeed, it doesn't work very well.

I'll find the suggestion box, and drop a note in there. If anyone has any other ideas, I'd love to hear them...

Matt
Re: Stoke and Rotate Text
Reply #5 - Nov 23rd, 2005, 1:54am
 
There could be many ways but they are not so lite in terms of cpu. One could be, for instance, apply a blur in the same text in the back, of course with a different color, and then checking the levels of color decide if to remove the blurness. An other could be to apply the dilation http://www.cee.hw.ac.uk/hipr/html/dilate.html to the text in the back.
In both cases to make it more versatile you should handle each word as image, maybe using also an alpha channel.

I hope this helps, chr
Re: Stoke and Rotate Text
Reply #6 - Nov 23rd, 2005, 12:22pm
 
Would it be suitable for you to use/make an outline font?
Re: Stoke and Rotate Text
Reply #7 - Nov 23rd, 2005, 10:25pm
 
Gabon - interesting ideas, I hadn't thought of either of those. Seems like a lot just to stroke some text... I'm also not so sure about bringing the words in as images. I was hoping to keep them as vectors.

Beachmeat - that would work, but I'm not sure how to go about doing that exactly.

What would work is if I could import a vector, say an Illustrator EPS, but I've been unable to determine if that is possible either.
Re: Stoke and Rotate Text
Reply #8 - Nov 23rd, 2005, 11:11pm
 
Well, in my case the idea was to create an image runtime from the vector. Btw, you can get the outline of the text using awt objects to get the text coordinates: http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1105733642;start=4

cheers, chr
Page Index Toggle Pages: 1