Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TextMesh Pro Font Weights (typefaces) and how to use them

Discussion in 'UGUI & TextMesh Pro' started by Cleverlie, Jun 22, 2019.

  1. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    209
    Hi, I was wondering if there is an easy way to use the different font weights that you can assign to the font asset, I mean, if I have Roboto-light, Roboto-bold, Roboto-medium etc, then I can assign them in the "Font Weights" section of my "Regular" version, then when I activate the Bold option on the text object it will use the Bold font instead of the regular one. the same goes if I use the rich text "<b>" tags.

    I wonder how can I do the same but for the other weights, other than bold, such as Light, Medium, Heavy, etc.

    cheers!
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,686
    Support for all font weights is available in the latest releases of TMP. That would be version 1.4.x for Unity 2018.3 or newer and 2.0.x for Unity 2019.x.

    upload_2019-6-23_9-9-27.png

    In these latest releases, you would create font assets using these correct font weight typeface and assign it to the appropriate font weight in the font asset inspector.
     
  3. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    209
    Hi Stephan, yes this is what I've been doing, what I'm asking is actually how to use them, I mean you know how you can use the "<b>" tags or the "B" button in the TMPUGUI object inspector to set all or a part of your text to bold weight, how can we do the same to set it to light, heavy, medium etc.

    is there such thing like a <medium-weight> tag or a button to change the weight? thanks for the help!
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,686
    There is indeed. The tag is <font=weight=xxx>. Here is another example

    "A<font-weight=500>B</font-weight>C"

    upload_2019-6-24_9-26-49.png

    upload_2019-6-24_9-28-12.png
     
  5. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    209
    oh amazing! that's exactly what I've been looking for! I also realized that the text object has a fontWeight property that I guess it can override the rich text tags and set the overall weight too.

    thanks again, I really love TMP and how you thought about every aspect, the UX is near perfection, is one of that assets so good that you wish Unity integrates it out of the box.. oh wait! they already did it!

    cheers.
     
  6. AM-Dev

    AM-Dev

    Joined:
    Aug 5, 2015
    Posts:
    31
    Hi there,
    I still don`t get how to use the font weights. I`ve got a .ttc font which in windows shows me that different font weights are available. So I could install them all, like: "Book", "Black", "Heavy", "Light", etc.

    How do I get these assigned to the font weights in the picture and how do I use them in a text field?
    Thanks

    Update:
    I read about ttc and how to get the ttf files for windows here: https://superuser.com/questions/114...-on-windows-error-ttc-does-not-appear-to-be-a
    And here`s more info about how to setup the font weights: https://forum.unity.com/threads/sep...weights-how-to-correctly-combine-them.840070/
    Implementing it now.
     
    Last edited: Mar 15, 2020
unityunity