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