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.
IndexSuggestions & BugsSoftware Bugs › 0090 createFont trouble
Page Index Toggle Pages: 1
0090 createFont trouble (Read 2224 times)
0090 createFont trouble
May 12th, 2005, 8:02am
 
I got this error from an applet in FF on OSX w/Java 1.3.1 - the same applet for a friend on OSX w/Java 1.4 also stalled, and another friend on XP with 1.5 from sun also couldn't see it...

I was trying to load a ttf file. I hadn't realized I could convert to vlw through the menu. I did that used loadFont() - no problems.... Just wanted to mention it.

This is what I was getting out of my console:


java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)

     at java.security.AccessControlContext.checkPermission(AccessControlContext.java:267
)

     at java.security.AccessController.checkPermission(AccessController.java:394)

     at java.lang.SecurityManager.checkPermission(SecurityManager.java:540)

     at java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1645)

     at java.lang.Class.checkMemberAccess(Class.java:1332)

     at java.lang.Class.getDeclaredField(Class.java:1107)

     at processing.core.PFont.<init>(PFont.java:749)

     at processing.core.PApplet.createFont(PApplet.java:2841)

     at processing.core.PApplet.createFont(PApplet.java:2779)

     at word_connect.setup(word_connect.java:24)

     at processing.core.PApplet.display(PApplet.java:1017)

     at processing.core.PGraphics.requestDisplay(PGraphics.java:362)

     at processing.core.PApplet.run(PApplet.java:921)

     at java.lang.Thread.run(Thread.java:491)

Error while running applet.

java.lang.RuntimeException: access denied (java.lang.RuntimePermission accessDeclaredMembers)

     at processing.core.PFont.<init>(PFont.java:952)

     at processing.core.PApplet.createFont(PApplet.java:2841)

     at processing.core.PApplet.createFont(PApplet.java:2779)

     at word_connect.setup(word_connect.java:24)

     at processing.core.PApplet.display(PApplet.java:1017)

     at processing.core.PGraphics.requestDisplay(PGraphics.java:362)

     at processing.core.PApplet.run(PApplet.java:921)

     at java.lang.Thread.run(Thread.java:491)
Re: 0090 createFont trouble
Reply #1 - May 12th, 2005, 4:39pm
 
bummer, looks like you can't use createFont() in applets. Undecided
Re: 0090 createFont trouble
Reply #2 - May 12th, 2005, 6:21pm
 
I think I might have found the bug

PFont.java:749:

Field antialiasingKeyField =      renderingHintsClass.getDeclaredField("KEY_TEXT_ANTIALIASING");

That field is a member of RenderingHints.Key, not RenderingHints according to javadocs.  You create a renderingHintsKeyClass object, but don't actually use it to get the field.

Marcello
Re: 0090 createFont trouble
Reply #3 - May 13th, 2005, 6:08am
 
nah, it's of type RenderingHints.Key, but it's *in* the RenderingHints class. if i change to the .Key class i get a no such field error. this is a bit kooky though, this isn't something that should be throwing a security exception, so i'm not sure what's up. i suspect that there might be a way to deal with it by using another method.
Re: 0090 createFont trouble
Reply #4 - May 13th, 2005, 5:24pm
 
well, for one of my applets I have:
Code:

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

class BrushGraphics2D {
public static final void setTextAntialiasing(Graphics g, boolean antialias) {
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, antialias ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
}
}


Then I conditionally call that function if they have java 2.  I haven't had any security exceptions or anything trying to do that, and it works on older browsers (they don't try to load that class).

Marcello
Re: 0090 createFont trouble
Reply #5 - May 14th, 2005, 3:37pm
 
i'll see if that works, it didn't used to, that it was necessary to keep the code in a separate class, but will look into it.
Re: 0090 createFont trouble
Reply #6 - Jul 28th, 2005, 5:07am
 
now filed in the bugs db:
http://dev.processing.org/bugs/show_bug.cgi?id=101
Re: 0090 createFont trouble
Reply #7 - Sep 13th, 2006, 3:41am
 
fixed for 0116.
Page Index Toggle Pages: 1