I’m building a Twitter visualization using the World Wind libraries, and I think I’m getting the same exception. I posted about it on their forums here http://forum.worldwindcentral.com/showthread.php?p=66869 but will post again -
I’m running into the exception with the characters in tweets like these:
我与今天上午离开人世,再见,中国人
หาเสื้อสี #FF3300 มาใส่ดีกว่า
The exception looks like:
Dec 16, 2008 3:49:09 AM gov.nasa.worldwind.render.BasicAnnotationRenderer$OrderedAnnotation render
SEVERE: generic.ExceptionWhileRenderingAnnotation
java.lang.ArrayIndexOutOfBoundsException: -141
at com.sun.opengl.util.j2d.TextRenderer$GlyphProducer.register(TextRenderer.java:1613)
at com.sun.opengl.util.j2d.TextRenderer$GlyphProducer.getGlyph(TextRenderer.java:1682)
at com.sun.opengl.util.j2d.TextRenderer$GlyphProducer.getGlyph(TextRenderer.java:1649)
at com.sun.opengl.util.j2d.TextRenderer$GlyphProducer.getGlyphs(TextRenderer.java:1573)
at com.sun.opengl.util.j2d.TextRenderer.internal_draw3D(TextRenderer.java:799)
at com.sun.opengl.util.j2d.TextRenderer.draw3D(TextRenderer.java:516)
at gov.nasa.worldwind.render.MultiLineTextRenderer.draw(Unknown Source)
at gov.nasa.worldwind.render.MultiLineTextRenderer.draw(Unknown Source)
at gov.nasa.worldwind.render.AbstractAnnotation.drawAnnotation(Unknown Source)
at gov.nasa.worldwind.render.GlobeAnnotation.doDraw(Unknown Source)
at gov.nasa.worldwind.render.AbstractAnnotation.draw(Unknown Source)
at gov.nasa.worldwind.render.BasicAnnotationRenderer$OrderedAnnotation.render(Unknown Source)
at gov.nasa.worldwind.AbstractSceneController.draw(Unknown Source)
at gov.nasa.worldwind.BasicSceneController.doRepaint(Unknown Source)
at gov.nasa.worldwind.AbstractSceneController.repaint(Unknown Source)
at gov.nasa.worldwind.WorldWindowGLAutoDrawable.doDisplay(Unknown Source)
at gov.nasa.worldwind.WorldWindowGLAutoDrawable.display(Unknown Source)
at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)
at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:435)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:412)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277)
at javax.media.opengl.GLCanvas.update(GLCanvas.java:354)
at sun.awt.RepaintArea.updateComponent(RepaintArea.java:267)
at sun.awt.RepaintArea.paint(RepaintArea.java:233)
at apple.awt.ComponentModel.handleEvent(ComponentModel.java:268)
at java.awt.Component.dispatchEventImpl(Component.java:4144)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
and afterwards it keeps throwing exceptions and refusing to display the terrain or other annotations. I’ve tried messing around with things like
new String(text.getBytes(“UTF-16”), “UTF-8”)
as the text parameter for GlobeAnnotation(String text, Position position), but that hasn’t helped. I’ve also tried checking the Font before creating the GlobeAnnotation, but canDisplayUpTo(String str) doesn’t point to any problems either. I’ve tried Serif, SansSerif and Helvetica as the font names. Also, for what it’s worth, the first of those two examples is reading as
我ä¸?ä»?å?©ä¸?å?ˆç?»å?€äººä¸–ï?Œå†?è§?ï ?Œä¸?å›?人
in the console (I got the original characters from a SELECT query to my MySQL database).
Additionally, I made sure I was using JSR-231 1.1.1, and updated by MacBook Pro to 10.5.6 (released yesterday). I haven’t yet tried to see if the same text renders in Swing or J2D graphics.
Ideally, I’d like to be able to display text containing any sort of character, but it would suffice for to have some way of predicting in advance which tweets were going to crash it so that I could not display them. Thoughts?
Thanks,
Steven