Any test-program will which uses AltertWindows or Tooltips has the problem (running without debugger the release build - VS2008 - Windows SDK 7.1 - W8 64bit - 32bit app)
So you could just open a AlertWindow:
It clearly happens for more than one person, so there must be something going on…
Wouldn’t it be easier to just do 10 minutes of debugging on someone else’s machine with teamviewer? ( http://www.teamviewer.com )
If the program-to-be-debugged is super simple (i.e. the simpelest we can get to reproduce it) it shouldn’t take more than that for you to figure out what is going wrong.
In any case it would be quicker than discussing this ad infinitum
Have a look at line 380 of juce_win32_DirectWriteTypeLayout.cpp - there’s a bodge in there that’s only enabled for 64-bit builds… If you’re running 32-bit, maybe try enabling it and see what happens?
FFS, Microsoft! If it never returns a sensible value, how the hell are we supposed to use it??
Random idea: what optimisation flags have you got turned on in your release build? I know that if you enable one of the more extreme floating-point optimisations, the MS compiler can screw up some float calculations - perhaps that’s what’s happening here?
optimization flags, i use the standard in introjucer, it says “Optimize for size and speed”, but wait… VS2008 shows “Minimize Size (/O1)” WTF???
it seems <Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="1"
is wrong
Full Optmization is 3 , Optimize Size is 1, Optimize for Speed 2
So it should be 3 and not one!
Anyway: Changing the optimization setting “Optimization” does not help!!!
BUT:
Changing Inline function expansion from: “Only __inline (/Ob1)” to “Any Suitable (/Ob2)” works!!!
But not sure if this a random success, would like to know if other people can reconstruct that…
I’m really at a loss for what to suggest… The code that returns that float is entirely in Microsoft-land, so compiler options should make no difference.
It just makes no sense that it can call the function with all the other parameters correct, but one of them broken. I’m just stumped. The calling convention is correct because it uses JUCE_COMRESULT, so there shouldn’t be any alignment issues. It’s a total WTF!
Did you use the right mode before using the interface ?
Renderer implementations may choose different rendering modes for given measuring methods, but best results are seen when the rendering mode matches the corresponding measuring mode:
/// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL
/// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC
/// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL
From the public repositories using this function (code.google.com/codesearch for DrawGlyphRun), there is no bug report nor any workaround, so it might be a bad initialization, not the method itself.
I wonder if FLOAT macro maps to a float or double, or if any parameters in there are not the right size (it would explain why you see bullshit value in there). One way to assert this, is to break on the debugger when this happen, load the “Memory” window, and enter “&baselineOriginY” here, so to check if it’s 4 bytes, or 8 bytes, and if the memory around contains the expected value.
I have turned off JUCE_USE_DIRECTWRITE and will see if it improves rendering on W8.
Jules, what do you use DirectWrite for? I was under the impression that the actual rendering was done in your own code?
With DirectWrite off, the text is slightly larger; not so much it hurts, but a little bit.
Would this bug still exist if one used for example “FreeType”?
[quote=“chkn”]just for my interest, Mike could you please check:
setting OPTIMIZATION to "FULL OPTIMIZATION"
and setting INLINE FUNCTION EXPANSION to “Any Suitable (/Ob2)”
if the problem still happens?[/quote]
Actually, I haven’t seen the problem my self, only one beta tester. Besides, I use Intel C++ and not MS.
Since the issue seem (?) be originating inside DirectX (?) for W8 64 bit, any optimization settings on our side seem unlikely to do anything other than tipping the circumstances if they are already on the edge. Perhaps it’s a matter of CPU register contents or something.
DirectWrite is used for font enumeration, obtaining glyph paths and text layout. Rendering paths to pixels is done by Juce in all cases. The text layout is only used when you use AttributedString or TextLayout classes. Juce’s AlertWindow uses the TextLayout classes.
No, the bug is directly due to DirectWrite. If you turn it off, you won’t get the bug.