# Multiple lines in a DirectWriteTypeLayout are on top of each other

**URL:** <https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214>\
**Category:** Windows\
**Created:** [July 20, 2014, 11:28pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214 "2014-07-20T23:28:48Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![roeland-2](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/roeland-2/32/738_2.png) [@roeland-2](https://forum.juce.com/u/roeland-2)\
**Post date:** [July 20, 2014, 11:28pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/1 "2014-07-20T23:28:48Z")

</div>

Hi,

We have an issue with alert windows:

![](http://www.juce.com/sites/default/files/forum/attachments/alertwindow2.png)

The problem is fixed by setting JUCE\_USE\_DIRECTWRITE to&nbsp; 0

![](http://www.juce.com/sites/default/files/forum/attachments/alertwindow1.png)

I traced the problem to the DirectWriteTypeLayout layout. If it gets text containing multiple lines it will lay out the lines correctly, except for the vertical placement. All lines will have the Y-coordinate&nbsp;for the baseline set to 0.0. This is affecting alert windows, tool tips and the code editor.

The problem doesn't occur in the IntroJucer or the JuceDemo.

Has anyone seen this problem before? Or does anyone knows if using DirectWrite requires some special build settings?

--  
Roeland

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [July 21, 2014, 7:51am UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/2 "2014-07-21T07:51:11Z")

</div>

I thought this was something I fixed a while ago.. Are you using the latest version?

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [July 21, 2014, 8:10am UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/3 "2014-07-21T08:10:57Z")

</div>

This happen for me as well in Debug version. Works fine in Release though.

But I cannot reproduce with the Juce Demo either.

Never was able to find the real issue there.

&nbsp;

---

<div class="post-metadata">

**Author:** ![roeland-2](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/roeland-2/32/738_2.png) [@roeland-2](https://forum.juce.com/u/roeland-2)\
**Post date:** [July 21, 2014, 11:29pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/4 "2014-07-21T23:29:40Z")

</div>

I am using the head revision from the GIT repository.

I will just disable directWrite in debug builds. In the release build it indeed works.

--  
Roeland

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [October 7, 2014, 1:57pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/5 "2014-10-07T13:57:13Z")

</div>

Ok I've finnaly was able to reproduce it with the Juce Demo with VS 2013 !!!

It only happens in x64 version (which do not exists in Juce Demo by default)

and you need to enable a specific build flag

&nbsp;

Set

C/C++ \> Code Generation \> Basic Runtime Checks

to

Both (/RTC1, equiv. to /RTCsu) (/RTC1)

&nbsp;

So it's maybe related to an unitialized value in Juce or a bug in VS.

&nbsp;

Then check the Dialog Boxes demo \> Plain Alert Window

&nbsp;

Does it ring a bell Jules ?

&nbsp;

Thanks,

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 7, 2014, 2:02pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/6 "2014-10-07T14:02:05Z")

</div>

When I last investigated this, I'm pretty sure that it was a DirectWrite bug, because calling the same DWrite function the first time failed, but then calling it again it work. I agree that it smells&nbsp;like an uninitialised value, but couldn't find any such problem in my code..

---

<div class="post-metadata">

**Author:** ![rebbur](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rebbur](https://forum.juce.com/u/rebbur)\
**Post date:** [October 8, 2014, 8:21am UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/7 "2014-10-08T08:21:38Z")

</div>

We have the same issue. The first AlertWindow we show seems to be wrong, we show one at startup if no registration is found. The second time we show an AlertWindow, when app is running, it shows fine.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 8, 2014, 8:25am UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/8 "2014-10-08T08:25:29Z")

</div>

Have a look at my comment in juce\_win32\_DirectWriteTypeLayout.cpp, line 414..

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [July 20, 2015, 8:34pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/9 "2015-07-20T20:34:42Z")

</div>

A costumer reported this issue&nbsp;Win10 64bits with a 32bit version of my software (but using a ca. half year old juce-tip)

Was this issue ever fixed?

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [July 21, 2015, 7:57am UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/10 "2015-07-21T07:57:08Z")

</div>

The only working fix was the one I gave AFAIK

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [July 21, 2015, 2:22pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/11 "2015-07-21T14:22:28Z")

</div>

I'm remembering debugging&nbsp;this issue problem, even with changed compiled settings, it was pure random if the text renders correct. The only reliable solution was to disable DirectWrite.

Jules, do you hear me? The current situation is unsatisfaying, if its not working 100%, DirectWrite shouldn't be used for text-aligning.

&nbsp;

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [July 27, 2015, 10:47am UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/12 "2015-07-27T10:47:44Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [July 27, 2015, 1:45pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/13 "2015-07-27T13:45:03Z")

</div>

Yeah, we hear you! It's on our list, but being a bug in DirectWrite, we're pretty stumped as to what other workarounds we could try. It's not forgotten though, we'll nail it eventually..

---

<div class="post-metadata">

**Author:** ![jgerrard](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jgerrard](https://forum.juce.com/u/jgerrard)\
**Post date:** [July 27, 2015, 2:07pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/14 "2015-07-27T14:07:08Z")

</div>

I reproduced this in the Windows 10 techincal preview (64 bit with a 32 bit application), but after an update it disappeared again. It might be that in the final version of Windows 10 this won't be an issue.

Can you confirm the build of Windows 10 the issue occured in?

---

<div class="post-metadata">

**Author:** ![timur](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timur/32/541_2.png) [@timur](https://forum.juce.com/u/timur)\
**Post date:** [August 12, 2015, 5:41pm UTC](https://forum.juce.com/t/multiple-lines-in-a-directwritetypelayout-are-on-top-of-each-other/13214/15 "2015-08-12T17:41:37Z")

</div>

We have committed a new fix for this bug today - see this thread: http://www.juce.com/forum/topic/long-running-directwrite-bug-finally-fixed

Please update to the newest tip, this should improve your situation!
