DrawFormattedText2 text display error

Hi,


I am working on an divided visual field experiment, and want to present words about half inch distance from the center of the screen on either the left or the right side of a fixation dot.


My problem is that the text is presented with the bottom pixels of the letters cut off (I've attached a picture).


I use DrawFormattedText2 by presenting words on the left side justified to the right of a winRect on the left side of the screen, positioned at the required distance (ie., cca. half inch from the center), and words on the right side justified to the left of a winRect on the right side of the screen. I've tried to use the 'cache' struct as well, but it provides the same erroneous result.


I am running the experiment on a 15" MacBook Pro (late 2011), using Matlab 2018a, and the most recent version of Psychotoolbox.


Does anyone have any ideas for a solution or a work around?


My winRect extends from the top of the screen to the bottom, so it is definitely not cutting the letters.


Initially I tried DrawFormattedText, but left justification is inaccurate with the 'justifytomax' parameter (the letters exceed the winRect box boundary a bit).



Here is the code:

Screen('FillRect',EXPWIN,BACKCOLOR);%redraw background

DrawFormattedText(EXPWIN, '.', 'center', 560, [255, 0, 0]);%fixation dot

DrawFormattedText2(['<color=ffffff>', target_word{1}], 'win', EXPWIN,'sx', justify, 'sy', 'center','xalign', justify, 'yalign', 'center','winRect', pres_box);%lateralized target word

Screen('DrawingFinished',EXPWIN);%no more drawing

[targetVBLTimestamp targetStimulusOnsetTime targetFlipTimestamp] =             Screen('Flip',EXPWIN,jitter2_onset+jitter2-slack);%flip it



Many thanks for any input!


Best,

Bálint


I leave dealing with DrawFormattedText2 bugs to Diederick. But the basic prep question would be if PTB gave you any warning/error/info messages relating to text drawing and you ruled out/fixed problems as explained in "help DrawTextPlugin"?


If PTB has to fall back to macOS lousy native text renderer that could explain problems with cut-off text. Does it happen with other text fonts as well? With our own demos like DrawFormattedText2Demo? Also you should provide a minimal but complete piece of example code, so people can just run it, without having to write half the code themselves.

-mario

On Tue, Jan 15, 2019 at 12:56 AM bforg@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:
[Attachment(s) from bforg@... included below]

Hi,


I am working on an divided visual field experiment, and want to present words about half inch distance from the center of the screen on either the left or the right side of a fixation dot.


My problem is that the text is presented with the bottom pixels of the letters cut off (I've attached a picture).


I use DrawFormattedText2 by presenting words on the left side justified to the right of a winRect on the left side of the screen, positioned at the required distance (ie., cca. half inch from the center), and words on the right side justified to the left of a winRect on the right side of the screen. I've tried to use the 'cache' struct as well, but it provides the same erroneous result.


I am running the experiment on a 15" MacBook Pro (late 2011), using Matlab 2018a, and the most recent version of Psychotoolbox.


Does anyone have any ideas for a solution or a work around?


My winRect extends from the top of the screen to the bottom, so it is definitely not cutting the letters.


Initially I tried DrawFormattedText, but left justification is inaccurate with the 'justifytomax' parameter (the letters exceed the winRect box boundary a bit).



Here is the code:

Screen('FillRect',EXPWIN,BACKCOLOR);%redraw background

DrawFormattedText(EXPWIN, '.', 'center', 560, [255, 0, 0]);%fixation dot

DrawFormattedText2(['<color=ffffff>', target_word{1}], 'win', EXPWIN,'sx', justify, 'sy', 'center','xalign', justify, 'yalign', 'center','winRect', pres_box);%lateralized target word

Screen('DrawingFinished',EXPWIN);%no more drawing

[targetVBLTimestamp targetStimulusOnsetTime targetFlipTimestamp] = Screen('Flip',EXPWIN,jitter2_onset+jitter2-slack);%flip it



Many thanks for any input!


Best,

Bálint


Thanks for the report. I have seen it, but it will take me quite a while to get to it I'm afraid. Does this happen only when drawing with this function, or also when using Screen('DrawText') directly?

I also note that on my Windows systems, underlining of text does not seem to work at all. I'll look into that too (matters for myself).

Would you be able to make an issue in the github issue tracker so that this is not forgotten?

All the best,
Dee

On Tue, Jan 15, 2019 at 12:54 AM bforg@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:
[Attachment(s) from bforg@... included below]

Hi,


I am working on an divided visual field experiment, and want to present words about half inch distance from the center of the screen on either the left or the right side of a fixation dot.


My problem is that the text is presented with the bottom pixels of the letters cut off (I've attached a picture).


I use DrawFormattedText2 by presenting words on the left side justified to the right of a winRect on the left side of the screen, positioned at the required distance (ie., cca. half inch from the center), and words on the right side justified to the left of a winRect on the right side of the screen. I've tried to use the 'cache' struct as well, but it provides the same erroneous result.


I am running the experiment on a 15" MacBook Pro (late 2011), using Matlab 2018a, and the most recent version of Psychotoolbox.


Does anyone have any ideas for a solution or a work around?


My winRect extends from the top of the screen to the bottom, so it is definitely not cutting the letters.


Initially I tried DrawFormattedText, but left justification is inaccurate with the 'justifytomax' parameter (the letters exceed the winRect box boundary a bit).



Here is the code:

Screen('FillRect',EXPWIN,BACKCOLOR);%redraw background

DrawFormattedText(EXPWIN, '.', 'center', 560, [255, 0, 0]);%fixation dot

DrawFormattedText2(['<color=ffffff>', target_word{1}], 'win', EXPWIN,'sx', justify, 'sy', 'center','xalign', justify, 'yalign', 'center','winRect', pres_box);%lateralized target word

Screen('DrawingFinished',EXPWIN);%no more drawing

[targetVBLTimestamp targetStimulusOnsetTime targetFlipTimestamp] = Screen('Flip',EXPWIN,jitter2_onset+jitter2-slack);%flip it



Many thanks for any input!


Best,

Bálint




Try a new DrawFormattedText2.m from here:


That's a version improved by Diederick + some small improvement from myself for the next beta. Testing on Linux shows that this one doesn't cut away the bottom pixel row of text in a quick test.

-mario


On Thu, Jan 17, 2019 at 11:59 PM 'Diederick C. Niehorster' dcnieho@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:

Thanks for the report. I have seen it, but it will take me quite a while to get to it I'm afraid. Does this happen only when drawing with this function, or also when using Screen('DrawText') directly?

I also note that on my Windows systems, underlining of text does not seem to work at all. I'll look into that too (matters for myself).

Would you be able to make an issue in the github issue tracker so that this is not forgotten?

All the best,
Dee

On Tue, Jan 15, 2019 at 12:54 AM bforg@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:
[Attachment(s) from bforg@... included below]

Hi,


I am working on an divided visual field experiment, and want to present words about half inch distance from the center of the screen on either the left or the right side of a fixation dot.


My problem is that the text is presented with the bottom pixels of the letters cut off (I've attached a picture).


I use DrawFormattedText2 by presenting words on the left side justified to the right of a winRect on the left side of the screen, positioned at the required distance (ie., cca. half inch from the center), and words on the right side justified to the left of a winRect on the right side of the screen. I've tried to use the 'cache' struct as well, but it provides the same erroneous result.


I am running the experiment on a 15" MacBook Pro (late 2011), using Matlab 2018a, and the most recent version of Psychotoolbox.


Does anyone have any ideas for a solution or a work around?


My winRect extends from the top of the screen to the bottom, so it is definitely not cutting the letters.


Initially I tried DrawFormattedText, but left justification is inaccurate with the 'justifytomax' parameter (the letters exceed the winRect box boundary a bit).



Here is the code:

Screen('FillRect',EXPWIN,BACKCOLOR);%redraw background

DrawFormattedText(EXPWIN, '.', 'center', 560, [255, 0, 0]);%fixation dot

DrawFormattedText2(['<color=ffffff>', target_word{1}], 'win', EXPWIN,'sx', justify, 'sy', 'center','xalign', justify, 'yalign', 'center','winRect', pres_box);%lateralized target word

Screen('DrawingFinished',EXPWIN);%no more drawing

[targetVBLTimestamp targetStimulusOnsetTime targetFlipTimestamp] = Screen('Flip',EXPWIN,jitter2_onset+jitter2-slack);%flip it



Many thanks for any input!


Best,

Bálint