Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Pan-language font in WebGL increases build size and load time by 100%

Discussion in 'WebGL' started by cowlinator, Oct 18, 2016.

  1. cowlinator

    cowlinator

    Joined:
    Mar 15, 2012
    Posts:
    69
    I'm trying to localize my WebGL game. I need to use a font that covers most/all languages (including Chinese). I cannot use the user's local system fonts, as that is not supported in Unity-WebGL.
    Currently I'm including "DroidSansFallback.tff" in the build, which has a huge filesize of 2.9MB (The smallest font I could find which covers the Unicode Basic Multilingual Plane).
    The font doubles the size of my build, and has a huge load-time impact for my game on some browsers.

    I need to solve this problem.

    I've considered downloading the font externally and in parallel with the Unity build, to help speed up the process.
    But unfortunately, I can't put a ".tff" file in an asset bundle ("Unrecognized assets cannot be included").
    I can get the font directly using WWW, but I can't find a way to turn a byte array representing a font into a UnityEngine.Font object.

    If anybody has experienced this issue, or has any advice or tips, it would me much appreciated!
     
  2. davebuchhofer

    davebuchhofer

    Joined:
    Nov 9, 2007
    Posts:
    126
    I'm running into the same problem here trying to localize a webgl build, does anyone have advice?
     
  3. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,595
    I'd be interested in this too, anyone find a way to at least keep the font resource outside of Unity, adding fonts to the English version massively increasing the file size to support other languages seems like a very poor option.