Windows - fallback fonts

Does anyone know how to get fallback fonts working:

image

I’ve tried setting the fallback font to Arial Unicode MS which I’ve installed and it doesn’t help!

it only works correctly with TextLayout and when using system font (non custom font).
In that case no need to use the explicit fallback font though.

In our software, we use a custom font but I detect if there are “strange” char in the text and in that case use a default font so the fallback used by TextLayout works…

static bool canBeRepresented(juce::StringRef text)
{
  for (auto t = text.text; !t.isEmpty();)
  {
    auto c = t.getAndAdvance();
    if (!(c < 0x024f || (c >= 0x2000 && c < 0x20d0))) // latin char and punctuation
      return false;
   }
   return true;
}

I wouldn’t mind seing this cleaned :slight_smile:

Yeah, because I’ve just found a bug in TextLayout as well which we’ve just moved away from. So I need to be using the default font entirely and just TextLayout. What are you using to detect unusual characters?

I ve updated my post

1 Like

Wonder if i can hack this so TextEditor works as well.

Did you ever find a solution for this?

We’ve found a similar issue where Korean, Chinese, Japanese, etc. aren’t being rendered at all on windows - we’re not even getting the palceholder [] characters! We’re using Nunito Sans which doesn’t have glyphs for those languages, but on macOS it is using some sort of fallback.

Using juce::Font::setFallbackFontName() with a font known to be installed on the system didn’t have any effect.