Chinese support issue


#1

I am using vs2015 to develop JUCE project.

I updated to JUCE4.2 today and tried to run my project, but I always got violation.

After some debugging, I found out the problem was setDefaultSansSerifTypefaceName.

I used setDefaultSansSerifTypefaceName to support Chinese.

LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypefaceName(“Microsoft JhengHei UI”)

It worked fine before, but now I got access violation all the time.

Exception thrown at 0x0000000076D7A873 (ntdll.dll) in ImageViewer.exe: 0xC0000005: Access violation writing location 0x000000000002558C.

And it seems something wrong in juce_win32_DirectWriteTypeface.cpp

Could anyone give me some suggestions?

Thanks


#2

If it’s crashing, what’s the stack trace?


#3

Hi Jules,

I did’t look into stack trace, but I found a solution.

I moved

LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypefaceName(“Microsoft JhengHei UI”);

to the beginning of MainComponent constructor and everything is fine.

It seems that I need to set the font type before initializing other components.

I will check the call stack and find out the dependency.

Thanks