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.
Page Index Toggle Pages: 1
creating fonts (Read 282 times)
creating fonts
Oct 24th, 2009, 9:07am
 
Hi,

I have some questions about creating fonts. Does Processing use  Java logical fonts? I think so, because the createFont() method works well when one of the five logical names ( "Serif", "SansSerif", "Monospaced", "Dialog", "DialogInput" ) is passed to it .
However, even other names, say "DonaldDuck", are accepted logical font names! Why?
As concerns the latest version of Processing (1.0.9) , the code
hint (ENABLE_NATIVE_FONTS)
seems to have no effect.
The program below shows some ways to create font. Are there other ways?

size(200,200, JAVA2D);
PFont fonte;
fonte = loadFont("HoeflerText-Black-48.vlw");
// bitmap font created and inserted in "data" folder
textFont(fonte, 12);
fill(10, 20, 250, 80);
textAlign(RIGHT);
text("pippo pippo non lo sa", 10, 14,  35, 70);
textFont(fonte, 94);
textAlign(LEFT);
fill(200, 0, 0, 100);
text("ppnls", 25, 5, 150, 190);
fonte = createFont("Serif", 10, false); // Java logical font
textFont(fonte, 80);
fill(0, 200, 0, 170);
rotate(PI/6);
text("LO SO", 20, 20, 280, 280);
fonte = createFont("cmsy10", 10, true); // system font (not in "data")
textFont(fonte, 80);
fill(0, 20, 150, 170);
rotate(PI/12);
text("ECCO", 20, 20, 280, 280);
fonte = createFont("grunge.ttf", 10, true);
// vector font in "data" folder
textFont(fonte, 80);
fill(100, 100, 0, 170);
rotate(-PI/6);
text("qui", 20, 20, 280, 280);
save("finestrella.gif");
Page Index Toggle Pages: 1