Login  Register

Some TTF / OTF fonts not working in the new graph API renderer

Posted by asambol on Nov 29, 2014; 10:58am
URL: https://forum.jogamp.org/Some-TTF-OTF-fonts-not-working-in-the-new-graph-API-renderer-tp4033680.html

I downloaded the play fonts from here http://www.fontsquirrel.com/fonts/play in TTF format.

The bold one works fine, but the regular one can't find any glyphs when trying to draw:

 java.lang.RuntimeException: Could not retrieve glyph for symbol: <T> 84 -> glyph id 0
        at jogamp.graph.font.typecast.TypecastFont.getGlyph(TypecastFont.java:200)
        at com.jogamp.graph.curve.opengl.TextRegionUtil.processString(TextRegionUtil.java:123)
        at com.jogamp.graph.curve.opengl.TextRegionUtil.addStringToRegion(TextRegionUtil.java:153)
        at com.jogamp.graph.curve.opengl.TextRegionUtil.drawString3D(TextRegionUtil.java:182)

I tried converting it to OTF format using online converters, then realised none of my OTF fonts work - they can't be loaded at all:
java.lang.NegativeArraySizeException
        at jogamp.graph.font.typecast.ot.table.CffTable$Index.<init>(CffTable.java:202)
        at jogamp.graph.font.typecast.ot.table.CffTable.<init>(CffTable.java:525)
        at jogamp.graph.font.typecast.ot.table.TableFactory.create(TableFactory.java:87)
        at jogamp.graph.font.typecast.ot.OTFont.read(OTFont.java:268)
        at jogamp.graph.font.typecast.ot.OTFontCollection.read(OTFontCollection.java:166)
        at jogamp.graph.font.typecast.ot.OTFontCollection.create(OTFontCollection.java:63)
        at jogamp.graph.font.typecast.TypecastFontConstructor$1.run(TypecastFontConstructor.java:53)
        at java.security.AccessController.doPrivileged(Native Method)
        at jogamp.graph.font.typecast.TypecastFontConstructor.create(TypecastFontConstructor.java:48)
        at com.jogamp.graph.font.FontFactory.get(FontFactory.java:91)

Another problem with some fonts, for example Armata-Regular from Google Fonts: http://www.google.com/fonts#UsePlace:use/Collection:Armata (download in top right corner) - whichever text I try to render, I get square characters instead of real text.

Is there anything I'm doing wrong? Is there a specific Font converter to make sure they work in Jogl?