# Drawformattedtext error

**URL:** <https://psychtoolbox.discourse.group/t/drawformattedtext-error/3947>\
**Category:** Programming Help\
**Created:** [August 2, 2021, 4:55pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-error/3947 "2021-08-02T16:55:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pech](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@Pech](https://psychtoolbox.discourse.group/u/Pech)\
**Post date:** [August 2, 2021, 4:55pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-error/3947/1 "2021-08-02T16:55:24Z")

</div>

Hello everybody,

I have an unsolved problem on my computer, my code work in other ones. Run the code without `DrawFormattedText` is ok (I displayed some picture in other parts of the code).

Here is the code to display the text:

```auto
Screen('Preference', 'SkipSyncTests', 0); %I tryed this part with 0 or 1 but none of them work.
ScreenNumber=max(Screen('Screens'));
[w,wrect] = Screen('OpenWindow',ScreenNumber(end),[0 0 0]);%2400 x 1040
cycleRefresh=Screen('GetFlipInterval', w);
vbl=Screen(w, 'Flip');
[width, height]=Screen('WindowSize', w);
Screen('TextSize',w, 25); % SET TEXT SIZE HERE
Screen('TextFont', w, 'Times');
Screen('TextStyle', w, 1);
Textcolor=[255 255 255];
DrawFormattedText(w, 'Start experiment','center','center',Textcolor);

```

Here is the message error:

> win = 10
> 
> Error in function TextBounds: Usage error
> 
> The external text renderer plugin failed to render the text string for some reason! % Very helpfull ^^
> 
> Error using Screen Usage:
> 
> [normBoundsRect, offsetBoundsRect, textHeight, xAdvance] = Screen(‘TextBounds’, windowPtr, text [,x] [,y][,yPositionIsBaseline] [,swapTextDirection]);
> 
> Error in DrawFormattedText (line 295) theight = RectHeight(Screen(‘TextBounds’, win, tstring));
> 
> Error in SCRIPT\_PROSOC\_CommentSerialObj (line 102) DrawFormattedText(w, ‘Start experiment’,‘center’,‘center’,Textcolor);

---

<div class="post-metadata">

**Author:** ![dcnieho](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dcnieho](https://psychtoolbox.discourse.group/u/dcnieho)\
**Post date:** [August 2, 2021, 6:05pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-error/3947/2 "2021-08-02T18:05:17Z")

</div>

Did you install gstreamer? See help drawtextplugin (i think, typing from memory) for how to try to get it to work

---

<div class="post-metadata">

**Author:** ![Pech](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@Pech](https://psychtoolbox.discourse.group/u/Pech)\
**Post date:** [August 2, 2021, 8:25pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-error/3947/3 "2021-08-02T20:25:43Z")

</div>

Yes I did. It still did not work. Thank you for the help. I was wondering if it is not a problem of configuration with my screen. Sometimes I have this message

----- ! PTB - ERROR: SYNCHRONIZATION FAILURE ! -----

One or more internal checks (see Warnings above) indicate that synchronization  
of Psychtoolbox to the vertical retrace (VBL) is not working on your setup.

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [August 4, 2021, 3:17pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-error/3947/4 "2021-08-04T15:17:10Z")

</div>

> [@dcnieho](#):
>
> drawtextplugin

You don’t provide info about your operating system and setup, etc. as required (see [Psychtoolbox-3 - Psychtoolbox Forum](http://psychtoolbox.org/forum.html)), so hard to judge, but:

The sync failure is unrelated. If it happens frequently then is points to a buggy or misconfigured display driver, iow. your visual stimulation timing is broken. Happen a lot on MS-Windows with Intel graphics, and on various broken macOS operating systems. `help SyncTrouble`.

The specific error message you observe usually happens if no suitable font can be found, due to some problems with the libfontconfig library or its fontconfig database. Happens especially often on some macOS machines due to Apples shoddy operating system, less often on MS-Windows, essentially never on Linux. Cfe. [External text renderer plugin failed to render the text string (Windows)](https://psychtoolbox.discourse.group/t/external-text-renderer-plugin-failed-to-render-the-text-string-windows/1327)

Make sure you use the latest PTB Beta, as it contains the latest workarounds for operating system bugs. If you’d need further assistance from myself, `help PsychPaidSupportAndServices`.

-mario
