Search Unity

Rich Text Format TextMeshPro set Underline thickness

Discussion in 'UGUI & TextMesh Pro' started by millefoliumink, Mar 13, 2019.

  1. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Hello!

    I'm looking for a way to set the pixel thickness of RTF underlines.

    Could anyone point me in the right direction please?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What is the use case for controlling underline thickness via a tag?
     
  3. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Thanks for responding!

    I thought it was the only way to do it with TextMeshPro... The text is dynamic and the underline also changes color depending on content which varies in length and number of lines.

    At the moment I'm loading the new content to string and using String.Concat() to change the underline color through RTF then assigning it to .text

    I'd like to specify the underline thickness if possible, at the moment it looks too thin and isn't very visible.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Underline thickness is defined by the font file. Underline thickness can be modified per font assets in the font asset editor.

    upload_2019-3-13_13-35-47.png
     
    millefoliumink likes this.
  5. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    Thank you!
     
  6. alakoring

    alakoring

    Joined:
    Mar 11, 2018
    Posts:
    27
    I’m guessing there is no way to do this with Unity 2018.3 (which I am stuck with on my current game).
     
  7. mikkel_levelupgarage

    mikkel_levelupgarage

    Joined:
    Apr 26, 2022
    Posts:
    3
    I am looking for a way to do this as well, since fallback fonts dont use their own underline thickness or underline offset, meaning if your fallback font has a different point size than the primary, underlines will break completely.
    Check this article for examples of how it breaks: https://forum.unity.com/threads/tmp-fallback-font-underline-bug.632371/

    For me ideally the bug should just be fixed, but changing the thickness and offset through rich text might be a work around, until the devs get themselves together.