diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/font/FontFactory.java | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java index 1752a693c..9bf4b1f73 100644 --- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java +++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java @@ -27,7 +27,12 @@ */ package com.jogamp.graph.font; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.net.URL; import java.security.AccessController; +import java.security.PrivilegedAction; import com.jogamp.common.util.ReflectionUtil; @@ -58,8 +63,6 @@ public class FontFactory { fontConstr = (FontConstructor) ReflectionUtil.createInstance(fontImplName, FontFactory.class.getClassLoader()); } - public static final FontConstructor getFontConstr() { return fontConstr; } - public static final FontSet getDefault() { return get(UBUNTU); } @@ -73,8 +76,34 @@ public class FontFactory { } } - public static final Font get(String path) { - return fontConstr.create(path); + public static final Font get(File file) throws IOException { + return fontConstr.create(file); } + public static final Font get(final URL url) throws IOException { + final IOException[] ioeA = new IOException[1]; + + Font f = (Font) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + try { + return fontConstr.create(url); + } catch (IOException ioe) { + ioeA[0] = ioe; + } + return null; + } + }); + if(null != ioeA[0]) { + throw ioeA[0]; + } + return f; + } + + public static boolean isPrintableChar( char c ) { + Character.UnicodeBlock block = Character.UnicodeBlock.of( c ); + return (!Character.isISOControl(c)) && + c != 0 && + block != null && + block != Character.UnicodeBlock.SPECIALS; + } } |