*** Preview 3 Release of Version 2.2.0 and 3.2.0 Now Available! ***

I can certainly improve the faking of the italic style where depending on the slanting angle / shear I should be adjusting the advance value which is what is kind of leading to this tightening.

Reflecting on the Outline width, you should be able to use the SDF Scale which is passed to shader. This SDF Scale is the relationship of the sampling point size to display size where for instance, if the sampling point size is 90 and displayed point size is 90 then the SDF Scale will be 1.0.

In version 3.2.0-pre.3, the SDF Scale is passed in the “w” component of UV0.

Any plans to release new version for TMP? We are looking for a fix to one specific issue TMPro SubMeshUI Error when changing scenes

Hi @Stephan_B ,

I’m still struggeling with getting the ligatures to work. I found the Ligature Table but have no clue, how to add the actual ligatures. As far as I understand the glyphs need to be included in the font atlas, but I simply don’t understand how. If I type them in like they are named in the file (for example: «f_i») during the creation of the font atlas, it will treat them as three sperate glyphs instead of looking for the one with that name. Am I missing something?

Thanks.

OpenType Layout features such as Ligatures reference glyphs by their index. Most of the time, you can lookup the glyph index in the Character or Glyph tables but in the case of glyphs that have never been added, you have to use an external tool like FontForge, FontLab (free) or FontCreator to find those indexes.

Here is an example using FontCreator (free version would work here) to look at Roboto-Bold.ttf.

8367993--1102533--upload_2022-8-16_16-50-36.png

Here is what some of those ligatures look like in the Ligature Table

8367993--1102536--upload_2022-8-16_16-53-9.png

Having to manually populate these OpenType tables is not fun and this process will get much easier once the changes I have been working on for a while make it into Unity. These changes will make it where this data is extracted automatically from the font file. The plan is to have these changes available in some future version of Unity 2020.3 and newer.

In terms of referencing glyph by index, I think it would be nice to also be able to reference glyphs by name. Having said that, not all font designers follow established naming conventions where for instance the glyph for the Ligature for “f” + “f” + “i” is typically named “f_f_i” but that is not the case in many font files.

I found the index number of the ligatures in the font file using â€čGlyphsâ€ș. When I now try to include these by entering the numbers in the character sequence while creating the font atlas, the atlas creator simply refuses to include them, as seen in the screenshot.

Another thing with the index is that the glyph index in TMP is off by one number and in some cases the numbers don’t align at all (â€čfâ€ș in TMP ID 95 in the font file ID 93).

[edit:] It seems when I set the font to dynamic and use the letter combination in some text field, that I’m then able to trial and error myself towards finding the ligature (plus minus 1–2 index numbers).

I attached screenshots and hope they illustrate my problem.

Glyph Index
8368803--1102770--index_fontfile.png
Asset Creator excluding the Ligatures
8368803--1102767--glyphs_get_excluded.jpg

Thanks again.

Referencing the glyph index in the Font Asset Creator Character Sequence window won’t work as these values represent the Unicode code point for those characters. The glyph index is a reference to the glyph index in an array of glyphs contained in the font file.

Here is an example using FontCreator from High-Logic for the font Roboto - Bold

In the image below, you can the Unicode code point for the character “A” is 0x41.

8374266--1103847--upload_2022-8-18_23-44-27.png

However, the index of this glyph is glyph index = 37 as seen below.

8374266--1103850--upload_2022-8-18_23-46-4.png

and here as seen in the font asset inspector of this font asset.

8374266--1103853--upload_2022-8-18_23-48-7.png

Note that the Unicode code point for the character “A” will never change as this its designed address / code point in the Unicode Standards. However, the glyph index for this character can and will most likely be different from font to font. This glyph index simply represent the index of the glyph in an array of glyphs. As such, depending on the font file and glyphs present, the index of any given glyph will vary.

For example, the glyph index of the character “A” in the LiberationSans - Regular font file is 36 as seen below.

