Psychtoolbox - Text for Instruction [closed]

2019-08-03 09:29发布

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条回答
不美不萌又怎样
2楼-- · 2019-08-03 09:38

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!

查看更多
欢心
3楼-- · 2019-08-03 09:46

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

查看更多
登录 后发表回答