Search Unity

TextMesh Pro Use different font styles of a font family

Discussion in 'UGUI & TextMesh Pro' started by johannesgaebler, Aug 28, 2019.

  1. johannesgaebler

    johannesgaebler

    Joined:
    Jun 17, 2019
    Posts:
    28
    Hello!
    This is my first post on this forum so let me know if I did something wrong ;-)

    I want to add a font family to my project and use their different font styles (as you would in Adobe Illustrator for example, see attached image).
    In my case it is the Bahnschrift.ttf font family, which comes in 15 different styles.

    I tried everything I know about Unity and fonts but couldn't get it to work so that I can use other styles than the "Regular" style. However, TMPro allows me to set it to bold, italic and so on but not to the included "SemiLight", "Condensed",... styles.

    Thanks in advance!
     

    Attached Files:

    AlexSerebriakov likes this.
  2. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Did you ever manage to get this working? I have the same issue.
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I started exploring making changes to the Font Asset Creator to display a list of font files / styles contained in the TrueType Collection (.ttc) font file and to then create a font asset using the selected face index / style.
     
  4. johannesgaebler

    johannesgaebler

    Joined:
    Jun 17, 2019
    Posts:
    28
    I never managed to solve it and I am still not sure what the exact problem was, I am not a font expert tho. In the end, I used a very similar font in .ttf format which worked as intended and without any problems.
     
  5. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    Clicking the TMPro-font .asset file, you should see an option to manually set references to other fonts. It all has to be done manually though - would be awesome to just import a whole family and have TMPro auto map based on the naming etc.
    font family.png
     
    GrandCash likes this.
  6. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Unfortunately, that's not the same thing as what is being discussed above. We only have one font (that contains multiple font weights) but when creating that font you cannot select which of the font weights to use to generate the Font Asset.
     
    Kokowolo and TheVirtualMunk like this.
  7. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    Ahh right, guess its a ttf vs otf format thing? (not a font format expert)
     
  8. kenor_brooks

    kenor_brooks

    Joined:
    Jun 4, 2020
    Posts:
    46
    Up.
    I wouldn't want to create 10 different atlases for a font when the ttf file contains all of them inside itself.
     
  9. Kokowolo

    Kokowolo

    Joined:
    Mar 26, 2020
    Posts:
    60
    Up.
    Still shocked I can't reference the different font weights within a single .ttc file. Ugh. Well to solve this I used a font unpacker, https://transfonter.org/ttc-unpack. Hope there's a solution in the next version of TextMeshPro that isn't creating multiple font files and manually setting them within an TMP asset.