0

I have some problems using Psychtoolbox Screen and Textwindow... For my experiment I want to give an instruction at the beginning. I used something like this: % Draw text in the middle of the screen in Courier in white

Screen('TextSize', window, 20);
Screen('TextFont', window, 'Courier');
DrawFormattedText(window, 'Hello World', 'center', 'center', white);

And the other basic Screen definitions. The problem is: The text is not fully shown. I tried different sizes and set the Font to Times, but it is always the same - every letter is only displayed 3/4 (ca)...

What could be the problem? Would be very nice if someone can give me a hint...

Thanks!

Letters are cut

2 Answers2

1

Can you describe what you mean by 'every letter is only displayed 3/4 (ca)"? The code you posted looks correct. For example, here is that code, with the addition of some set-up routines, and taking and saving a screenshot as "testImage.png", with the screen shot attached.

screenNum = max(Screen('Screens'));
window = Screen('OpenWindow', screenNum, 0);
white = WhiteIndex(window);
Screen('TextSize', window, 20);
Screen('TextFont', window, 'Courier');
DrawFormattedText(window, 'Hello World', 'center', 'center', white)
Screen('Flip', window);
imageArray = Screen('GetImage', window);
WaitSecs(3);
Screen('CloseAll');
imwrite(imageArray, 'testImage.png');

screen shot of screen produced by the above code

DMR
  • 1,479
  • 1
  • 8
  • 11
  • Hey DMR, thank you for your answer! I edited my post, hope you can see what I mean... I've tried your code in an extra script and it worked fine. So I guess it has to do with my experimental loop or something, but I can't imagine what could be the problem... Maybe I should note that I have KbWait([],2); after the code above, because I want to continue the experimental loop when the proband has read the instruction and presses a key –  Aug 18 '17 at 06:09
  • Do you have any other statements between your 'DrawFormattedText' and the next Screen 'Flip' command? Subsequent drawing commands would overlap on top of each other. – DMR Aug 18 '17 at 16:00
  • No, this is my full code for this section: % Draw text in the upper portion of the screen with the default font in black Screen('FillRect', window, white); Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA'); Screen('TextSize', window, 10); Screen('TextFont', window, 'Times'); DrawFormattedText(window, 'Press the Enter Key if you are ready', 'center', 'center', black); %screenYpixels * 0.25, [0 0 0]); Screen('Flip', window); % show what was drawed KbWait([],2); –  Aug 18 '17 at 18:49
0

I found the problem... Just a dumb mistake in my long Code. I have set the Font and Size of Text earlier, and this interfered with this new text features. Nevertheless, thank you for your help!