# DrawFormattedText show incomplete text

**URL:** <https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690>\
**Category:** Programming Help\
**Created:** [November 12, 2022, 4:08pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690 "2022-11-12T16:08:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhenzi](https://avatars.discourse-cdn.com/v4/letter/z/f04885/32.png) [@zhenzi](https://psychtoolbox.discourse.group/u/zhenzi)\
**Post date:** [November 12, 2022, 4:08pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/1 "2022-11-12T16:08:53Z")

</div>

Hi,

I used DrawFormattedText to show text but found the top (about1/4) of the text did not appear in my laptop. But it did show completely in another desktop with the same codes.

I wonder why and how to fix it ?  
Thanks!

The codes:  
“Screen(‘Preference’, ‘SkipSyncTests’, 1);  
[w,wrect]=Screen(‘OpenWindow’,0,222,[50,50,1900,1000]);  
DrawFormattedText(w,double(‘20221011’),‘center’,‘center’,0);  
Screen(‘Flip’,w);”  
The result in the laptop:

 ![6e6ecd3c7abb9040eef57cb26fb02e7](https://global.discourse-cdn.com/free1/uploads/psychtoolbox/original/1X/c74612507a8efe70f955ac1847d5231888f9bae8.jpeg)

---

<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:** [November 12, 2022, 5:58pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/2 "2022-11-12T17:58:16Z")

</div>

search the forum for drawtext plugin, this comes up frequently

---

<div class="post-metadata">

**Author:** ![zhenzi](https://avatars.discourse-cdn.com/v4/letter/z/f04885/32.png) [@zhenzi](https://psychtoolbox.discourse.group/u/zhenzi)\
**Post date:** [November 13, 2022, 10:11am UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/3 "2022-11-13T10:11:10Z")

</div>

Thank you! It works with Screen(‘DrawText’…).

---

<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:** [November 13, 2022, 4:48pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/4 "2022-11-13T16:48:03Z")

</div>

Your report lacks information about operating system and display setup, but this looks like a combination of

- Using the MS-Windows operating system.
- The drawtext plugin failing to load on it → Fallback to less capable GDI renderer, which among other things can’t deal with HiDPI displays, unusual fonts, and various other things.
- Using a HiDPI display and therefore a scaling factor other than 100% (No scaling).

The likely solution is to get drawtext plugin to load: → `help DrawTextPlugin`.

---

<div class="post-metadata">

**Author:** ![zhenzi](https://avatars.discourse-cdn.com/v4/letter/z/f04885/32.png) [@zhenzi](https://psychtoolbox.discourse.group/u/zhenzi)\
**Post date:** [November 14, 2022, 3:43am UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/5 "2022-11-14T03:43:50Z")

</div>

Thank you! It is indeed the HiDPI display in my laptop. When I set the scaling factor to 100%, the text is shown completely.

---

<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:** [November 14, 2022, 5:17am UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/6 "2022-11-14T05:17:14Z")

</div>

But that problem only happens with the fallback text renderer, which is not recommended for use, therefore → `help DrawTextPlugin`.

---

<div class="post-metadata">

**Author:** ![zhenzi](https://avatars.discourse-cdn.com/v4/letter/z/f04885/32.png) [@zhenzi](https://psychtoolbox.discourse.group/u/zhenzi)\
**Post date:** [November 14, 2022, 9:00am UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/7 "2022-11-14T09:00:59Z")

</div>

Thank you so much! But I don’t seem to understand. ‘help DrawTextPlugin’ seems to slove the error of Screen() function that fails to load the external text renderer plugin and need to install some 3rd party libraries in MS-Windows operating system. But the Screen(‘DrawText’) function in my laptop works well and shows complete text. Only DrawFormattedText function shows incomplete text. So I am not sure if it is the problems of plugin?

---

<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:** [November 14, 2022, 9:12am UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/8 "2022-11-14T09:12:50Z")

</div>

we are sure it is. Install those 3rd party libraries and you will have better text rendering, through both methods (there are positioning and sizing problems also with plain Screen(‘DrawText’) that you’re apparently not noticing)

---

<div class="post-metadata">

**Author:** ![zhenzi](https://avatars.discourse-cdn.com/v4/letter/z/f04885/32.png) [@zhenzi](https://psychtoolbox.discourse.group/u/zhenzi)\
**Post date:** [November 14, 2022, 9:51am UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/9 "2022-11-14T09:51:21Z")

</div>

OK. I know. Thanks a lot!

---

<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:** [November 14, 2022, 3:00pm UTC](https://psychtoolbox.discourse.group/t/drawformattedtext-show-incomplete-text/4690/10 "2022-11-14T15:00:36Z")

</div>

Btw., the fact that you were able to do without installing the GStreamer libraries suggests that you are on a old, outdated and unsupported Psychtoolbox version, v3.0.15 or earlier, so upgrading is recommended.
