Broken DrawFormattedText

I am using PTB-3.0.11 on Windows XP. I am trying to get DrawFormattedText to produce text centered within a rectangle as in the code snippet below.


    l = 10;
    t = 10;
    r = 40;
    b = 40;
    for k = 1:30
        DrawFormattedText(win, 'XX', 'center', 'center', tColor, [], [], [], 1.6, [], [l t r b]);
        Screen('FillOval', win, 255, CenterRect([0 0 10 10], [l t r b]));
        l = l + k;
        t = t + k;
        r = r + k;
        b = b + k;
    end


Instead of the expected outcome of XX and dots diagonally down the screen, the XX ends after five iterations. The ovals continue as expected.


This either a bug in the way DrawFormattedText handles a winRect argument or in my understanding of the limitations of DrawFormattedText.


Screen('DrawText'... does work as expected but I am going to have to figure out how to center arbitrary text within the [l t r b] rectangle.


Advice would be welcome.

Can you attach a full test script to demonstrate the problem? The code doesn't look obviously wrong.

If Screen('DrawText') does the job then the bug - if it is a bug - would be in DrawFormattedText.m although i cannot think of a bug like this.

-mario
It was a bug specific to use of 'winRect' and clipping. Will be fixed in upcoming v3.0.12 beta. On older versions one can disable text clipping as described in the "help DrawFormattedText" to avoid the text getting clipped away.

-mario