Login  Register

Re: I don't understand ---> ./atomic/jogl-fonts-p0.jar

Posted by LordSmoke on Feb 11, 2019; 5:14pm
URL: https://forum.jogamp.org/I-don-t-understand-atomic-jogl-fonts-p0-jar-tp4039504p4039513.html

Okay, it seems many of my problems are, in fact, font related. So, I will focus on a single situation:

Mac: OS X 10.14.2
Netbeans: 8.2
Java: java version "1.8.0_77"

JOGL: JOGL 2.3.2 fat jar linked to by Julien Feb 21, 2018
(https://sourceforge.net/p/tuer/code/1319/tree//pre_beta/lib/jogamp/jogamp-fat.jar?format=raw)

J3D: jars linked to by Harvey Jan 04, 2019 (same for j3d jars linked to by Julien here https://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/#installation)

====
On this platform, my j3d-based program compiles and runs fine(1) without "./atomic/jogl-fonts-p0.jar" using only the jogl fat jar and the j3d libraries.

====
My jogl GLSL-based program (using J3D only to retrieve the version number for a system report) dies with a "file not found" exception for ./atomic/jogl-fonts-p0.jar (I think you can ignore the NSWindow warning - I get that even when it runs):

java -jar ./morpheus_JOGL.jar
2019-02-11 11:41:45.037 java[55711:17565326] WARNING: NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future. Called from (
        0   AppKit                              0x00007fff3629accc -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 386
        1   AppKit                              0x00007fff3629807c -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1488
        2   AppKit                              0x00007fff36297aa6 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
        3   libnativewindow_macosx.jnilib       0x000000013a27e3fe Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 398
        4   ???                                 0x0000000117190954 0x0 + 4682484052
)
Caught /Users/dslice/projects/Dropbox/morpheus/morpheus_JOGL/dist/lib/atomic/jogl-fonts-p0.jar (No such file or directory)
java.io.FileNotFoundException: /Users/dslice/projects/Dropbox/morpheus/morpheus_JOGL/dist/lib/atomic/jogl-fonts-p0.jar (No such file or directory)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:219)
        at java.util.zip.ZipFile.<init>(ZipFile.java:149)
        at java.util.jar.JarFile.<init>(JarFile.java:166)
        at java.util.jar.JarFile.<init>(JarFile.java:103)
        at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:93)
        at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
        at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:84)
        at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
        at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
        at com.jogamp.common.util.JarUtil.getJarFile(JarUtil.java:403)
        at com.jogamp.common.util.cache.TempJarCache.addResources(TempJarCache.java:304)
        at jogamp.graph.font.UbuntuFontLoader$1.run(UbuntuFontLoader.java:146)
        at jogamp.graph.font.UbuntuFontLoader$1.run(UbuntuFontLoader.java:142)
        at java.security.AccessController.doPrivileged(Native Method)
        at jogamp.graph.font.UbuntuFontLoader.abspath(UbuntuFontLoader.java:142)
        at jogamp.graph.font.UbuntuFontLoader.get(UbuntuFontLoader.java:108)
        at morpheus_JOGL.Morpheus_JOGL_dlg09_text.init(Morpheus_JOGL_dlg09_text.java:997)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:644)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:667)
        at com.jogamp.opengl.awt.GLCanvas$10.run(GLCanvas.java:1407)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1291)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
        at com.jogamp.opengl.awt.GLCanvas$12.run(GLCanvas.java:1438)
        at com.jogamp.opengl.Threading.invoke(Threading.java:223)
        at com.jogamp.opengl.awt.GLCanvas.display(GLCanvas.java:505)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
        at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
java.io.IOException: Problem loading font Ubuntu-R.ttf, stream jogamp/graph/font/fonts/ubuntu/Ubuntu-R.ttf
        at jogamp.graph.font.UbuntuFontLoader.abspath(UbuntuFontLoader.java:169)
        at jogamp.graph.font.UbuntuFontLoader.get(UbuntuFontLoader.java:108)
        at morpheus_JOGL.Morpheus_JOGL_dlg09_text.init(Morpheus_JOGL_dlg09_text.java:997)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:644)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:667)
        at com.jogamp.opengl.awt.GLCanvas$10.run(GLCanvas.java:1407)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1291)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
        at com.jogamp.opengl.awt.GLCanvas$12.run(GLCanvas.java:1438)
        at com.jogamp.opengl.Threading.invoke(Threading.java:223)
        at com.jogamp.opengl.awt.GLCanvas.display(GLCanvas.java:505)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
        at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
Caused by: java.io.IOException: Problem loading font Ubuntu-R.ttf, stream jogamp/graph/font/fonts/ubuntu/Ubuntu-R.ttf
        at jogamp.graph.font.UbuntuFontLoader.abspath(UbuntuFontLoader.java:167)
        ... 15 more
       

It seems this involves the following. It works using the .JAVA font, but crashes with the .UBUNTU font being unable to find ./atomic/jogl-fonts-p0.jar (the Java font is very ugly on my system - white gaps in letter formation, e.g., the top triangle of the 'M', the ubuntu is much nicer). It also works(1) if I manually add the jogl-fonts-p0.jar to the project libraries giving only the "file not found" error, but proceeds with the nice ubuntu(?) font.:

//    static int fontSet = FontFactory.JAVA;
    static int fontSet = FontFactory.UBUNTU;
    // default
    static int fontFamily = 0;
    // default
    static int fontStyleBits = 0;
    // Trial and error
    final float fontSize = 1.0f;
...
        /* load a ttf font */
        try {
            /* JogAmp FontFactory will load a true type font
                 *
                 * fontSet == 0 loads
                 * jogamp.graph.font.fonts.ubuntu found inside jogl-fonts-p0.jar
                 * http://jogamp.org/deployment/jogamp-current/jar/atomic/jogl-fonts-p0.jar
                 *
                 * fontSet == 1 tries loads LucidaBrightRegular from the JRE.
             */
            font = FontFactory.get(fontSet).get(fontFamily, fontStyleBits);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }


----
(1) only warnings and shutdown errors to be dealt with later if they don't resolved themselves in addressing more serious issues.