Multiple lines in a DirectWriteTypeLayout are on top of each other


We have an issue with alert windows:

The problem is fixed by setting JUCE_USE_DIRECTWRITE to  0

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 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?


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

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.


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.


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



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


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


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


Then check the Dialog Boxes demo > Plain Alert Window


Does it ring a bell Jules ?



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 like an uninitialised value, but couldn't find any such problem in my code..

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.

Have a look at my comment in juce_win32_DirectWriteTypeLayout.cpp, line 414..

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

Was this issue ever fixed?

The only working fix was the one I gave AFAIK

I'm remembering debugging 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.



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..

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?

We have committed a new fix for this bug today - see this thread:

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