Search Unity

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. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @Stephan B I just got your plugin, and I was going to write an Editor script to replace all Unity Text with your TextMeshPro Text, but was wondering before I go about doing that, does the plugin come with some kind of auto-updater like that? That would be a great feature.
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,793
    (maybe there is a better solution, but you could for sure render to texture and use that texture as a mask)
     
  3. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    There are two user created scripts on the TMP use forum to handle replacing UI.Text. I haven't tested them myself but I presume they work.

    In terms of auto-updater, do you mean a patch system? If so I don't have an auto patch system.
     
  4. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @Stephan B In their scripts they have a reference to TextMeshProFont. Do you know what the latest version of TextMeshPro's equivalent is?

    For auto-update, I meant a tool that automatically converts Unity Text to TextMeshPro, which you answered for me.
     
  5. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The TextMeshProFont class was renamed to TMP_FontAsset a few releases ago.
     
  6. Kea

    Kea

    Joined:
    Nov 12, 2012
    Posts:
    23
    I have a problem - text don't shown on A8 gold Blackview. What could be wrong?
     
  7. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Device specific issues are almost always related to Unity and their Android support.

    To try to isolate what it might be related to, I would suggest trying different OpenGL setting in the Graphic API like OpenGL 2.0 & 3.0. I would also suggest testing with the Example Scene 01 - and making sure the text is using the Mobile Distance Field shader to see if the text shows up.

    Let me know what results you get from that.
     
  8. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Still not forgotten?
     
  9. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I have not.

    Handling the RTL text is not an issue but mixing the English characters in it might present a challenge unless that Arabic plugin returns a string with those formatted correctly.

    I'll try to get to this tomorrow and I apologize for the delay in getting to this.
     
  10. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    Is there documentation on in-line sprites? The video on the website is out of date, and in general simple text documentation is much more helpful than videos.

    Also, I tried to register for the official forums on your website but the registration process keeps failing. I've tried Chrome and Safari, and in both the verification captcha keeps failing no matter how many times I try.

    Very frustrating so far.
     
  11. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is a link to the online docs available on the user forum http://digitalnativestudios.com/textmeshpro/docs/rich-text/#sprite

    The <sprite> tag format and information is also available in the release notes as well.

    The following video from my YouTube Channel also contains updated information.

    In terms of registration, I am not certain why you are having issues. There are currently over 1750 users registered on the forum and no reports thus far of registration issues.

    If you still can't register, simply PM me with a user name, email and your invoice number for the purchase of TextMesh Pro and I'll create a registration for you.
     
  12. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is the updated video about the <sprite> tag in TextMesh Pro which covers the recent improvements and the Sprite Asset creation process along with explanation of the Sprite Asset Editor features and functionality.

     
  13. blamejane

    blamejane

    Joined:
    Jul 8, 2013
    Posts:
    233
    I had to install the latest Unity 5.3.5 and upgraded to the latest TextMesh Pro and now I'm getting errors.

    Like:
    Assets/TextMesh Pro/Scripts/TextMeshProUGUI.cs(835,18): error CS0619: `UnityEngine.UI.Graphic.OnFillVBO(System.Collections.Generic.List<UnityEngine.UIVertex>)' is obsolete: `Use OnPopulateMesh instead.'

    Assets/TextMesh Pro/Scripts/TMPro_UGUI_Private.cs(17,26): error CS0535: `TMPro.TextMeshProUGUI' does not implement interface member `UnityEngine.UI.IMaskable.RecalculateMasking()'
     
  14. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    In Unity 5.2. Unity made significant API changes including renaming and making obsolete several functions related to the Canvas system and how geometry is handled. So you will need to update to the latest release of TextMesh Pro (0.1.54 Beta 3b) for Unity 5.2 / 5.3 / 5.4 which is available on the Asset Store as well as on the TMP User Forum.

    Please be sure to read the release notes and upgrades notes and to backup your project first.

    There is a bug with the Asset Store where it may not provide the correct release of a product based on the version of Unity you are using. If that is the case which you can verify by checking the version number of TextMesh Pro which is located in the header of the TextMeshPro.cs file. If that is the case, you should get the release from the TMP user forum.
     
  15. pep_dj

    pep_dj

    Joined:
    Nov 7, 2014
    Posts:
    179
    Is TextMesh Pro compatible with Rect Mask 2D component?
     
  16. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Yes. Furthermore, in the next release or so, you will also have the ability to use Soft Masking with the 2D RectMask as well as using a Masking Texture as seen in the following post. As well as eventually animated this as seen in this other post.
     
    pep_dj likes this.
  17. BillyMFT

    BillyMFT

    Joined:
    Mar 14, 2013
    Posts:
    178
  18. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    First, make sure you update to the latest release of TextMesh Pro which is Release 0.1.54 Beta 4 which is currently only available on the TMP user forum. This new version does include a few fixes related to the text input field.

    Second, make sure the height of the input field is large enough for the font that you are using. If the height is too small, it can produce some of the behaviors you describe.

    If after updating to the new release and making changes to the height of the input field fail to resolve those issues, it would be best if you could provide me with a Repro project (privately) so that I can easily reproduce the behavior and make the necessary changes to address this.
     
  19. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Still?
     
  20. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is the sample based on the text you provide.

    upload_2016-6-25_1-41-16.png

    Since I am not fluent in Arabic either, it is hard for me to know if the text is correct as I copy / pasted it from the text your provided.

    Note that I used the Arabic plugin to feed the string to TextMesh Pro. See the following thread on the TMP user forum which covers RTL support and includes information related to all of this.

    P.S. Sorry that it took me that long to produce the sample.
     
  21. domdev

    domdev

    Joined:
    Feb 2, 2015
    Posts:
    375
    Hi I'm having some issue now in using customs fonts it was working in some device but not all device what could be the possible reason to it? pls help version Beta 0.1.46 & 0.1.5 the font was TheHammerSlabserif
     
  22. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Can you provide some details on what those issues are?
     
  23. domdev

    domdev

    Joined:
    Feb 2, 2015
    Posts:
    375
    its okay now :D it turns out we use old version sorry about that
     
  24. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    That's pretty much what I have without TMP. The point was to have it justified.
     
  25. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I didn't see you wanted it justified. I thought you wanted right aligned.

    I'll get you a sample that is justified.

    Here is the same text justified.
    upload_2016-6-27_2-25-54.png

    P.S. While creating this last sample, I uncovered an issue with RTL and Justified text which I have now fixed.
     
    Last edited: Jun 27, 2016
  26. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    I've not delved into probably some of the more advanced features of this, but I'm certainly liking the default bevel, outline, etc. options :)

    ClzOcLVWAAQkk1F.jpg
     
    Stephan-B likes this.
  27. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Added some utility functions to control the sorting and rendering order of individual characters and underlying geometry.

    In this example, the characters are scaled randomly. The geometry is sorted to ensure the larger characters are rendered in front of the smaller ones.



    The script used here is a modified version of the VertexJitter.cs included with the latest release of TMP.
     
  28. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
    I've several ttf fonts and using Unity UI text happilly supporting English, German, French and CJK. One only of them supports CJK which becomes the default font for CJK.

    I am converting each ttf fonts to TMPro. For non-CJK font, I can convert to Extended ASCII and that is probably working fine.
    But how do I convert my TTF (Arial/Tahoma) for CJK. I tried giving huge Unicode Hex Range(0000-FFFF), it crashes the Unity. Tried copying text in file and using file as text asset. It still doesn't do anything.

    I could not find a way to generate TMPro from Arial/Tahoma for Chinese,Japanese and Korean languages. What is the recommended way to support these language?

    PS: Localized text in hardcoded in C# files autogenerated from CSV.
     
  29. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The easiest way is to generate a simple text file (Unicode format) which contains all the unique characters used for any given language or set of languages (as many can be combined). Then using this file, use the "Characters from File" option in the Font Asset Creator to generate an SDF Font Asset which includes all those characters.

    This method is what most major studios use with TextMesh Pro. If you use a tool like I2 Localization, it can even generate this text file which contains all the unique characters of a given language or sets of languages.

    See the following video which covers these options and aspects of the localization process (which I sort of explained here).

    With regards to CJK, although these languages contain lots of characters, even text heavy projects rarely use more than 1000 characters for any of those languages so you should be fine with one SDF Font Asset for Chinese which contains both Simplified and Traditional, (1) for Japanese and (1) for Korean.

    Should you end up with too many characters to fit into a single SDF Font Asset for those languages or want to keep the Font Atlas resolution a size of less than 2048 X 2048 or even 1024 X 1024, you could always split those up into additional SDF Font Assets and use the Fallback system which is explained in this video and this other video.
     
  30. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
  31. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    As per my post above, you have to make sure this text file is saved as Unicode. By default a lot of text editors save Text files as ANSI or ASCII which means characters above Unicode range of 255 are stripped out.

    * EDIT *
    You can trust the missing glyph report. In this case, those glyphs are actually missing from Tahoma. Whatever font viewer you are using it is using character substitution so those glyph are coming from another font file.

    Here is a screenshot of the Unicode Range for the Tahoma font. As you can see it is missing those ranges / characters.

    upload_2016-6-30_3-0-55.png
     
    Last edited: Jun 30, 2016
    mog-mog-mog likes this.
  32. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
    How can I support Text Groups here?
    I've multiple Text elements with "Auto Fit" enabled in my scene. I would like all to have same font size = Minimum of all Text elements. I want them to take the Best Fit Font size of longest length item. What are my options here?



    Similar to what I am doing with Unity UI-
    http://forum.unity3d.com/threads/text-group.272462/
     
  33. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    See the following reply to your question in the other thread.
     
  34. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is another example of changing vertex attributes via script to create some type of Text Highlighting FX. In this example, the scale and vertex color of individual characters is changed as the cursor interests them. The geometry of the character is also moved around in the vertex attribute arrays to make sure it is rendered last and over the other characters.



    This example script will be included in the next release of TextMesh Pro.
     
  35. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    I have some other suggestion. I was trying to make an unsorted list, which has items that run over multiple lines. If the item continues on the next line, the left side of the text should be aligned with the text of the line above it:

    • This is an unsorted list that has a fairly long descriptive text. When the text continues on the next line, it doesn't start completely at the left, but instead at the same position as the text at the first line.

    For what I could see, there is no list item tag. I then tried tabs, but that gave too much of an inset and I didn't find any way to adjust the tab stops. Then I looked at the pos tag, but that only works for the first line. I'd say the best solution is to add a closing tag to the pos tag and align everything contained in it at the given position. So you'd get:

    -<pos=10>This is an unsorted list that has a fairly long descriptive text. When the text continues on the next line, it doesn't start completely at the left, but instead at the same position as the text at the first line.</pos>
     
  36. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Take a look at the <indent> tag.

    Here is an example of it in action using the <sprite> for the bullets.



    Note that most tags can be defined in pixel units (px), font units (em) or percentage (%).
     
  37. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Ah, great, thanks.
     
  38. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Doing some testing of the TMP text input field with Rich Text support. I still have to work out some issues but it is taking shape.



    Support for rich text makes it possible to use the Multi Font & Sprites :)
     
  39. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is an example showing how this new Capline Vertical Alignment option in TextMesh Pro compares with the Center Vertical and Geometry base vertical alignment options.



    This option is useful when trying to center text vertically inside a button or shape.

    As you can see above, the normal Vertical Alignment uses the Ascender & Descender of the font which keeps the baseline consistent between object but gives the appeance of the text not being vertically centered since the text might not contain descenders.

    The middle (geometry base) option centers the text vertically based on the text geometry. This results in perfect vertical alignment but can result in inconsitent baseline between objects as seen above.

    The bottom and new option is the Capline option which has the benefit of keeping the baseline consistent and eventhough it ignores descenders it still results in the text appearing nicely aligned vertically.
     
  40. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    TextMesh Pro Beta Ending Soon!
    On August 1st or thereabouts, I am planning on finally releasing version 1.0 of TextMesh Pro. As such the 30% pre-release beta discount will be ending on August 1st and the new price will be $95 USD. If you were planning on picking up TextMesh Pro, it might be a good time to do so before the pre-release discount ends.

    It has now been over 18 months since the first release of TextMesh Pro which now includes thousands of users including small indie developers like myself to some of the largest studios in the industry. I am immensely grateful for all of my users and want to thank all of you for the amazing support and feedback you have given me.

    Many of the features included in TextMesh Pro were the direct results of your suggestions and input. As I have discovered since starting to work on TextMesh Pro, Text is a lot more sophisticated then I could have ever imagined. Please keep providing feedback as the release of version 1.0 only marks the beginning of our journey as there are still lots of new features and improvements that I want to make over the coming weeks, months and hopefully years.

    Once again, thank you so much for your support :)

    P.S. It feels pretty strange think this next release will be version 1.0 after given I have released over 30 different versions since the first beta became available. I can see people asking "Hey is Version 1.0 the first release of TextMesh Pro?"
     
  41. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Color Gradient Presets
    I just added the ability to create a new type of asset in TextMesh Pro which are Color Gradient Presets. In addition to having the ability to define and use Color Gradients on text objects, you will now be able to assign a Color Gradient Preset which can be assigned and shared by multiple text objects thus making is much easier to manage these on all those text objects.

    For example, if you currently had a project with 50 text objects using a few variations of color gradients, you would have to manually edit these gradients on all 50 text objects in order to tweak those. Once this new feature is released, you will be able to assign presets to these objects which will then make it easy to tweak these by editing the preset it self instead of having to find and mess with all the text objects individually.

    Here is an image of the simple Color Gradient Preset Editor Panel



    Here is an image showing the updated Inspector panel of the text object with new material preset property.

     
    GibTreaty likes this.
  42. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is a video explaining how the new Color Gradient Presets will work and improve workflow when using color gradients in TextMesh Pro.

     
    GibTreaty likes this.
  43. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Made a small improvement to make sure Material Preset property changes also get applied automatically for Fallback Fonts and Alternative Typefaces.



    In the example above, the word "simple", "line" and "text" are using alternative typeface for true bold and italics.
     
  44. seraphki

    seraphki

    Joined:
    Jul 20, 2016
    Posts:
    26
    Hey!
    I'm so sorry if this has already been asked and answered, but there's a lot of info here and I'm having a little trouble finding it =)

    I'm using your pagination tool, and I want to embed some sort of trigger into the text (I'm currently planning on just using a line of alpha'd text with something like <trigger=0>) so that when I move to the next page, I can check the page's contents and if it has a trigger, I can kick off an event. I wanted to do this just by getting the current page text and doing a .contains(), but it looks like the .firstCharacterIndex and .lastCharacterIndex that I was using to pull a substring are post tag-strip, so they don't match up with the raw text data. Is there a way to get the text that those indexes are from? Or just to get the page text in general?

    Or is there an awesome event system that I might have missed altogether?

    PS Thanks for this tool, you saved me a lot of headache trying to figure out unity pagination~
     
  45. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The .index in characterInfo[] is the index of the given character in the raw text string.

    So the index of the last character of the page in the raw text string would be:
    int rawStringIndex = m_TextComponent.textInfo.characterInfo[lastCharacterIndex].index;
     
  46. seraphki

    seraphki

    Joined:
    Jul 20, 2016
    Posts:
    26
    Awesome! Thank you so much =D
     
  47. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You are most welcome.

    Be sure to register to the TextMesh Pro user forum and to use that for support as given each post is a separate thread there, it helps keep things better organized and easier for other users to read and potentially find answers to similar questions.
     
  48. Shadeless

    Shadeless

    Joined:
    Jul 22, 2013
    Posts:
    136
    @Stephan-B

    Hey so I was wondering if a simple feature could be added related to the Wrapping & Overflow.

    So can another overflow mode be made that the last word that exceeds the Text Containers width stays on the same line and then the next one goes on the new line. Here's an example of what I mean.
    http://prntscr.com/bwgo6n

    Cheers!
     
  49. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    What is the use case for this overflow mode?
     
  50. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,793
    Yeah it sounds unreliable to me. It's like "minimum width" wrapping, but I can't think of one proper use for it.
     
Thread Status:
Not open for further replies.