Search Unity

TextMeshPro: problem with Content Size Fitter and bold-tag

Discussion in 'UGUI & TextMesh Pro' started by ratking, May 18, 2020.

  1. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    Hallo,

    I have a dynamic dialog box in the game, with a text (TMProUGUI) and a button. I change the height of the box depending on the TMProUGUI's height. As I want a maximum height I put the TMProUGUI in a Scroll View, and to change the scroll view's content's height I use a Vertical Layout Group and a Content Size Fitter. (It doesn't work without a Vertical Layout Group.)

    This leads to the specific problem that text with bold tags add a new line at the end:




    There is no problem if there is no bold tagged text. (I checked with various combinations.)



    Is there a workaround for this? By the way, the font is ZillaSlab-Regular (ZillaSlab-Bold for the bold text).

    Thanks,
    ratking
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Bold adds extra spacing which is defined in the Font Asset under Bold spacing. See if reducing that value down to 0 (default is 7) makes the problem go away?

    I'll take a look at this on my end in terms of making sure bold if factored into the preferred values being reported.
     
    mischinab likes this.
  3. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    Thanks, setting the Bold spacing to 0 indeed solved the problem.
     
    mischinab likes this.