Ellipsis Exception


I uploaded the operation video and Project
Please operate the height value slightly

Unity Ver 2018.4.10f1
TextMeshPro Ver 1.5.1

thank you

6460609--724459--textmsehpro.zip (4.62 MB)

Thank you for providing the Repro project.

I have downloaded it and was able to reproduce the issue and will be taking a closer look tomorrow and follow up once I have more information.

I finally had a chance to look at the project you provided and although I have not yet decided on the best way to address the issue, I can provide you with a way to get around the issue.

First, this issue occurs for a few reasons but the primary one is due to the metric of the Ellipsis character namely the Ascender and Descender exceed those of the primary font asset in use. Below is an image showing the Ascent and Descent line of each character.

6472790--726689--upload_2020-10-29_23-40-8.png

Given the Ascender and Descender of the Ellipsis character exceeds those of the previous characters, it is not possible to insert this Ellipsis when the height of the text container is smaller than the Ellipsis character.

To get around this issue...

Option (1)
You could add / use the Ellipsis character from your primary font asset which would produce the following results.

6472790--726692--upload_2020-10-29_23-48-11.png

Given the Ellipsis character contained in this Gothic font has the same metric (Ascender and Descender) as all other characters, the issue you not occur since we can fit the Ellipsis in the place of any other character from this Gothic font.

Note that the vertical position of the Ellipsis character of this Gothic font is not placed at the baseline like the one from LiberationSans. This is a design decision on the part of whoever design this Gothic font. Also note that it is possible to adjust the vertical position of this Ellipsis glyph in the Font Asset Glyph Table by adjusting the Y Bearing (BY) value.

Option (2)
You could adjust the metric of this Gothic font asset in the Font Asset Face Info (Ascent and Descent Lines) to match those of LiberationSans as seen in the image below.

6472790--726695--upload_2020-10-29_23-54-4.png

This would ensure that as you switch from Gothic to LiberationSans to use its Ellipsis character, the metric would match and would also get around this issue as once again, the Ellipsis character can fit in place of any other character.

Normalizing the metrics of different font asset is pretty common when using multiple font assets and fallbacks. Doing so ensures vertical text alignment is consistent regardless of what font asset is used.

Although I will be improving / fixing this potential error, I still recommend you use Option 1 or 2 which will ensure the Ellipsis character can be inserted in the place of most characters when using these two fonts as well as consistent vertical alignment between them.

P.S. You can visual these metrics by adding the TMP_TextInfoDebugTool.cs script found in the TMP Examples & Extras scripts to any text object.


oh~,Thank you very much,I did fix the mistake

You are most welcome.

I have also resolved the issue where the error will no longer occur even if the metrics of the font assets are not adjusted or normalized.

Note that I still recommend normalizing these metrics to ensure various fonts work well with each other from a layout point of view.