8374266--1103856--upload_2022-8-18_23-51-38.png

and in the NotoSans-Bold font file, its index 17.

8374266--1103859--upload_2022-8-18_23-52-41.png

As a reference, a Character is mapped to a specific Unicode Code Point where for instance the letter “A” is assigned the Unicode 0x41 or decimal value of 65. A character references a glyph index where such glyph is the visual representation of this character.

Note that it is possible for multiple characters to reference the same glyph index. For instance, the Latin letter “T” 0x54, the Greek letter “T” 0x3A4 and the Cyrillic letter “T” 0x422.

Back on the topic of Ligatures, most of the time, the resulting glyph that is used in a ligature is not assigned to a Unicode Code Point. As such, these glyphs can only be referenced via their glyph index.

Thanks for this - it’s been driving me mad!
Don’t know why it doesn’t just show up when you enable experimental packages in the settings. Grrrr!
<3

Its great to see TMPro actively being improved.

I was very excited in the ability to select a font style/weight from a TT collection, alas for my purposes it doesn’t appear to work. I think its a misunderstanding on my end as I wanted to use it to extract the different weights from Googles new Material Symbols variable font files ( e.g. MaterialSymbolsOutlined[FILL,GRAD,opsz,wght].ttf) and it seems these are not collections, but a base font with embedded parameters that allow different wieghts to be generated at runtime.

Assuming I’m correct with the above, is there any chance TMPro could support this in the future?

I have a workaround currently where I download the WOFF2 web file for a specific MaterialSymbol font style and weight, convert it to ttf and import that into Unity, but its a bit of pain, especially as it generates so many different files for all the variations. Though I’m hoping to work out how to combine those conversions into a collection and leverage the new support for TT collections.

[Edit - New Suggestion]
I don’t seem to find any ‘default’ settings for the Font Asset Creator - having to create a large number of TMPro font assets from font files is quite a bit of a pain. While you can select multiple fonts and create TMPro Font Assets, you still have to go in by hand and set up all the options, even if they are sharing the same ones.

Maybe something like Unity ‘Presets’ process would work here, though as the Font Asset Creator isn’t technically an importer i’m not sure they could be used directly.
[Edit - end]

Finally I’ve recently had to start using Unity with Preferences > UI Scaling > Custom Scaling of 125% and noticed the Font Asset Creator in TMPro side bar with all the settings is always clipped horizontally, forcing you to scroll left/right constantly when changing settings. Pretty sure this occurs 100% of the time, but it definately happens every time I try to ‘Update Atlas Texture’ from a created TMPro font asset.

Strangely opening ‘Font Asset Creator’ from the menus does not exhibit the clipping issue. Its only when you use ‘Update Atlas Texture’ from an existing Font Asset.

After further investigation, it would seem that maybe the way I was creating TMPro Font Assets was not the optimum approach for my objective. I guess I was using it as you would with other Unity assets - create each TMPro asset per font file asset - then use ‘Update Texture Atlas’ to populate the texture within the asset.

Whilst doing this I noticed that I could simply open the ‘Font Asset Creator’, assign the font, set the various settings, generate Font Atlas and then use ‘Save as’ to create a specific TMPro Font Asset for a specific font, with bonus ability of for a specific font face ( via pre-release ). The obvious benefit being that it maintains all the settings between switching font face.

Although slightly counter intuitive it would seem far more efficient than my original process and broadly address my complaint/suggest with regard to preset/default creator settings in the post above.

The only issue with this approach that I’ve noticed is that ‘save as’ will populate the file name with the ‘Source Font’ name, instead of the ‘Font Face’ name. If that could be addressed then this makes dealing with creating many fonts, especially with the new TTC support, much more streamlined.

Suggestion:
In Font Asset Creator, have ‘save as’ use the selected FontFace name as the filename.

Edit - I might be dumb :wink:

I had reported a potential bug with TTC support, where TMPro would only report 5 FontFaces instead of the 6 that I added to the collection in FontForge. Yet FontForge would report that there were 6 fonts in the same ttc file. I carried out several different tests and originally had the same results, but later tests appeared to work.

Long story short I finally discovered that two of the fonts i’d added to the collection were duplicates, due to a naming bug. The font files were byte for byte exactly the same. Replacing the duplicate with the correct file, would appear to have address the whole TTC issue I was experiencing.

Have created half a dozen TTC files in FontForge now and all of them come in via TMPro correctly, so it would appear that accidently having a file that was a duplicate of another and instead of being a different file was the cause of my problems.

Previous post deleted.

Whats the status on the Emoji support now, it’s been about 6 months since it was originally mentioned.

Thanks!

PR is going through the approval process. However, I uncovered an issue while doing additional testing but this should not delay the overall process.

This still needs to be backported to previous version of Unity. I would expect perhaps another 30 - 45 days before this makes it into those Unity releases.

What version of Unity are you currently using?

1 Like

Hi;
Will this 3.2.0 package support also WebGl input keyboard? in Mobile devices when we tab input text fields the screen keyboards are not working.
We are working in a project and we stuck with this problem.
in the Forums Unity solved this with the 3.2.0 version. So I am curious about this.
When will the stable version release?

Thanks

I’m using unity 2021.3.10f1 currently

1 Like

Will the SDF-URP Lit shaders make it in to the next release? Been trying to get my world space text to receive shadows/lights, is there a simple way to achieve that or should I just wait for the SDF Lit shaders?

The URP and HDRP shaders are already included in version 3.2.0-pre.3. They are included in the TMP Essential Resources which you will need to re-import.

Sorry, I meant next full release, not prerelease. When I use the URP SDF List shader right now in a new URP project I get some console errors, but you’re probably aware of that.

I am not aware of any console error when using version 3.2.0-pre.3 with URP in Unity 2020.3 or newer.

What error are you getting?

Here were the steps I followed to yield this console error:

  • Create new unity 2021.3.10f1 project
  • Import 3.2.0-pre.3.
  • Import URP
  • Set SRP settings to use a URP asset
  • Add some text to the scene
  • Change the text’s shader to use TextMeshPro/SRP/TMP_SDF-URP Lit
  • Console error appears

This is the error:

Material 'LiberationSans SDF Material' with Shader 'TextMeshPro/SRP/TMP_SDF-URP Lit' doesn't have a float or range property '_ScaleRatioA'
UnityEngine.Material:GetFloat (int)
TMPro.TextMeshProUGUI:GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.3/Scripts/Runtime/TMPro_UGUI_Private.cs:2364)
TMPro.TextMeshProUGUI:OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.3/Scripts/Runtime/TMPro_UGUI_Private.cs:1737)
TMPro.TextMeshProUGUI:Rebuild (UnityEngine.UI.CanvasUpdate) (at Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.3/Scripts/Runtime/TextMeshProUGUI.cs:216)
UnityEngine.Canvas:SendWillRenderCanvases ()

Back to the question at hand, will the URP Lit shader be ready for use in the next full release?

I repeated the above steps in Unity 2021.3.11f1 and I am not getting those console errors.

I also tested creating a new project using the 2D (URP) template and not getting any errors either.

In terms of the stack trace above, at line 2361, the code does check if the material is using a shader with gradient scale and if it is then it would try to set the scale ratio. Since the SRP shaders do not use this property, it should not execute the code that produces the error in your case.

Something is causing those errors to appear in your case and like I said before version 3.2.0-pre.3 has been available for a long time and used in many SRP projects (both URP and HDRP).

Out of curiosity, what is the text that you are setting on the text component?

Do you get the same errors if you create the new project using the 2D URP template?

P.S. In theory, it is possible to get some temporary console errors when switching from a shader that was using the normal render pipeline to an SRP shader when that text object is using fallbacks. This is temporary in the sense when switching the first time. Re-updating the text or entering or existing play mode some resolve all of that.