We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm about ready to file this as a bug, but just to be sure; anyone else trouble getting certain font styles to work in Processing? I seem to have invariably trouble getting Light variants of fonts to work, and whether condensed works seems arbitrary.. Tested both the behaviour of createFont and loadFont, but they seem the same.
See test sketch below:
PFont light, lightItalic, normal, normalItalic, bold, boldItalic, black; void setup() { size(800, 800); //println(PFont.list()); //normal = createFont("Helvetica", 100); //light = createFont("Helvetica-Light", 100); //bold = createFont("Helvetica-Bold", 100); light = createFont("GillSans-Light", 100); lightItalic = createFont("GillSans-LightItalic", 100); normal = createFont("GillSans", 100); normalItalic = createFont("GillSans-Italic", 100); bold = createFont("GillSans-Bold", 100); boldItalic = createFont("GillSans-BoldItalic", 100); black = createFont("GillSans-UltraBold", 100); } void draw() { textAlign(CENTER, CENTER); int numLines = 8; textFont(light); text("PROCESSING", width/2, height/numLines*1); textFont(lightItalic); text("PROCESSING", width/2, height/numLines*2); textFont(normal); text("PROCESSING", width/2, height/numLines*3); textFont(normalItalic); text("PROCESSING", width/2, height/numLines*4); textFont(bold); text("PROCESSING", width/2, height/numLines*5); textFont(boldItalic); text("PROCESSING", width/2, height/numLines*6); textFont(black); text("PROCESSING", width/2, height/numLines*7); }
Answers
Jesus christ, how do you get code to format properly?!
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text#latest
OK, no-one?
We are still waiting for a readable code... :-) Edit your message and reformat it, please.
Haha fair enough, here you go. Knock yourself out with this amazingly formatted code ;)
Anyway, I tried a variant of your sketch, on Windows 7, with another font:
The first version uses the names shown by PFont.list(). It works. The second version (the first I tried) uses the names I can see in the Wordpad font menu. It works too!
Not sure if your problem is tied to the font you use (OTF? TTF?) or to your system or something else.
Quicksand is an OTF font. The variants come from different files.
Hi,
I seem to be having a similar issue. I'm on OS X 10.10.3 using processing 2.2.1
Mmm, re-reading the first post, I was a bit off. Here is a new version with a font with various weights and widths:
Still looking OK in Windows.
here's an output of the code above from OS X
OK, so if you have Myriad Pro with all these variants, then indeed you have a problem on OS X.
Hi both, there's definitely a discrepancy between OSX and Windows, though difficult to test further with the limited fonts I have installed. For one, the naming convention seems different. Spaces are not replaced/concatenated in my 3.0a5 on windows; the only way I can get the fonts created properly in Windows (8.1) is as per below (which confirms the format Pfont.list() prints out):
However, as I tried conveying in my first post, on the OSX side, things are much stranger-some entire fonts are not working, some are - mostly it's a few of the styles not working, most notably any "Light" or "Black" font versions. This seems related to the font files: