Page 1 of 1

The font does not apply when Build and run the project.

Posted: 21 Feb 2024, 14:06
by aliagha.huseynli
Hello Noesis Team,

I'm encountering an issue related to fonts in my project. While the program functions correctly within the Unity editor, it fails to display the expected font when I build the project and test it on a system lacking that particular font (without prior installation). Interestingly, if I download and install the font on my Windows 11 OS, the program functions as expected due to the system's font availability.

However, when I distribute the build to another PC lacking the font, the program defaults to a different font, such as Arial. I'm puzzled by this behavior and unsure if it's a bug or something else. Could I be overlooking a step or misconfiguring something?

Any guidance would be appreciated.

Thank you.

Re: The font does not apply when Build and run the project.

Posted: 21 Feb 2024, 18:42
by jsantos
System fonts have that problem. If you are going to use them, we recommend using a fallback list (for example setting FontFamily="Arial,Tahoma" to make sure they are picked in the expected order. By default (in NoesisUnity.cs) we have these global defaults:
if (Noesis.Platform.ID == Noesis.PlatformID.Windows)
{
    fonts.Add("Arial");
    fonts.Add("Segoe UI Emoji");        // Windows 10 Emojis
    fonts.Add("Arial Unicode MS");      // Almost everything (but part of MS Office, not Windows)
    fonts.Add("Microsoft Sans Serif");  // Unicode scripts excluding Asian scripts
    fonts.Add("Microsoft YaHei");       // Chinese
    fonts.Add("Gulim");                 // Korean
    fonts.Add("MS Gothic");             // Japanese
}
else if (Noesis.Platform.ID == Noesis.PlatformID.OSX)
{
    fonts.Add("Arial");
    fonts.Add("Arial Unicode MS");      // MacOS 10.5+
}
else if (Noesis.Platform.ID == Noesis.PlatformID.iPhone)
{
    fonts.Add("PingFang SC");           // Simplified Chinese (iOS 9+)
    fonts.Add("Apple SD Gothic Neo");   // Korean (iOS 7+)
    fonts.Add("Hiragino Sans");         // Japanese (iOS 9+)
}
else if (Noesis.Platform.ID == Noesis.PlatformID.Android)
{
    fonts.Add("Noto Sans CJK SC");      // Simplified Chinese
    fonts.Add("Noto Sans CJK KR");      // Korean
    fonts.Add("Noto Sans CJK JP");      // Japanese
}
else if (Noesis.Platform.ID == Noesis.PlatformID.Linux)
{
    fonts.Add("Noto Sans CJK SC");      // Simplified Chinese
    fonts.Add("Noto Sans CJK KR");      // Korean
    fonts.Add("Noto Sans CJK JP");      // Japanese
}
But if possible, we always recommend embedding the font in the project.

Re: The font does not apply when Build and run the project.

Posted: 22 Feb 2024, 10:39
by aliagha.huseynli
Thanks a lot. I saw the problem and fixed it. :)