Bug 1494 : loadFont causes android app to hang
Last modified: 2010-03-04 05:08




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
TomC
Assigned To:
fry

Attachment Type Created Size Actions
full sketch folder (800KB) with android build bits application/octet-stream 2010-03-02 12:07 817.60 KB

Description:   Opened: 2010-03-02 12:05
I'm using Processing-0177 and it's talking to a Nexus One.

Using the following code:

PFont font;
void setup() {
font = loadFont("Helvetica-48.vlw");
}
void draw() {
background(0);
fill(255);
noStroke();
textFont(font, 48);
text("Hello", 10, 48);
}

It hangs at the loadFont line. I get the same error with other font files.
The fonts work fine in normal applet mode. Other data files (csv) in a
bigger sketch were loaded fine by my Android phone, but that sketch also
had trouble with fonts. I haven't had any success displaying text with
createFont, but it doesn't crash.

The Processing app's console reports:

processing.app.debug.RunnerException: RuntimeException: Could not load font
Helvetica-48.vlw. Make sure that the font has been copied to the data
folder of your sketch.
at processing.app.Sketch.placeException(Sketch.java:1562)
at processing.app.debug.Runner.findException(Runner.java:562)
at processing.app.debug.Runner.reportException(Runner.java:537)
at
processing.app.tools.android.AndroidRunner.exception(AndroidRunner.java:373)
at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
at processing.app.debug.EventThread.run(EventThread.java:89)

Using 'adb logcat' I find these further lovely error lines:

I/System.out( 1359): PApplet.onResume() called
D/dalvikvm( 51): GC freed 2 objects / 48 bytes in 107ms
I/System.out( 1359): surfaceChanged() 480 800
D/dalvikvm( 1359): GC freed 802 objects / 60088 bytes in 63ms
I/ActivityManager( 71): Displayed activity
processing.android.test.android_fonts/.android_fonts: 570 ms (total 570 ms)
W/System.err( 1359): java.lang.ArrayIndexOutOfBoundsException
W/System.err( 1359): at processing.android.core.PFont.<init>(Unknown Source)
W/System.err( 1359): at processing.android.core.PApplet.loadFont(Unknown
Source)
W/System.err( 1359): at
processing.android.test.android_fonts.android_fonts.setup(android_fonts.java:12)
W/System.err( 1359): at processing.android.core.PApplet.handleDraw(Unknown
Source)
W/System.err( 1359): at
processing.android.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
W/System.err( 1359): at processing.android.core.PApplet.run(Unknown Source)
W/System.err( 1359): at java.lang.Thread.run(Thread.java:1096)
V/RenderScript_jni( 152): surfaceDestroyed
V/RenderScript( 152): setSurface 0 0 0x0
D/dalvikvm( 170): GC freed 1574 objects / 93752 bytes in 1272ms
D/ViewFlipper( 152): updateRunning() mVisible=false, mStarted=true,
mUserPresent=true, mRunning=false
W/dalvikvm( 1359): threadid=15: thread exiting with uncaught exception
(group=0x4001b180)
E/AndroidRuntime( 1359): Uncaught handler: thread Animation Thread exiting
due to uncaught exception
E/AndroidRuntime( 1359): java.lang.RuntimeException: Could not load font
Helvetica-48.vlw. Make sure that the font has been copied to the data
folder of your sketch.
E/AndroidRuntime( 1359): at processing.android.core.PApplet.die(Unknown
Source)
E/AndroidRuntime( 1359): at processing.android.core.PApplet.die(Unknown
Source)
E/AndroidRuntime( 1359): at
processing.android.core.PApplet.loadFont(Unknown Source)
E/AndroidRuntime( 1359): at
processing.android.test.android_fonts.android_fonts.setup(android_fonts.java:12)
E/AndroidRuntime( 1359): at
processing.android.core.PApplet.handleDraw(Unknown Source)
E/AndroidRuntime( 1359): at
processing.android.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
E/AndroidRuntime( 1359): at processing.android.core.PApplet.run(Unknown
Source)
E/AndroidRuntime( 1359): at java.lang.Thread.run(Thread.java:1096)
I/Process ( 71): Sending signal. PID: 1359 SIG: 3
I/dalvikvm( 1359): threadid=7: reacting to signal 3
I/dalvikvm( 1359): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 1359): Sending signal. PID: 1359 SIG: 9
Additional Comment #1 From TomC 2010-03-02 12:07
edit]
full sketch folder (800KB) with android build bits
Additional Comment #2 From fry 2010-03-04 05:08
confirmed to be fixed for 0178, thanks.