aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-01-27 19:52:28 +0100
committerSven Gothel <[email protected]>2015-01-27 19:52:28 +0100
commitcd2e9f16ec2612587c08bf407d522243fb7a9d20 (patch)
treefce43f8d63a2181cf5bcfdac1c510d84fec0fb6e /src
parentdc15a430ee28f226e047ddebabf902d4c10b067a (diff)
Fix UbuntuFontLoader: Regression of commit bd24599b21f9787ac989e65b44dc1ba762162f22
Commit bd24599b21f9787ac989e65b44dc1ba762162f22 removed font loading w/o TempJarCache, e.g. as used on Android.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
index bbf022657..e4b0cb2a8 100644
--- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
@@ -29,9 +29,11 @@ package jogamp.graph.font;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URLConnection;
import com.jogamp.common.net.Uri;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.common.util.JarUtil;
import com.jogamp.common.util.cache.TempJarCache;
@@ -170,20 +172,26 @@ public class UbuntuFontLoader implements FontSet {
}
}
private Font abspathImpl(final String fname, final int family, final int style) throws IOException {
- final Exception[] privErr = { null };
- final InputStream stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
- @Override
- public InputStream run() {
- try {
- final Uri uri = TempJarCache.getResourceUri(fname);
- return null != uri ? uri.toURL().openConnection().getInputStream() : null;
- } catch (final Exception e) {
- privErr[0] = e;
- return null;
- }
- } } );
- if( null != privErr[0] ) {
- throw new IOException(privErr[0]);
+ final InputStream stream;
+ if( useTempJARCache ) {
+ final Exception[] privErr = { null };
+ stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
+ @Override
+ public InputStream run() {
+ try {
+ final Uri uri = TempJarCache.getResourceUri(fname);
+ return null != uri ? uri.toURL().openConnection().getInputStream() : null;
+ } catch (final Exception e) {
+ privErr[0] = e;
+ return null;
+ }
+ } } );
+ if( null != privErr[0] ) {
+ throw new IOException(privErr[0]);
+ }
+ } else {
+ final URLConnection urlConn = IOUtil.getResource(UbuntuFontLoader.class, fname);
+ stream = null != urlConn ? urlConn.getInputStream() : null;
}
if(null != stream) {
final Font f= FontFactory.get ( stream, true ) ;