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 & HelpIntegration › Help needed with displaying text in Eclipse IDE
Page Index Toggle Pages: 1
Help needed with displaying text in Eclipse IDE (Read 2336 times)
Help needed with displaying text in Eclipse IDE
Feb 12th, 2010, 1:30pm
 
Hi I have the following code written in Eclipse.

PFont font;
// The font must be located in the sketch's
// "data" directory to load successfully
font = loadFont("FFScala-32.vlw");
textFont(font);
text("word", 15, 30);

However when I ran the program I got the following error:
Could not load font /lib/FFScala-32.vlw. Make sure that the font has been copied to the data folder of your sketch.

Does anyone know where to get the font file, or are there other ways of typing text in Eclipse IDE?

Thanks,

Paul
Re: Help needed with displaying text in Eclipse IDE
Reply #1 - Feb 13th, 2010, 8:04am
 
Personally I find it easier to create the font when I need it e.g.
Code:
PFont font;
// Name system font and reqd size
font = createFont("Arial",14);
textFont(font);
text("word", 15, 30);


You said Quote:
Does anyone know where to get the font file
do you really not have this file - where is the code in Eclipse coming from?

If you manage to find the "FFScala-32.vlw" file then copy it inside the Eclipse project src folder, that should do the trick.
Re: Help needed with displaying text in Eclipse IDE
Reply #2 - Feb 13th, 2010, 3:06pm
 
Hi Quark

Thanks a lot for your reply.

<quote>do you really not have this file - where is the code in Eclipse coming from?</quote>

I just imported the core.jar file into my Java project in Eclipse.
I am not sure where to find the FFScala-32.vlw file.

Could you please advise?

Thanks,

Paul
Re: Help needed with displaying text in Eclipse IDE
Reply #3 - Feb 13th, 2010, 6:04pm
 
Also, could anyone please advise me how to change colors of text ?

There does not seem to be any methods in the Reference:
Typography
PFont
Loading & Displaying
createFont()
loadFont()
text()
textFont()
Attributes
textAlign()
textLeading()
textMode()
textSize()
textWidth()
Metrics
textAscent()
textDescent()

And I tried stroke (100, 100, 100), and that did not work...

Thanks a lot.

Paul
Re: Help needed with displaying text in Eclipse IDE
Reply #4 - Feb 13th, 2010, 8:02pm
 
You create the file with the Processing editor.

Processing Reference / Environment
Menu > Tools > Create Font...

I don't know if there is a separate method for creating/saving the .vlw font files.

I'm not sure where the file, once generated, needs to be put when building the project in Eclipse.

From the reference for text():

Quote:
Change the color of the text with the fill() function.


-spxl
Re: Help needed with displaying text in Eclipse IDE
Reply #5 - Feb 14th, 2010, 4:00am
 
I assume you have downloaded Processing and if you haven't done so already I would strongly recommend the proclipsing plugin for Eclipse as this will make using Processing and contributed libraries easier in Eclipse.

Once you have created the vlw font file then it needs to be copied to the src folder in your project. If you are including lots of other files for images, sounds etc in you project I recommend creating a new folder called data (the floder name must be called data to work with the Processing libraries) inside the src folder and store everything there.


Page Index Toggle Pages: 1