Troubleshooting delayed text display in Psychtoolbox

Issue

A psychtoolbox program exhibits a long delay before the first time that text is drawn to the screen every time the program is run. 

Psychtoolbox currently uses GStreamer to perform high quality text rendering on the Windows operating system. The first time that GStreamer is called to render text, it will build a cache of all the fonts that it finds on the system if the cache does not already exist. This process can take up to several minutes depending on the number of fonts installed.

Normally GStreamer only has to build this cache once, resulting in a delay for just the first time a Psychtoolbox program is run. If the cache somehow becomes unusable, GStreamer will build the cache every time it is called, resulting in a delay every time a Psychtoolbox program first tries to draw text to the screen.

Environment

  • Windows 7, 10
  • MATLAB
  • Psychtoolbox-3
  • GStreamer

Cause

Font cache file corruption/invalidation.

Resolution

Solution

Delete the font cache files located in C:\Users\account_name\AppData\Local\fontconfig\cache. The next time the Psychtoolbox program is run, the delay should still be present. Run the program a second time, and the program should no longer have the delay.

Please note: AppData is a hidden folder. Windows Explorer settings must be changed to make it visible.. 

Workaround

Turn off high quality text rendering at the beginning of your Psychtoolbox program. Psychtoolbox will then revert to using the legacy Windows text renderer.

Screen('Preference', 'TextRenderer', 0);

Type Screen Preference? in the MATLAB command window on a computer with Psychtoolbox installed for complete documentation.

External Resources