Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug TextMesh Pro soft hyphens not working as expected

Discussion in 'UGUI & TextMesh Pro' started by Android272, Mar 17, 2024.

  1. Android272

    Android272

    Joined:
    Oct 14, 2016
    Posts:
    25
    I am having an issue with my text mesh pro objects and getting soft hyphens to work properly. I read that TMP uses \u00AD for soft hyphens but it is not working as expected. One of three things happen that are unexpected.

    1. If I add \u00AD to my text it always inserts a space character even when it does not need to wrap. Depending on the font this space is a little square (result 2 from screenshot)
    2. the word breaks where I place the \u00AD but does not show a "-" hyphen.
    3. depending on the font it never breaks.
    bitmap.png

    In the screenshot I added \u00AD to the "word" pellentesque. You can see that on one font that "pell" remains on one line while "entesque" breaks to the second. But there is not hyphen after "pell". With the other font there is a square that appears between "pell" & "entesque" when there should not be a hyphen.

    I thought the point of the soft hyphen was that a hyphen would be placed if and when the word needs to break, but if it does not need to break nothing would be placed there at all.

    I modified my source fonts with FontForge to make sure that the hyphen gliph is set up to be used as the soft hyphen as well for both of these fonts but it is not being used properly. Should I be using something other than \u00AD to insert the soft hyphen?

    Here is the Lorem ipsum from the screenshot.
    Code (Source):
    1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In imperdiet gravida libero eu pretium. Aliquam turpis lacus, posuere ac efficitur quis, sollicitudin vel mauris. Nulla accumsan purus at libero sollicitudin finibus. Curabitur id sapien est. Vivamus nec nulla fringilla, sodales sem a, egestas urna. Donec pell\u00ADentesque est dui, vel fringilla justo elementum non. Sed massa orci, dictum eget erat vitae, gravida pellentesque sem. Pellentesque finibus porttitor iaculis.
    I added the \u00AD to a word that from the section that is highlighted in the screenshot. I could have added more but its random greek you would have no idea what is supposed to break or not.
    Code (With Soft Hyphen):
    1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In imperdiet gravida libero eu pretium. Aliquam turpis lacus, posuere ac efficitur quis, sollicitudin vel mauris. Nulla accumsan purus at libero sollicitudin finibus. Curabitur id sapien est. Vivamus nec nulla fringilla, sodales sem a, egestas urna. Donec pell\u00ADentesque est dui, vel fringilla justo elementum non. Sed massa orci, dictum eget erat vitae, gravida pellentesque sem. Pellentesque finibus porttitor iaculis.
     

    Attached Files: