Version 1.5.1, 2.1.1 & 3.0.1 - Now Available! for Testing!

Link to the previous sticky post with introduction video on Dynamic SDF.

The preview release (beta) of the TMP package version 1.5.0 for Unity 2018.4 and version 2.1.0 for Unity 2019.x are now available for testing via the Package Manager.

These are identical releases in terms of functionality but had to be separate releases due to changes in Unity such as dependency on the UI package in 2019.x, etc.

These two packages include updated TMP Essential Resources and TMP Examples & Extras. Updating these is optional.

There are two new major features in this release, Text Styles and Multi Atlas Texture support which I will cover below as well as several minor features and lots of fixes. See the ChangeLog for more details.

Text Styles
Text Styles allow the application of a style to a text object. This is very useful when a specific style applies to the whole object which previously required using the tag at the start and end of the body of the text which was not ideal in some cases and also error prone.

5018246--491333--upload_2019-9-30_18-12-50.png

The Text Style pull down shows the Text Styles available. Text Styles are defined Globally in the TMP Settings Default StyleSheet and can now also be Local by assigning a StyleSheet in the Extra Settings of the text object. If a style is defined in the local and global StyleSheets, the local style will override the global style.

It is possible to use a Text Style and styles in the body of the text. Nesting of styles has also been improved.

Multi Atlas Texture
The Multi Atlas Texture feature enables font assets to create new atlas textures as needed which is when it is no longer possible to add new glyphs to the main atlas. These additional atlas textures inherit the settings of the main atlas texture which are defined in the font asset Generation Settings. All atlas textures including the main atlas are contained in an array of Texture2D. The main is always index [0].

Changes to the font assets including the addition of new atlas texture are persistent in the editor but not persistent in builds. As such and for example, a dynamic font asset with multi atlas support enabled will be able to grow / add as many atlas textures as needed to handle the glyph coverage in a given play session but will always default back to its initial state for the next session.

5018246--491336--upload_2019-9-30_18-15-6.png

Since changes to font assets are persistent in the Editor, it is also possible to Reset font assets via the Context Menu option Reset. This will clear the Glyph, Character and Glyph Adjustment Tables. This will also clear all atlas textures.

Changing generation settings (in the Editor) like atlas texture size, will automatically regenerate and re-pack the existing glyphs and adjust the number of atlas textures as needed based on the new settings. This makes easy and convenient to later optimize your font asset and atlases in the event you discover the initial settings were incorrect.

This Multi Atlas Texture feature applies to all dynamic font assets whether they are assigned as primary or fallback somewhere.

As mentioned above, these atlas textures are contained in an array and in this first implementation will result in a draw call for each atlas texture. However, I am planning on updating the shaders to add support for texture arrays where on devices that support this feature (which is most fairly recent mobile devices), these will now only take a single draw call.

Multi Atlas Texture support is an important new feature that will require additional robust testing. No doubt we’ll uncover potential issues and / or API functionality that should be added to make the feature even more robust / flexible. I look forward to your feedback on this new feature and release of course.

Additional Important Changes
(1) In this release, I reworked the line breaking / word wrapping handling to address limitations related to glyph insertion when used in conjunction with Text Auto Size which required recursion. The catalyst for this was an issue with Soft Hyphenation used in combination with Text Auto Size.

As part of this refactor, I also improved the handling of Text Overflow modes like Truncate, Ellipsis, Linked and Page mode to also remove the use of recursion. This also improves the layout / performance when using these modes.

Although I have done a lot of testing related to these changes, no doubt we’ll run into some cases where we get incorrect layout results. Let me know if you notice any issues when using these modes or overall text layout.

(2) Additional tweaks were done to character, line, paragraph spacing which now represent 1/100 em. This affect tag using (em) and those values in the inspector. Simply put the (em) handling was incorrect in previous versions. Some of those changes were present in 1.4.1 so let me know if you run into any issues here.

(3) Alignment properties have now been split into horizontalAlignment and verticalAlignment. This will provide for independent control over these which was a requested feature when working with Prefabs as changes to alignment in the past would always dirty everything. This should be a workflow improvement. In theory (again) you should not notice any changes here. There was an issue with alignment in 1.4.1 which affected users with project initially created back in the Unity 5.4 ish time frame. These alignment issues should be handled automatically now.

(4) Added support for modern line breaking for Korean where spaces are used. This option is in the TMP Settings.

Again please review the ChangeLog as it contains lots of stuff including reference to some new smaller new features.

This release is missing some new features that I plan to add in the next preview release or so. These are in no particular order:


tag, Initial implementation of the TMP Resource Manager to make it easier to work with Asset Bundles and Addressables and any type of custom loading of resources. Support for manual definition of diacritical marks (Mark to Base and Mark to Mark). Improve handling of super large text objects where the geometry is larger than 65,535 vertices. This currently works but I uncovered some issues that I want to address. Adding iTextProcessor interface to improved pre-processing / shaping of the text. Additional line breaking / work separators discussed in forum posts. And more small type features that I have discussed on the forum that I would like to get in version 1.5.0 and 2.1.0.

Lastly, it took too long to get this release out so I want to work on reducing the interval between releases.

Feedback
If you run into any unforeseen issues or have questions about these releases, feel free to reply to this post.

How to Install
These latest preview release are available via the package manager only. To install these, open the Package Manager UI and select the appropriate package as shown below.

In Unity 2018.4

In Unity 2019.x

5 Likes

I never got it to work to have shadows for my fonts. The material is not created it seems but the Font Creator window doesn’t show an option here. I also don’t understand the different Render Modes. What is SDFAA_HINTED etc. Is there any documentation about this? Thanks!

I think I found the problem. My point size was at 500 - I set it down to 80 now and somehow it’s working now.

