Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Adding support for OpenType-SVG fonts

Discussion in 'UGUI & TextMesh Pro' started by fontself, Jul 23, 2019.

  1. fontself

    fontself

    Joined:
    Sep 28, 2013
    Posts:
    3
    Hey, color fonts have become a big thing in the design industry now that Adobe, Apple & Microsoft support them on their flagship apps & systems.

    As the OpenType-SVG format bring textures and shades to fonts, it would bring a ton of creative possibilities to designers. So how about supporting them in Unity?

    For full disclosure, OpenType-SVG color fonts can be created with Fontself Maker, our commercial font creation extension for Illustrator and Photoshop (because yes, color fonts can be made from either vector shapes or bitmap images). Many of our users requested support in Unity, so we can't wait to tell them about the good news in a not so distant future :)
     
    MauriceAbi and Arphic like this.
  2. fontself

    fontself

    Joined:
    Sep 28, 2013
    Posts:
    3
    Would love your input @Stephan_B on this technical challenge ;)
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I need to look further into this but I am hoping that as I add support for rastered colored glyphs / color emoji this will also end up supporting the rastered versions of those colored fonts.

    Support for the SVG variant of this isn't planned short term.
     
    jelloboy307, Retruate and fontself like this.
  4. fontself

    fontself

    Joined:
    Sep 28, 2013
    Posts:
    3
    Thanks a lot for the update @Stephan_B this will be a wonderful first step!
     
  5. VishweshVichu

    VishweshVichu

    Joined:
    Oct 31, 2017
    Posts:
    4

    Hello,

    Is this possible now to import Open-SVG fonts? I want to use emojis inside my project. So It would be more helpful if Unity supports it.

    Cheers,
    Vishwesh.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Adding support for color glyphs which are encoded in different ways in a font file is something that I am planning to add for TMP which will also be available for UI Toolkit.
     
    mikejm_ likes this.
  7. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    Hey Stephan, how is the progress with this going? Do you have any ETA? Currently as far as I can see there is no really good way to get Emojis into UI Toolkit or anywhere really in Unity. Would be good if we could use Color SVG fonts for this.

    Is it planned to somehow be able to access the OS's native Emoji font as well (Eg. on Android or iOS mobile)? Or would we have to put our own Emoji supporting Open-SVG font in there to do it? Thanks.

    Will this also work on TextGenerator? I use that for judging sizes and positions of characters so would need it as well. Is that all the same as TMP? ie. if it works for TMP, it works for TextGenerator?

    I need UI Toolkit and TextGenerator most. Thanks.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Basic support for native emoji in TMP should be available within the next 45 to 60 days. This will require a Unity update as these changes are contained in the Font Engine which is mostly native code included with the Editor. This new functionality will be available in the existing release of TMP which is version 3.2.0-pre.3.

    This new functionality will also include support for Glyph Positional Adjustment, Diacritical Mark data from the GPOS tables and Ligature data from the GSUB tables being extracted from source font files at runtime to populate the relevant tables in the font assets.

    The above is described as basic native emoji support as depending on the platform and font file, some emoji modifiers are implemented via additional OpenType Layout features which I have already implemented in the Font Engine but will require a new version of the TMP package and TextCore TextGenerator to access / leverage. Ie. Support for these additional features will follow.

    As a user, you will be able to create and define in the TMP Settings which text asset (font asset or sprite asset) are used to display emojis. See the image below.

    upload_2022-8-9_22-32-56.png

    In the above example, the fallback font assets are Dynamic OS font assets. Since Segoe UI Emoji is only available on Windows, when on Windows emojis will come from this asset. Since Apple Color Emoji is only on OSX and iOS then emojis will come from it on Apple devices and lastly NotoColorEmoji being only available on Android and Linux (if I recall correctly) will be used those platforms.

    Remember that since this is a list of fallback, we would end up skipping both Segoe UI and Apple Color on Android since they are not available on those platforms. Since Samsung has its own color emojis, you would define a fallback font asset for Samsung and place it before NotoColor. This would ensure that if the Samsung color emoji is present on the device that it would be used before the NotoColor.

    Note that these fallback assets can be static, dynamic or dynamic os. They can also be sprite assets. This provide you with complete control over it all.

    All of this functionality will be available to TMP and UI Toolkit users where it will first be available in TMP as I described above and then be added to TextCore TextGenerator and UI Toolkit.
     

    Attached Files:

    mikejm_ likes this.
  9. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    Wow. Sounds fantastic. So we wouldn't have to deal with trying to make any sprite sheets or custom text + emoji fonts to compensate. It would just use the built in system emoji font. This would also save us space in our apps.

    I will stop pulling my hair out then trying to make custom compounded fonts and sprite sheets and just wait for the proper solution. Thanks for the detailed explanation and all your hard work.
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Correct. If your desire is to leverage system fonts such as those that contain color emojis then provided you create Dynamic OS font assets for each of those system fonts present on the various platforms you are targeting then you willk be able to display native emojis from those system fonts without having to include the font files.
     
    mikejm_ likes this.
  11. MauriceAbi

    MauriceAbi

    Joined:
    Sep 29, 2022
    Posts:
    3
    When can we use colored fonts with TextMeshPro?
     
    WiredPrisoner likes this.