Text() on Mac causes program to pause

#1

This problem occurs on Apple computers, but not not on Windows. The code below comes from a simple game. When the condition is true, the program (on a Mac), stops for a few seconds, and then displays “You Lose.” When run on a Windows computer, there is no pause. Is there a way to prevent the pause on a Mac?

if (rainDrop.checkForReachBottom(height)) {
    text("You Lose", width/2, height/2);
  }
1 Like

#2

Text may be lazy loading the very first time it is called. One way to overcome this is to display some text on the very first frame – getting the one-time delay out of the way.

That said, “a few seconds” is a very long delay. I wonder if you have a problem with font(s).

0 Likes

#3

Thanks, your workaround is good.

I timed this, and the delay is closer to 1 second, but very noticeable. Still curious about what is different between the Mac and PC implementation of text().

0 Likes

#4

I have seen various version of this crop up several time, depending on the MacOS version. I believe it is related to Java and its interface to Mac fonts, not anything specific to Processing. Here is one example of a recent open Java JDK bug:

Text rendering has slow initialization time

https://bugs.openjdk.java.net/browse/JDK-8179209

0 Likes