- Home /
How do you make fallback fonts work?
Hi all,
I'm using a font called Deja Vu (DejaVuSansCondensed-Bold to be precise) which has good language support, but I need it to fallback to some variants of Noto Sans for some languages.
I can't get it to work however - I've set up the fallback font list to containt the true font names of Noto Sans for Japanese, Korean and Simplified & Traditional Chinese (Noto Sans KR, Noto Sans JP, Noto Sans TC & Noto Sans SC) That didn't work.
I've also tried using the filenames rather than the font names (NotoSansJP-Bold, NotoSansKR-Bold etc) - that also didn't work. Those languages always render empty glyphs.
I've read the Unity help on Font importing - it doesn't say much on Fallbacks other than 'Font Names : A list of fallback fonts to use when fonts or characters are not available'.
All my fonts are required to be imported as Dynamic - I'm not sure if that makes a difference or not.
Has anyone had any success with fallback fonts?
On Windows, it appears to work, but what is actually happening is that system-provided fallback fonts are being used, not the ones I have specified.
On other platforms, without system-default fallbacks, I just get blank characters.
EDIT : I've fixed my own problem. It might be worth leaving this post to help others though. It turns out that the fallback font list should not be formatted like this :
Font 1
Font 2
Font 3
as I was doing. Instead, it should be :
Font 1, Font 2, Font 3
The documentation on this could be a bit clearer!
5 years later this question and your answer helped me. Thanks! And yes, 5 years later the documentation could be a lot better!
Answer by bigticket21 · Sep 04, 2015 at 02:51 PM
Sort of a late reply, but I'm glad you discovered what was the problem!
After thoroughly checking out Unity docs, all I could find was this:
When Unity tries to render text with a dynamic font, but it cannot find the font (because Include Font Data was not selected, and the font is not installed on the user machine), or the font does not include the requested glyph (like when trying to render text in east Asian scripts using a latin font), then it will try each of the fonts listed in the Font Names field, to see if it can find a font matching the font name in the project (with font data included) or installed on the user machine which has the requested glyph. If none of the listed fallback fonts are present and have the requested glyph, Unity will fall back to a hard-coded global list of fallback fonts, which contains various international fonts commonly installed on the current runtime platform.
Of course that doesn't help much, so there should be an improvement there.
I'm mostly answering so this gets some visibility, because it was hard to find.