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 - Advanced Text Rendering for Unity - Beta now available in Asset Store

Discussion in 'Works In Progress - Archive' started by Stephan-B, Feb 11, 2014.

Thread Status:
Not open for further replies.
  1. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Sorry, my bad, I didn't understood that the file was outside of my asset folder.
    Now it works properly. Thanks.

    I still have to resolve the printing of middle letters using I2 Localization plugin.
    I have now an atlas of 944 chars (ranges: 1536-1791, 64336-65023), but when I2 convert the text to be properly printed in Arabic, I get only few letters on the screen. Not red X as before, just few of them (starting and ending characters of the main unicode range).

    You can see in the pictures the difference:
    Screenshot 2015-05-04 10.28.32.jpg
    Screenshot 2015-05-04 10.34.20.jpg

    In what case TMPro will skip the letter instead of printing a red X?
     
  2. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I just resolved! :)

    The correct range is 1536-1791,65136-65279 for a total of 400 characters.
    It's was very hard to get it, there are so many different range for arabic language.

    Thank you for your support.
     
  3. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Glad you got it working :)

    There appears to be valid characters from 64336 - 65279. However, given I don't understand Arabic, I have no idea what the characters in the lower range are. Ie. 64336 - 65023. Often some of those characters are also mapped (duplicated) in the lower ranges like 1536-1919.
     
  4. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Just something new to look at

     
  5. Vorren

    Vorren

    Joined:
    Oct 24, 2014
    Posts:
    19
    Hey Stephan,
    I have a weird issue - in play mode everything looks fine, but when built ofr example for osx - text is displayed as black or grayish boxes. Any suggestions?
     
  6. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    What version of TextMesh Pro are you using?

    Are you using a Font Asset that you created or a Preset Material? Are these contained in a Resources folder? If these are not referenced in the scene, they won't be included in the build.

    Please take the time to register to the TextMesh Pro User Forum and make a post in the support section of the forum related to this. Be sure to include an image of the text object inspector so I can see the settings. Also include an image of the material inspector with the debug panel expanded.
     
  7. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Release Available
    Release 0.1.5 Beta 1.5 of TextMesh Pro for Unity 5.0 has just been released. It is available to all registered users of the product on the TextMesh Pro User Forum.

    New releases are always located in the "TMPro - Alpha & Beta Releases" section of the forum. Please note this section of the forum is only visible to members and registered users of the product.
     
  8. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    NEW - Strikethrough Rich Text Tag
    I just added a new Rich Text Tag for Strikethrough in TextMesh Pro. The format of this tag as well as some of the other tags available can be seen in the image below.



    Strikethrough will be available in the next release which should be in a few days.
     
  9. Igorexa

    Igorexa

    Joined:
    Sep 25, 2014
    Posts:
    23


    When i decrease font size(via tag <size>) , distantion between lines in not decreased. How i can change line distention?

    <Sub> tag is not help - it has another text size (0.5).
     
  10. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Which version of TextMesh Pro are you using?

    Here is an example where I am using the <size> tag. As you can see the line spacing is adjusted based on the height of each individual lines.

    TextMesh Pro - Line Spacing 0.1.5.JPG

    Here is the text that is used that I am using in this example.
    "<size=%155>E</size>xample of <size=%75><#ffff00>some lines</color> <sprite=218></size> of text for <size=%125><#00a0ff>testing</color> <sprite=230></size><size=%60><#00ff00> line spacing</color>."

    Even the sprites will affect line spacing.

    Can you copy / paste the text that you are using in the Text Input Box?
     
  11. Igorexa

    Igorexa

    Joined:
    Sep 25, 2014
    Posts:
    23
    I got an acceptable result of changing the value 'Ascending' and 'Descending'.

    Where i can read about this properties and how to change it correct?
     
  12. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The Ascender & Descender are defined in the font.ttf. They determine the highest and lowest point of the font.

    Although changing the Ascender and Descender might produce an acceptable result, the line spacing should adjust automatically when using the <size> tag. That is provided you are using one of the latest releases.

    There is also a new rich text tag <line-height=xx> which was added in one of the latest release which allows to override the line height as defined in the font.ttf based on the point size.

    I would suggest you upgrade to one of the latest releases of TextMesh Pro which are available to all registered users of the product on the TextMesh Pro User forum.
     
  13. Igorexa

    Igorexa

    Joined:
    Sep 25, 2014
    Posts:
    23
    Thank you, Stephan.

    One more question - for using <sprite> tag TextMeshPro object must be child of Canvas? I see sprite only when TextMeshPro child of Canvas object.
     
  14. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Correct. The <sprite> tag right now is only implemented with the Canvas system. My plan is to add support for the <sprite> tag as well as mixing different fonts and material in the same text object in the two TextMesh Pro components but I am waiting on a change from Unity.
     
  15. Igorexa

    Igorexa

    Joined:
    Sep 25, 2014
    Posts:
    23
    Please add it, very need.
     
  16. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Hi, I'm using linear color space and I have an issue with the Face Color value in Font Settings. I'm using the TMPPro/Distance Field shader with the base color value set to white.

    I'm on TextMesh Pro 0.1.44 and Unity 5.0.1f1 on Windows 8.1.

    When I use the Face Color to set text color, it looks like what's rendering has an unwanted gamma correction. I did the math and used values to compensate to get close to the colors I want, but I was wondering if there was a better way around the problem and especially if there are any plans to fix that.

    I had the same issue with NGUI, which was eventually fixed. So I don't have to do the color compensation thing with NGUI sprites any more. In some cases, I was using a custom shader to remove gamma corrections, which isn't exactly ideal.

    It's easily reproducable. Just set a project to linear color space, add a TextMeshPro GameObject, and put in a dark color like 255,71,1 for the Face Color.

    Here's an example of the colors I choose and what I'm actually getting in linear color space:
     
  17. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Unity handles the conversion with the CanvasRenderer so you get the correct results when using the TextMeshProUGUI Component. Let me investigate how best to handle this the TextMeshPro Component using the Mesh Renderer.

    P.S. Any reason you have not updated to the latest release of TextMesh Pro since you are using Unity 5.0?
     
  18. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    * NEW * Text Auto Sizing - Width Adjustment
    Added this new text auto sizing feature where the width of the characters will be reduced up to a certain % threshold before the point size of the text is reduced.

    The following video shows this new feature in action.


    This should be handy when the text almost fits the Text Container / RectTransform and instead of reducing the point size which is obvious from a visual standpoint, subtle adjustment of character width isn't as obvious. I think for numerical sequences that will be nice.
     
    mcmorry likes this.
  19. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I haven't been paying much attention to this thread, so I thought 0.1.44 was the latest (it's the latest on the asset store anyway). I can grab 0.1.5 from your forum if you're recommending it. In general, I wait for more official versions of stuff rather than dealing with early betas, but I don't have a problem if you think it's pretty stable.

    I'm still on NGUI at the moment. If you're saying the uGUI-specific TMP component works better in general, that might be good enough, since I've been considering switching to uGUI.

    On a side note, my next question was going to be about auto-sizing text and I saw your very next post on the exact thing I was looking for, hehe. That sounds like it'll be quite handy.
     
  20. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The version on the Asset Store is actually pretty old. Over the past fast months, the New UI, Unity 4.6 and Unity 5.0 have been in a pretty significant state of flux. Given how closely tied to the New UI TextMesh Pro is, it became much more efficient and quicker to get new releases in the hands of my users via the User Forum as opposed to going through the Asset Store review process.

    In terms of stability, given the amount of issues reported on the latest releases has been very minimal, the latest releases should be pretty stable. More so that the Asset Store release in my opinion now.

    Since a lot of features have been added requiring changes to things like handling of vertex colors and text alignment, please pay close attention to the upgrade notes.

    In terms of switching over to the New UI from NGUI, there are performance issues still affecting the New UI so be sure to read up on some of that. This isn't related to TextMesh Pro since it works with both.
     
  21. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    @Stephan B Thanks for the info! I registered on the forum, so I'll check out the latest.

    I did do some reading on performance issues with the new UI versus NGUI, and I get the impression that most of the concerns are on mobile. My project is PC/console oriented, so I'm assuming that's not going to be a big roadblock.
     
  22. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Already approved :)
     
  23. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
  24. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Using the TextMeshPro.textInfo class and Unity's Event System to interact with characters in a text object.

     
    zyzyx likes this.
  25. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Update #2 on character & word tracking in TextMesh Pro.



    This functionality will be accessed by using new functions which are explained in the video.
     
  26. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Rich Text Tag
    Since it was pretty quick to do, I added a new Rich Text Tag tonight which is the <nobr> </nobr> tag which prevent line breaking between the tags.

     
  27. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    More Rich Text Tags Added
    Added two new additional Rich Text Tags which are <width=xx.x> and <margin-left=xx.x> to help provided additional control over text layout / formatting.

     
  28. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Offset Rich Text Tag
    The Offset tag is used to offset lines or paragraphs of text. This tag replaces the previous <indent> tag which is now instead indents the first line of paragraphs which is consistent with the html implementation of the text-indent tag.

    I refined the implementation of the <offset> tag to allow offset values to be specified in pixels, font units or as a percentage of the text container's width.

     
  29. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Coming Soon! Link Rich Text Tag
    Been working on adding support for links in TextMesh Pro. The format of the tag is <link="name">Insert Text Here</link>
    Information about the links contained in a text object will be available in the TextMeshPro.textInfo.linkInfo[] array. The linkInfo includes the index of the first and last character contained in the link as well as character count. It also contains a hashcode of the "name" to allow tracking the links.

    I also added a new utility function to allow tracking and interaction with links at run-time.



    Here is a video going over this new feature.
     
  30. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Rich Text Tag <style="name"> </style="name"> </style>
    Working on adding a new Rich Text Tag <style="name"> </style="name"> or </style> where you will be able to define what these tags do. Think of these <style="name"> tags as Macros where they contains several other tags. Here is an example:



    As you can see the <style=link> is actually made up of "<link="ID_01"><u><i><#40a0ff>" as well as "</link></u></i></color>". Besides making it easy to define different styles, it also keep the Text Input Box much cleaners.



    This is the first implementation. The green rectangles around the link shows the hit box of the link itself.
     
  31. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @Stephan B
    Hi, I'm trying to generate a diffuse field alpha map using a source texture, instead of a font. I want to do this for cutout shaders and improve the edges when are near the camera. I already coded some script, but I thought that maybe I could call some internal api that you already have for the generation of the fonts.
    In case is possible could you give me some hints? Ideally I'd like to use as input a Texture2D and receive back the new Texture2D.
    Thank you
     
  32. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Are you using an SDF Font Asset? Why not simply use softness? The edge of the text should be clean at all distances. If they are not then you need to post on the TMP User Forum so I can take a look at what is going on.
     
  33. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is a preview of the new TMP StyleSheet Editor which will work in conjunction with the new <style="name"> Rich Text Tag. This will allow users to create (macros) of tags keeping the Text Input Box in the inspector much cleaners.



    Here is an example of the Text Input Box without using this new Style tag and using the Style tag.

     
  34. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I want to use the distance field technique on other type of textures, for example leaves, logos, etc. (for text TMPro does already more than I need :) )
    So I have the hi res alpha (4k x 4k) for my texture and I want to generate a low res (1k x 1k) distance field texture.
    This will be used in a cutout shader.
    So my question was if I can use some functions of your dll to generate the distance field texture using another source texture.
     
  35. JustinIsTheBest

    JustinIsTheBest

    Joined:
    May 29, 2015
    Posts:
    7
    @Stephan B

    Hey Stephan,
    I am using the shader TMPro/Mobile/DistanceField (Surface)" provided with TextMeshPro to make the stylized text effect shown in the left image below.
    The text renders correctly as intended in older iOS devices (iPhone 5, 4, ... iPad, and iPad mini, etc), but it seems the alpha transparency and/or glow is not supported on iPhone 6 and iPhone 6+ devices as shown as the right image below. What can I do to fix this?

    Screen Shot 2015-05-29 at 3.21.59 PM.png Screen Shot 2015-05-29 at 3.19.55 PM.png

    Here is the inspector...

    Screen Shot 2015-05-29 at 3.41.04 PM.png Screen Shot 2015-05-29 at 3.41.34 PM.png

    Thank you,
    Justin
     
  36. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Let me investigate this but most likely this is something we will need Unity to fix. This could be OpenGL related or Metal since Metal doesn't work on older iOS devices as far as I know.

    Please take the time to file a bug report with Unity as well as providing me with the case number.

    P.S. I'll let you know what I find as soon as I am able to verify this.

    P.S.S. Are you having scene lights affect the text object? Just curious why you are using the Surface shader.
     
    Last edited: May 30, 2015
  37. JustinIsTheBest

    JustinIsTheBest

    Joined:
    May 29, 2015
    Posts:
    7
    Im using surface shader because the other non surface mobile shaders do not have a texture field and glows, and I did not want to modify your shader code. The light source is only used to light it up because its not self lit. I do have other text meshes using shader "TMPro/Mobile/DistanceField" and they render correctly on iPhone6 and 6+.

    Im using Text Mesh Pro 0.1.44, and Unity 4.6.4p2

    PS We're not using Metal, but OpenGL ES.
     
    Last edited: May 30, 2015
  38. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    All TextMesh Pro shaders work on mobile. Mobile just implies lighter weight vs the non mobile version. The mobile SDF shader offers the best performance with limited features. The SDF shader is next and depending on what features are enabled still offers great performance. The surface mobile is next followed by full surface SDF.

    So in your case, I would use the SDF instead of mobile SDF.

    In terms of version, I would upgrade to the latest release of TextMesh Pro from the user forum for unity 4.6. It includes a lot of new features and support for the new ui.
     
  39. JustinIsTheBest

    JustinIsTheBest

    Joined:
    May 29, 2015
    Posts:
    7
    I'll try changing the shader to SDF and see if that works. If not, then I'll update and try again. Ill report what I find starting Monday. Enjoy the weekend!
     
  40. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    I'm testing my current project with 5.1.0f2 and TextMeshPro cannot compile due to the following error:

    Type `UnityEditor.UndoPropertyModification' does not contain a definition for `propertyModification' and no extension method `propertyModification' of type `UnityEditor.UndoPropertyModification' could be found (are you missing a using directive or an assembly reference?)

    Any idea of a workaround? Thanks
     
  41. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Unity made some unannounced changes to their Undo API which is why you are getting this error. However, I believe this should be addressed in Release 0.1.5 Beta 1.5 of TextMesh Pro which is available on the user forum.
     
  42. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Updated the AssetStore which was created in Unity using TextMesh Pro.

     
  43. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Thanks @Stephan B - TextMeshPro beta 1.5 is working OK with 5.1.0f2. Cheers
     
  44. JustinIsTheBest

    JustinIsTheBest

    Joined:
    May 29, 2015
    Posts:
    7
    :D Good news! Shader "TMPro/DistanceField", non mobile and non surface renders correctly on all devices including iPhone6 and 6+; however, the scrolling of "_TexFace" no longer works. How should I achieve UVScrolling with the Distance Field shader? Im using the ScrollUV script found on unitywiki pasted below (_MainTex changed to _TexFace in the Inspector).

    Code (csharp):
    1.  
    2. publicclassScrollUV : MonoBehaviour {
    3.  
    4. publicintmaterialIndex = 0;
    5. publicstringshaderProperty = "_MainTex";
    6. publicVector2uvAnimationRate = newVector2(1.0f, 1.0f);
    7.  
    8. privateVector2uvOffset = Vector2.zero;
    9.  
    10. voidLateUpdate()
    11.  {
    12. uvOffset += (uvAnimationRate * Time.deltaTime);
    13. if (renderer.enabled) {
    14. renderer.sharedMaterials[materialIndex].SetTextureOffset(shaderProperty, uvOffset);
    15.  }
    16.  }
    17. }
    18.  
    19.  
     
  45. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    What are you trying to scroll? The face texture?
     
  46. JustinIsTheBest

    JustinIsTheBest

    Joined:
    May 29, 2015
    Posts:
    7
    Sorry for the typo above in my previous post. It is suppose to be _FaceTex.
    Screen Shot 2015-06-01 at 12.54.01 PM.png
    I'm trying to Scroll the UV's on the "_FaceTex" property of the shader as shown below gif image. Directly changing the UV offsets of FaceTex does not seem to work for the Distance Field shader, but it does work for the mobile surface shader.
    5GIFF.gif
     
  47. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    If you take a look at the latest releases of TextMesh Pro, the shaders already support UV Animation for the Face and Outline texture.

    upload_2015-6-1_13-22-13.png

    If you need to continue using the previous version of TextMesh Pro, you can take a look at these revised shaders and make the modifications on your end.
     
  48. JustinIsTheBest

    JustinIsTheBest

    Joined:
    May 29, 2015
    Posts:
    7

    Thank you so much! @Stephan B I updated to latest, and everything works great!
     
  49. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Cool :)
     
  50. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Stephan B ,

    Just purchased and waiting for registration to go through so I can move to the Unity 5.x beta. How on Earth did I miss this Asset before. Looks amazing..!
     
Thread Status:
Not open for further replies.