Our game fails to start when launching in the Arabic Language

We use the MediaPlayer module for our hard loading screens (boot up and transition between worlds). We also use the HarfBuzz glyph shaper for the Arabic language. These two seem incompatible since FHarfBuzzFontCache::CreateFont() has a check at the top of the function requiring it to be run on the game thread and the Media Player runs on a separate thread. Is there a plan to resolve this incompatibility? Or is there a way to prime the FHarfBuzzFontCache on the game thread before the loading screen comes up?

[Attachment Removed]

Steps to Reproduce
Create a project that uses the MediaPlayer module

Create a slate widget that has Arabic text on it that shows up as part of the loading screen.

Run the stand alone game to allow the loading screen to show up.

Notice the crash.

[Attachment Removed]

Hi,

By MediaPlayer, do you mean the FDefaultGameMoviePlayer setup? It *should* be safe to modify that check to also include IsInSlateThread() since in this particular case you know that the game thread is blocked and no cross-thread access should be happening, but it’s a bit risky since the loading could end and there might be a brief window where a race condition would occur. I wouldn’t expect that as long as your loading screen lasts long enough for the text to be loaded to the cache, but there’s some risk involved there.

A better approach here, if you know what text you need to display, would be to prewarm the cache with your loading screen text from the game thread prior to the load. You could do this by getting the font cache via FSlateApplication::Get().GetRenderer()->GetFontCache() and forcing it to load in your text via ShapeBidirectionalText.

There’s still a bit of a problem in that we still do that check even when the glyphs we need are cached, so you could explore using something like a retainer panel to prebake the text into a texture on the game thread prior to loading to avoid needing to do any text shaping on the load screen. That said, it might be simpler in this case to just update the check and try running the text shaping on the slate loading thread, with a note to revisit that if you see any reports of startup crashes.

Best,

Cody

[Attachment Removed]

The suggestion by Cody worked great! Thank you!!

[Attachment Removed]

Thank you for the feedback. I will give those a test and report any further problems I have.

[Attachment Removed]