Missing text in a native window


#1

…first of all apologies I’m a Windows dev noob…

I’m adding a Juce component to a native window very much like the VST wrapper etc. like so

                const int w = x->juceEditorComp->getWidth();
                const int h = x->juceEditorComp->getHeight();
                x->juceWindowComp->setBounds(0, 0, w, h);
                x->juceEditorComp->addToDesktop (0);

                HWND hostWindow = wind_gethwnd(x->window);
                HWND editorWnd = (HWND) x->juceEditorComp->getWindowHandle();

                SetParent (editorWnd, hostWindow);

                DWORD val = GetWindowLong (editorWnd, GWL_STYLE);
                val = (val & ~WS_POPUP) | WS_CHILD;
                SetWindowLong (editorWnd, GWL_STYLE, val);
                x->juceEditorComp->setVisible (true);

x is a struct for my app and wind_gethwnd() is a function from the API I’m using (MaxMSP) which should return the HWND of the window I want to place the component in. It sort of works:

…but as you can see - no text. It works on Mac using HIViews:

Any ideas what I’m doing wrong?


#2

Strange… It looks like it’s just failing to find any fonts. Have you called stuff like initialiseJuce_GUI() when your DLL first gets loaded?


#3

Yes very weird. I am doing initialiseJuce_GUI() immediately in the DLL’s main entry point. Doing a debug build I don’t get any failed assertions either (I just get “Juce 1.46” in the output).


#4

Well, next thing I’d try would be a quick debug into the Typeface::findTypefaceFor method, to see what name it’s asking for, and see if it actually comes up with anything. And if that all seems ok, next stop would be addGlyphToTypeface() in juce_win32_Fonts.cpp, to see what’s going on there.

And also breakpoint Font::getDefaultFontNames, which should get called early on.

But I’m a bit stumped, can’t think of any sensible reason for this.