We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm attempting to load a font (Gotham) to use in my sketch and it seems to be ignoring the font weight. The font is an .otf font. Comparing with what I see in illustrator it seems all weights of the font display as "medium."
I've tried creating a .vlw in processing and I have tried using the createFont() method. Both produce the same results.
PFont myFont;
void setup(){
background(255);
fill(0);
size(500, 200);
String[] fontList = PFont.list();
println(fontList);
myFont = createFont("Gotham-ExtraLight", 32);
textFont(myFont);
text("The quick brown fox jumped over the lazy dog", 10,50);
}
Using Processing 2.2.1 on OSX Mavericks
Answers
Try textSize(32)
I think there is no way to specify font styles in Processing, except by using different fonts (different names), eg.:
DejaVuSans-Bold.ttf
DejaVuSans-BoldOblique.ttf
DejaVuSans-ExtraLight.ttf
DejaVuSans-Oblique.ttf
DejaVuSans.ttf
@XYZZY tried that but nothing changed.
@PhiLho I know I have to load in each font style individually. The problem is that processing seems to be ignoring the style I specify. For example if I were to load in DejaVuSans-Bold.ttf (or any of the other styles) it would display as DejaVuSans.ttf.
I see three different fonts.
I see three identical fonts. I note that DejaVu is not in the fontList and @PhiLho's code prints nothing to the console. Processing 2.2.1 on MacOS 10.9.4.
I saw the three fonts the same as well. I don't have DejaVu either, so I changed to Arial and it works fine. Everyones got Arial...
I see your problem, @tysonanderson. You are trying to create a font with "Gotham-ExtraLight" (note hyphen). "Arial" is listed in the create font dialoge as "ArialMT" and "Arial Bold" is listed as "Arial-BoldMT". You just got to indicate the correct name/spelling.
Thanks for your help.
I see 3 fonts as well so it seems to be working for DejaVu. It for some reason does not like Gotham. I switched my design to use Gill Sans since that seems to be working as well. I'd like to know why it doesn't work but for now I've come up with a workaround.
Added a note to the end of my last post while you were responding. I think that might be the cause. Maybe.
@XYZZY I wish that were the case. I've been copying the text directly from the PFont.list(); output so I'm certain the problem isn't a spelling error.
I think the problem is something much more complex because even when I look at gotham in the create font dialog all the font weights are exactly the same in the preview.
Oh, okay. Well, good luck.
"I see three identical fonts. I note that DejaVu is not in the fontList"
Well, it just means it uses the default font, then. That's why I have this commented out textSize(), so if I uncomment it and comment out the textFont() calls, I can see if it changes anything. If not, the font name is wrong (or not existing on the current system).