diff options
author | Sven Gothel <[email protected]> | 2011-04-01 15:13:17 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-04-01 15:13:17 +0200 |
commit | d4c400b9e70550bc93ebc2c0df2cd916b9ea0b3b (patch) | |
tree | 38f1b53b1aeb5af4b12e9a3901ee45a2da690ee3 /src/jogl/classes/jogamp/graph/font/JavaFontLoader.java | |
parent | f47753b63c9530a6af36cb69135dee0421abfe6b (diff) |
Load fonts via File or URL .
Diffstat (limited to 'src/jogl/classes/jogamp/graph/font/JavaFontLoader.java')
-rw-r--r-- | src/jogl/classes/jogamp/graph/font/JavaFontLoader.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java index 33505e797..a9ab902a9 100644 --- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java @@ -27,6 +27,11 @@ */ package jogamp.graph.font; +import java.io.File; +import java.io.IOException; + +import javax.media.opengl.GLException; + import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontSet; @@ -118,12 +123,17 @@ public class JavaFontLoader implements FontSet { } Font abspath(String fname, int family, int style) { - final Font f = FontFactory.getFontConstr().create(javaFontPath+fname); - if(null != f) { - fontMap.put( ( family << 8 ) | style, f ); + final String err = "Problem loading font "+fname+", file "+javaFontPath+fname ; + + try { + final Font f = FontFactory.get( new File(javaFontPath+fname) ); + if(null != f) { + fontMap.put( ( family << 8 ) | style, f ); + return f; + } + throw new GLException(err); + } catch (IOException ioe) { + throw new GLException(err, ioe); } - return f; - - } - + } } |