hint(ENABLE_NATIVE_FONTS) causes problems with rotated text (but only in applet export)
in
Programming Questions
•
2 years ago
I've been having a problem where rotated text displays as a stack of vertical characters, rather than as normal, left-to-right text, but I only get this behavior in the exported Java applet, not in Processing.
I have narrowed the problem to using hint(ENABLE_NATIVE_FONTS) in Processing 1.5, but I also experience the same problem in Processing 1.2.1 if I use createFont() with a native font.
Below are two screen captures from a mini-program that demonstrates the problem. On the left is output from Processing (which is correct). On the right is the output from the Java applet (which is messed up).
Here is the code for the mini-program:
In case you're thinking it might be a problem with the default font, that's not the case. The same problem persists if I load Arial using createFont("Arial",12,true) and use textFont(arial,12).
It just seems to be a problem with exporting an applet that uses native fonts, which is a real problem for me, since I'm using a lot of scaled fonts in the application I'm writing.
(NOTE: I am also posting a question about anti-aliasing of native fonts, since I can't seem to get them to anti-alias in the Java applet export, though the anti-alias fine in Processing. Not sure if this is related.)
Setup:
I have narrowed the problem to using hint(ENABLE_NATIVE_FONTS) in Processing 1.5, but I also experience the same problem in Processing 1.2.1 if I use createFont() with a native font.
Below are two screen captures from a mini-program that demonstrates the problem. On the left is output from Processing (which is correct). On the right is the output from the Java applet (which is messed up).
Here is the code for the mini-program:
- void setup() {
size(200,200);
hint(ENABLE_NATIVE_FONTS);
}
void draw() {
translate(width/2,height/2);
rotate(PI/4);
fill(0);
text("sample text",0,0);
noLoop();
}
In case you're thinking it might be a problem with the default font, that's not the case. The same problem persists if I load Arial using createFont("Arial",12,true) and use textFont(arial,12).
It just seems to be a problem with exporting an applet that uses native fonts, which is a real problem for me, since I'm using a lot of scaled fonts in the application I'm writing.
(NOTE: I am also posting a question about anti-aliasing of native fonts, since I can't seem to get them to anti-alias in the Java applet export, though the anti-alias fine in Processing. Not sure if this is related.)
Setup:
- MacBook Air
- OS X Snow Leopard
- Processing 1.5 and 1.2.1
- Firefox 4.0.1 (Java Plug-In 13.4.0)
1