Strange font height from Directdraw and BubbleComponent

If I add a BubbleMessageComponent to my application (x64, windows7, JUCE_USE_DIRECTWRITE) it won’t show up and eventually ImagePixelData::ImagePixelData will complain about zero height.

After some debugging it turns out that the win32 callback function DrawGlyphRun on line 64 in DirectWriteTypeLayout.cpp gets called from Windows w/ baselineOriginY=-1.#INF000 or 1.#INF000

I have to add the following line as the very first line of DrawGlyphRun to make it work properly

if ((int)baselineOriginY == 0x80000000)
baselineOriginY = 12.43f;

Subsequent invocations of BubbleMessageComponent.showAt works fine (and baselineOriginY will have a descent value), it’s only the first call of DrawGlyphRun that exhibits this strange phenomenon.

Is it a bug or am I expected to make some sort of graphics initiation before using DirectWrite?

It’s yesterdays tip, but it was the same last month I remember.

It happens only in x64, not x86.

Well, in fact you get the same behaviour in the Juce Demo. Select the widgets menu, buttons tab and click a button. Instead of a bublemessage you’ll get a zero height assert after the first click. It’s just the first bubble message that won’t show, subseqent ones receives a proper font height from DrawGlyphRun and is shown.

Bizarre. As far as I can tell, it does seem to be a bug in 64-bit Windows. Win32 is fine.

I couldn’t see anything that the code was doing that could be blamed for causing it, so I’ve added a bodge that makes a dummy call the first time the function is used, and it seems to work ok after that.

Thanks for the heads-up!