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

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

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

LordSmoke
I think a number of my problems are related to the handling of ./atomic/jogl-fonts-p0.jar, but I don't see any good explanation of how it should be used.

At some point in the distant past, I determined that I needed to include that directory in my jogl (2.3.2 OCT10) library, and everything seemed to work fine. Now, it seems to be associated with all sorts of curious behavior and crashes depending upon the OS, development environment, and Java version.

For instance, Netbeans 8.2 is not copying it into the dist/lib directory because it is a directory. I need to include it directly as a .jar in the library to compile. I get more-or-less silent runtime errors (program still runs) if the directory is not in ./dist/lib (or if I move it there after compiling), but its use in j3d generates runtime errors (crash to command line) under openjdk 1.8, but not oracle jdk jave 1.8.

So a) how should I be using this directory and/or file?
Or b) where can I look to find this information?

I think if I can solve this mystery, I can be at least up-to-date with my problems of running under openjdk except for warnings. Probably about time I learned the proper location/use of this.

As always, TIA
Reply | Threaded
Open this post in threaded view
|

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

gouessej
Administrator
Hello

If you don't want to use atomic JARs, why not simply use the JogAmp fat JAR? I used it both in Netbeans 7 and Netbeans 8.2 without such troubles. Please follow the instructions in our wiki.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

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

LordSmoke
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.
Reply | Threaded
Open this post in threaded view
|

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

gouessej
Administrator
Your stack trace indicates that Netbeans isn't using the fat JAR, it still uses the atomic JARs.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

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

LordSmoke
Good Lord! How could that be happening? What are you seeing that indicates that? I've been doing a "Clean and Build" almost every time and the only libraries shown in the project or the resulting ./dist/lib are the fat jar and latest j3d jars. I see nothing in the project or Netbeans preferences to indicate use of any other libraries. Nothing in my environment to direct Java or Netbeans anywhere except to the added jars.
Reply | Threaded
Open this post in threaded view
|

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

ThomasR
anything in Library/Java/Extensions ?
Reply | Threaded
Open this post in threaded view
|

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

gouessej
Administrator
In reply to this post by LordSmoke
Actually, the font files are missing in the fat JAR :(

Your stack trace still mentions dist/lib/atomic/jogl-fonts-p0.jar
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

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

LordSmoke
gouessej wrote
Actually, the font files are missing in the fat JAR :(

Your stack trace still mentions dist/lib/atomic/jogl-fonts-p0.jar
Yes, that error is how I knew it was related to ./atomic/jogl-fonts-p0.jar

So, is the lack of fonts in the fat jar something I did or did not do correctly?

I spent the afternoon extensively searching my hard drive. No jogl or gluegen related in any odd system or app directory.
Reply | Threaded
Open this post in threaded view
|

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

gouessej
Administrator
LordSmoke wrote
So, is the lack of fonts in the fat jar something I did or did not do correctly?
No, it comes from the way our fat JAR is made, it's not your fault.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

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

LordSmoke
Okay.

So instead of just waiting for an updated fat jar, I was a bit proactive and got everything working for my pure JOGL app by loading my preferred font as a stream from my resource directory as described by Xerxes in "Re: Text without AWT?":

./data/Ubuntu-R.ttf

code change:
    static int fontSet = FontFactory.UBUNTU;
    // default
    static int fontFamily = 0;
    // default
    static int fontStyleBits = 0;

...

//            font = FontFactory.get(fontSet).get(fontFamily, fontStyleBits);
// test
InputStream is = getClass().getResourceAsStream("data/Ubuntu-R.ttf");
font = FontFactory.get ( is /*InputStream*/, true /* close stream */) ;

My pure JOGL app now works (except for the odd warnings and some X11 shutdown errors that don't affect program operation) on the Mac and Ubuntu 18.04 with Java 8, OpenJDK 8, OpenJDK 10.0.2

Alas, my J3D app still crashes with font errors on OpenJDK, and there is no comparable place within for me to do something similar within my own code. So, I guess this is now a localized J3D problem.

Comments welcome, but I will post an inquiry on the J3D subforum.
Reply | Threaded
Open this post in threaded view
|

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

gouessej
Administrator
Would it help to use Ant to put the fonts into the fat JAR?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

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

LordSmoke
gouessej wrote
Would it help to use Ant to put the fonts into the fat JAR?
Interesting idea. I see some instructions on how to use Ant that way. I might give that a try when I get a chance.