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 › PFont and general font question
Page Index Toggle Pages: 1
PFont and general font question (Read 1739 times)
PFont and general font question
Nov 23rd, 2008, 5:00am
 
I'm not exactly sure where to place this, but I assume PFont is implemented in openGL, so I'm imagining it belongs here.

I am writing a library for processing using eclipse, and I need to use PFont, or any other nice font rendering library. How do I do this in eclipse? Whenever I try to use PFont, I get an error that states, correctly, that the loader cannot find the processing font file anywhere. Is there any specific place I should put it?

Thanks
Re: PFont and general font question
Reply #1 - Nov 23rd, 2008, 1:14pm
 
If using Eclipse, you should specify the absolute path to the font (assuming you are looking for a .vlw file).
If using the P5 ide, just put the file in the "data" folder of your sketch.
Re: PFont and general font question
Reply #2 - Nov 24th, 2008, 4:39am
 
Absolute addresses sound tricky, especially considering I'm writing this on Mac OS X for distribution on windows. How do I represent the paths?

Also, how fast is PFont compared to other libraries? I might need my text to be something other than black and white, but that's expendable. Is there anything faster that I might use? Because I have a *very* large amount of text to display, and I need it to be constantly updated.

Also, since the text I'm working with will be somewhat modular, would it be possible to turn a piece of text into a bitmap on the fly and manipulate it using the PImage lib?
Re: PFont and general font question
Reply #3 - Nov 24th, 2008, 5:03am
 
use loadFont(), and have a "data" folder in your eclipse project directory. you should never use absolute paths, unless it's a case where you truly need it. avoiding cross platform issues is the whole point of having the data folder.
Re: PFont and general font question
Reply #4 - Dec 4th, 2008, 3:20pm
 
sry for the wrong response post about absolute paths and thansk (again) to you ben ;-}
Re: PFont and general font question
Reply #5 - Dec 5th, 2008, 12:38pm
 
jfasi wrote on Nov 24th, 2008, 4:39am:
Also, how fast is PFont compared to other libraries [...]

Also, since the text I'm working with will be somewhat modular, would it be possible to turn a piece of text into a bitmap on the fly and manipulate it using the PImage lib

Probably quite fast because precisely the TrueType fonts are converted to bitmap (if you open a vlw file with an hex editor, you can see some patterns in shapes of letters...). So displaying text is as fast as blitting bitmap, minus possible colorization and resizing. At least, it is much faster than using a pure vector font (without cache).
I guess the best performance (and at least display quality) is reached by generating the font at the size you will use.

To have a bitmap version of your text, just use text() on a PGraphics.
Page Index Toggle Pages: 1