See the following [post]( https://discussions.unity.com/t/730726 page-4#post-4657286) about the different modes. SDFAA is the equivalent of Smooth whereas SDFAA Hinted computes the SDF using the Hinted version of the glyph.

I suspect your initial issue was due to the ratio of Sampling Point Size to Padding being too small. This ratio determines the effective range of the material properties. See FAQ Question 11. You normally want a ratio of about 10% so if the sampling point size was 500, you would have needed a padding value of 50 which is huge. Most fonts will render nicely at around 72 - 100 points and most Asian fonts due to how they are structured actually do pretty good at 36 to 48.

2 Likes

Thanks for your fast and detailed reply, Stephan!
After I wrote my initial question here - I found the video that explains all this. As you said, the Padding was my problem that effects didn’t work out well - together with a very high Sampling Point Size. So this has been solved! :slight_smile:

1 Like

@Stephan_B it seems the changelog is not already available on the package page :
https://docs.unity3d.com/Packages/com.unity.textmeshpro@1.5/changelog/CHANGELOG.html

Any ETA to have it available ? :slight_smile:

1 Like

Waiting on the documentation team.

The ChangeLog is contained in the package (assuming you have installed the latest release). I have also attached just the relevant changes for these releases.

5022509–492077–CHANGELOG.txt (8.59 KB)

2 Likes

Ok thanks for the changelog !
I see nothing mentioning some issue we reported concerning the Custom Validator is it inside ?

I added three different text objects in my scene and now I want to change the color of one text. However, now all text objects getting changed when I edit one of the text objects. I created the text objects by dublicating the first text object - could this cause this issue - I’m sure this is a feature to make it easier to change the settings on all the text in one scene - or am I doing something wrong here? Thanks for any hint!

Unfortunately that problem with input field text not getting masked by RectMask2D that was fixed in 1.3 is back again:
3449979--273288--tmp_masking.gif

Repro project is attached.

5023700–492221–TMPMaskingIssueRepro.zip (1.1 MB)

I’ll take a look this afternoon and provide feedback thereafter.

@Stephan_B there is some issue with the update in our project.

For example we have a CustomTextInputField without RectMask2D on the same game object than the TextViewport object reference in your TMP_InputField and this create an issue during the OnEnable method call.

Because you have this :

 m_TextViewportRectMask = m_TextViewport.GetComponent<RectMask2D>();
m_TextViewportRectMask.enabled = false;

and you must probably write this instead :

m_TextViewportRectMask = m_TextViewport.GetComponent<RectMask2D>();
if(m_TextViewportRectMask != null)
    m_TextViewportRectMask.enabled = false;

For the code above I think you just missed it because in the UpdateMask method just under those lines your first test is to check the m_TextViewportRectMask with != null

Another thing is now in our project we have some element that we call
Skinned TMPro UGUI which allow us to use a skin for our entire project. Before 1.5 every text in the InputField was visible with a blue color but now they aren’t display whereas the text is good. So I think they are white but I’m still investigate on this issue.

Edit 1 : on the second issue, this is only happening on 2 input fields in our project. Which is quite odd because they all use the same nested prefab. So still investigate… I will try first to reimport the project just in case.

Edit 2 : After the reimport nothing new.
BUT
I found where the issue was but I couldn’t explain it…
If we manually in the inspector enabled / disabled the rectmask2D, the text is displayed.
If you have some explanation on this feel free to share them :slight_smile:

Can you provide me with some simple test setup that mirrors what you have?

There are definite issues related to Clipping / Culling in the preview 1 which I have been looking into. I do have a current solution which I am further testing. I expect to release a new preview within the next few days.

This should resolve all issues related to Clipping and Culling including the null reference on RectMask2D.

Hello

I have 3 problems after using for a while(1.5.0 preview 1, Unity 2018.4.11f1):

  1. the ‘Sprite Importer’ can save ‘Sprite Asset’ and the spriteCharacterTable/spriteGlyphTable have content, but the ‘Glyph Rect’-Y and ‘Glyph Metrics’-BY is 0.
    I compare 1.3.0 version code, change (int)(atlasHeight-(importedSprites.frame.y+importedSprites.frame.h)) and spriteData.frame.h-(spriteData.frame.h*spriteData.pivot.y) (I get the AtlasHeight from TexturePacker JsonData(meta.size.h), or the m_SpriteAtlas.height), it can work now.
    2. in the created sprite asset content, ‘m_Version’, ‘hashCode’, ‘m_SpriteCharacterTable–m_Unicode’ are empty or 0, the values not save.
    3. ‘Text Mesh Pro dynamic font using system provided font’, can this feature be supported in 2018.4 in the future?
    Best Regards.

Can you provide me with the texture and TexturePackager .json file to look at?

Same as above.

This should work in 2018.4.7 or newer. This is a known issue on iOS which I need to address.

Thanks for reply!

1.2. The texture and json files is in Hook.zip

  1. I Select the ‘LiberationSans’ to Create TextMeshPro - Font Asset(the Atlas Population Mode is Dynamic, Atlas Render Mode is SDFAA), named ‘LiberationSansSDF’, then I add ‘a’(TMP Text) and ‘b’(Text) UI Component on Canvas,‘a’ use the LiberationSansSDF font asset, ‘b’ use LiberationSans font asset,input the same text content ‘abc中日韩’, ‘b’ can show all the character, but ‘a’ only show the ‘abc’ correctly. so can the ‘Dynamic Mode’ support use system provided font when source font file not contain some characters?(like some font fallback protection mechanism, the UGUI Text Component made)

Best Regards.

5080190–499808–Hook.zip (8.73 KB)

Thank you for providing the zip file. I’ll take a look at 1 & 2.

In terms of 3, TMP does not arbitrarily grab characters from system fonts. This is by design as fonts can vary greatly from one to the other in terms of visual design and metrics. I believe that developers and designers should select the appropriate fonts for the languages their project targets. This ensures, the selected font(s) support the needed characters and also work well from a design point of view.

TMP does allow you to create font assets at runtime from system fonts but you have to specify the source font file.

Just to provide more details on this… Let’s say your project uses Arial and you then type a Korean character. Given there are several fonts available on Windows that include Korean characters, does TMP pick the first font by alphabetical order? How do we know this font works well with Arial? Then what do we do on Android or iOS or PS4, Switch which all include different system fonts.

Like I said given fonts can vary greatly in terms of design, I think it is important for developer and designer to carefully select the fonts they want to use and not leave it to some semi random font selection.

Thanks for reply, I guess I understand what you mean. maybe I should create a dynamic font(like ‘Arial’ or ‘MS YaHei’) asset ‘a’, and then create a dynamic font for the system font('some one by Font.GetPathsToOSFonts()) as a’s fallback.

Is there any way to get the ‘Text Component’ fallback system font path? I want to mimic the behavior of the ‘Text Component’ as much as possible. (in fallback status, the specified character shape can be displayed will be ok in most cases, it better than display square. of course, there are also cases where the display style is different or displayed as a square, just like ‘Text Component’ do, so I mentioned above that the built-in default behavior will make the migration work(‘Text’->‘TMP Text’) easier)

Can I know when TMP support pure new input system?
Some scripts in TMP suchas TMP_InputField still use standard unity input system.

Thanks