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

TextMesh Pro Separate font files for weights, how to correctly combine them?

Discussion in 'UGUI & TextMesh Pro' started by Flavelius, Mar 4, 2020.

  1. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    943
    Hi,
    I'm a little confused: i have the typical separate files for a font (regular, bold, italic).
    I generated the sdf assets for each of them. Now i can try to assign each weight to the 'Font Weights' fields in each other, but that doesn't seem correct.
    Because i end up with 3 fonts, regular, bold, italic that each just has the others assigned to them again.
    Plus more strangely the "Regular" weight field is greyed out for every asset as i guess it assumes the font is the regular variant which is true for only one of them though, and i can't find a way to mark a font asset as a certain weight otherwise.
    How do i do handle this correctly?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Let's take the font "FiraSans" for example which is available on Google fonts.

    As you can see in the image below, this font includes 18 styles / distinct font files which include the Regular and Italic styles for each of the 9 font weights.

    upload_2020-3-6_0-44-43.png
    Assuming you wanted to support all 9 font weights and styles, you would created 18 font assets (dynamic or static) and then assign to the FiraSans-Regular SDF font asset all the other font assets corresponding to each font weight and styles as seen below.

    upload_2020-3-6_0-51-49.png

    The 400 - Regular is greyed out because this is the main font asset which in this example would be the FiraSans-Regular SDF.

    In the image above, you can see that I have assigned the appropriate font asset for each of the corresponding font weights. This is the only Font Weight table that needs to be populated for this FiraSans font. The font weight table of all the other font assets in this list remain empty since this FiraSans-Regular SDF is the main font asset.
     
    _TheFuture_, Mochnant and Noblauch like this.
  3. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    943
    Ok, having 17 extra font assets seems the way to go then. Thanks
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just keep in mind that it is extremely rare for a project to use all 9 font weights. As such, you can always only populate and create the font assets for the font weights you will actually be using.
     
  5. Mochnant

    Mochnant

    Joined:
    Apr 23, 2015
    Posts:
    7
    Sorry if this isn't the right place (or is too necro), but this seems like the right thread for future searchers.

    My question, is there an override for Small Case for those fonts that provide a custom version of this?