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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Special Characters in ugui, webgl

Discussion in 'UGUI & TextMesh Pro' started by wastvedt, Jun 7, 2016.

  1. wastvedt


    Oct 6, 2012
    I have a webgl project using ugui. If I add a trademark character (™) to a text component it displays fine in the text box and also in play mode within the Unity editor. However, when I build the app and run it in the browser, the trademark characters don't display. I'm using the default Arial font. Any thoughts? Thanks!
  2. liortal


    Oct 17, 2012
    Not sure this is your case, but it sounds like it:
    I know that on WebGL, there's no fallback to system fonts like you have on other platforms.

    On mobile, in case a character is encountered that does not exist in the font you're using, a fallback is made to fonts that are installed on the device. It's hard to notice this sometimes as the text will be made of 2 different fonts (the one you've configured to use, and another fallback one that will be used for the missing characters).

    On WebGL, this fallback is not done, and so any characters missing from the font you're using will not be displayed at all.
  3. wastvedt


    Oct 6, 2012
    Ahah. Thanks! I was using an Arial font that I think came built in - 'Library/unity default resources', but that must be missing the extra glyphs. Using a different arial.ttf works.
  4. Jack-Draak


    Mar 22, 2015
    Wow this would have been a non-issue if I knew a week ago what I know now:

    The issue: Unity Editor and PC builds are able to "fallback" to a system font when the font-in-use lacks glyphs that are being printed. WebGL builds can't do this (my bug report has been closed).

    Psych! Actually they can:

    1. make sure you have included the fallback font in your Assets. (not highlighted above, but "arial" can be seen there).

    2. on the Import setting of the primary font (select the font in your Assets) you need to add your fallback font(s) to the list of Font Names (see red circled areas above) as a comma separated list. Click Apply in the Inspector.

    3. generate a WebGL build.

    4. profit!
    previous comments, unedited:

    A friend directed me here. I have an issue with WebGL builds not rendering my block cursor ░. I'm using the font Dotrice-Condensed.otf which, as far as I can tell doesn't specifically have a block cursor. Here's where I'm confused: neither does it appear to have a character for underscore, but the WebGL builds are rendering underscores and not the block cursor.

    Maybe I'm not understanding the issue? At any rate, my goal is to get a block cursor... Do I have to make my own font now? :) Thanks for any insights.

    EDIT: Ahh I've looked deeper than what Windows 7 offers as a "preview" of the font. So, it does have an underscore, in the font I'm using, but not the block cursor :(

    Next step, I'll see if I can contact the font author to see if they would add it, I guess. In the meantime, I seem to recall an item in the asset store called Text Mesh Pro that might allow me to have two fonts in the same textbox. (Thanks for the thread.)
    Last edited: Jul 13, 2018