Skip to content

Commit 8622821

Browse files
author
Unity Technologies
committed
com.unity.textmeshpro@1.5.0-preview.13
## [1.5.0-preview.13] - 2020-05-22 ## [2.1.0-preview.13] ## [3.0.0-preview.13] ### Changes - Fixed potential issue where the Font Asset Creator could get stuck in the packing phase of the atlas generation process. See [forum post](https://forum.unity.com/threads/font-asset-creator-stuck-at-packing-glyphs-pass-8.811863/) for details. - Fixed issue potentially affecting text layout as a result of the width of the RectTransform being incorrectly reported. See [forum post](https://forum.unity.com/threads/textmesh-pro-forcemeshupdate-true-not-working-when-object-inactive.524507/#post-5798515) for details. - Previously created prefabs containing sub text objects will now have their HideFlags updated to HideFlags.DontSave to be consistent with newly created prefabs whose sub text objects are no longer serialized. Case #1247184 - Fixed culling issue where lossy scale was not considered in the determination of the bounds of the text geometry.
1 parent 6df08ea commit 8622821

8 files changed

+82
-45
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Changelog
22
These are the release notes for the TextMesh Pro UPM package which was first introduced with Unity 2018.1. Please see the following link for the Release Notes for prior versions of TextMesh Pro. http://digitalnativestudios.com/forum/index.php?topic=1363.0
33

4+
## [1.5.0-preview.13] - 2020-05-22
5+
## [2.1.0-preview.13]
6+
## [3.0.0-preview.13]
7+
### Changes
8+
- Fixed potential issue where the Font Asset Creator could get stuck in the packing phase of the atlas generation process. See [forum post](https://forum.unity.com/threads/font-asset-creator-stuck-at-packing-glyphs-pass-8.811863/) for details.
9+
- Fixed issue potentially affecting text layout as a result of the width of the RectTransform being incorrectly reported. See [forum post](https://forum.unity.com/threads/textmesh-pro-forcemeshupdate-true-not-working-when-object-inactive.524507/#post-5798515) for details.
10+
- Previously created prefabs containing sub text objects will now have their HideFlags updated to HideFlags.DontSave to be consistent with newly created prefabs whose sub text objects are no longer serialized. Case #1247184
11+
- Fixed culling issue where lossy scale was not considered in the determination of the bounds of the text geometry.
12+
413
## [1.5.0-preview.12] - 2020-05-09
514
## [2.1.0-preview.12]
615
## [3.0.0-preview.12]

Scripts/Editor/TMPro_FontAssetCreatorWindow.cs

+16-2
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ enum FontPackingModes { Fast = 0, Optimum = 4 };
126126
float m_AtlasGenerationProgress;
127127
string m_AtlasGenerationProgressLabel = string.Empty;
128128
float m_RenderingProgress;
129+
bool m_IsGlyphPackingDone;
130+
bool m_IsGlyphRenderingDone;
129131
bool m_IsRenderingDone;
130132
bool m_IsProcessing;
131133
bool m_IsGenerationDisabled;
@@ -281,6 +283,18 @@ public void Update()
281283
m_IsRepaintNeeded = true;
282284
}
283285

286+
if (m_IsGlyphPackingDone)
287+
{
288+
Debug.Log("Glyph packing completed in: " + m_GlyphPackingGenerationTime.ToString("0.000 ms."));
289+
m_IsGlyphPackingDone = false;
290+
}
291+
292+
if (m_IsGlyphRenderingDone)
293+
{
294+
Debug.Log("Font Atlas generation completed in: " + m_GlyphRenderingGenerationTime.ToString("0.000 ms."));
295+
m_IsGlyphRenderingDone = false;
296+
}
297+
284298
// Update Feedback Window & Create Font Texture once Rendering is done.
285299
if (m_IsRenderingDone)
286300
{
@@ -921,7 +935,7 @@ void DrawControls()
921935
//Stop StopWatch
922936
m_StopWatch.Stop();
923937
m_GlyphPackingGenerationTime = m_StopWatch.Elapsed.TotalMilliseconds;
924-
Debug.Log("Glyph packing completed in: " + m_GlyphPackingGenerationTime.ToString("0.000 ms."));
938+
m_IsGlyphPackingDone = true;
925939
m_StopWatch.Reset();
926940

927941
m_FontCharacterTable.Clear();
@@ -987,7 +1001,7 @@ void DrawControls()
9871001
// Stop StopWatch
9881002
m_StopWatch.Stop();
9891003
m_GlyphRenderingGenerationTime = m_StopWatch.Elapsed.TotalMilliseconds;
990-
Debug.Log("Font Atlas generation completed in: " + m_GlyphRenderingGenerationTime.ToString("0.000 ms."));
1004+
m_IsGlyphRenderingDone = true;
9911005
m_StopWatch.Reset();
9921006
});
9931007
}

Scripts/Runtime/TMP_SubMesh.cs

+30-27
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,32 @@ public TMP_Text textComponent
232232
private bool m_isRegisteredForEvents;
233233

234234

235+
public static TMP_SubMesh AddSubTextObject(TextMeshPro textComponent, MaterialReference materialReference)
236+
{
237+
GameObject go = new GameObject("TMP SubMesh [" + materialReference.material.name + "]", typeof(TMP_SubMesh));
238+
go.hideFlags = HideFlags.DontSave;
239+
240+
TMP_SubMesh subMesh = go.GetComponent<TMP_SubMesh>();
241+
242+
go.transform.SetParent(textComponent.transform, false);
243+
go.transform.localPosition = Vector3.zero;
244+
go.transform.localRotation = Quaternion.identity;
245+
go.transform.localScale = Vector3.one;
246+
go.layer = textComponent.gameObject.layer;
247+
248+
subMesh.m_TextComponent = textComponent;
249+
subMesh.m_fontAsset = materialReference.fontAsset;
250+
subMesh.m_spriteAsset = materialReference.spriteAsset;
251+
subMesh.m_isDefaultMaterial = materialReference.isDefaultMaterial;
252+
subMesh.SetSharedMaterial(materialReference.material);
253+
254+
subMesh.renderer.sortingLayerID = textComponent.renderer.sortingLayerID;
255+
subMesh.renderer.sortingOrder = textComponent.renderer.sortingOrder;
256+
257+
return subMesh;
258+
}
259+
260+
235261
void OnEnable()
236262
{
237263
//Debug.Log("***** OnEnable() called on object ID " + GetInstanceID() + "]. Parent Text Object ID [" + (textComponent == null ? "" : textComponent.GetInstanceID().ToString()) + "] *****");
@@ -252,6 +278,10 @@ void OnEnable()
252278
m_isRegisteredForEvents = true;
253279
}
254280

281+
// Update HideFlags on previously created sub text objects.
282+
if (hideFlags != HideFlags.DontSave)
283+
hideFlags = HideFlags.DontSave;
284+
255285
// Make the geometry visible when the object is enabled.
256286
meshFilter.sharedMesh = mesh;
257287

@@ -420,33 +450,6 @@ void ON_TMP_SETTINGS_CHANGED()
420450
#endif
421451

422452

423-
424-
public static TMP_SubMesh AddSubTextObject(TextMeshPro textComponent, MaterialReference materialReference)
425-
{
426-
GameObject go = new GameObject("TMP SubMesh [" + materialReference.material.name + "]", typeof(TMP_SubMesh));
427-
go.hideFlags = HideFlags.DontSave;
428-
429-
TMP_SubMesh subMesh = go.GetComponent<TMP_SubMesh>();
430-
431-
go.transform.SetParent(textComponent.transform, false);
432-
go.transform.localPosition = Vector3.zero;
433-
go.transform.localRotation = Quaternion.identity;
434-
go.transform.localScale = Vector3.one;
435-
go.layer = textComponent.gameObject.layer;
436-
437-
subMesh.m_TextComponent = textComponent;
438-
subMesh.m_fontAsset = materialReference.fontAsset;
439-
subMesh.m_spriteAsset = materialReference.spriteAsset;
440-
subMesh.m_isDefaultMaterial = materialReference.isDefaultMaterial;
441-
subMesh.SetSharedMaterial(materialReference.material);
442-
443-
subMesh.renderer.sortingLayerID = textComponent.renderer.sortingLayerID;
444-
subMesh.renderer.sortingOrder = textComponent.renderer.sortingOrder;
445-
446-
return subMesh;
447-
}
448-
449-
450453
public void DestroySelf()
451454
{
452455
Destroy(this.gameObject, 1f);

Scripts/Runtime/TMP_SubMeshUI.cs

+4
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ protected override void OnEnable()
266266
m_isRegisteredForEvents = true;
267267
}
268268

269+
// Update HideFlags on previously created sub text objects.
270+
if (hideFlags != HideFlags.DontSave)
271+
hideFlags = HideFlags.DontSave;
272+
269273
m_ShouldRecalculateStencil = true;
270274
RecalculateClipping();
271275
RecalculateMasking();

Scripts/Runtime/TMPro_Private.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1389,9 +1389,14 @@ public override void ComputeMarginSize()
13891389
if (this.rectTransform != null)
13901390
{
13911391
//Debug.Log("*** ComputeMarginSize() *** Current RectTransform's Width is " + m_rectTransform.rect.width + " and Height is " + m_rectTransform.rect.height); // + " and size delta is " + m_rectTransform.sizeDelta);
1392+
Rect rect = m_rectTransform.rect;
13921393

1393-
m_marginWidth = m_rectTransform.rect.width - m_margin.x - m_margin.z;
1394-
m_marginHeight = m_rectTransform.rect.height - m_margin.y - m_margin.w;
1394+
m_marginWidth = rect.width - m_margin.x - m_margin.z;
1395+
m_marginHeight = rect.height - m_margin.y - m_margin.w;
1396+
1397+
// Cache current RectTransform width and pivot referenced in OnRectTransformDimensionsChange() to get around potential rounding error in the reported width of the RectTransform.
1398+
m_PreviousRectTransformSize = rect.size;
1399+
m_PreviousPivotPosition = m_rectTransform.pivot;
13951400

13961401
// Update the corners of the RectTransform
13971402
m_RectTransformCorners = GetTextContainerLocalCorners();
@@ -1431,9 +1436,6 @@ protected override void OnRectTransformDimensionsChange()
14311436
return;
14321437
}
14331438

1434-
m_PreviousRectTransformSize = m_rectTransform.rect.size;
1435-
m_PreviousPivotPosition = m_rectTransform.pivot;
1436-
14371439
ComputeMarginSize();
14381440

14391441
SetVerticesDirty();

Scripts/Runtime/TMPro_UGUI_Private.cs

+12-7
Original file line numberDiff line numberDiff line change
@@ -1467,9 +1467,14 @@ public override void ComputeMarginSize()
14671467
if (this.rectTransform != null)
14681468
{
14691469
//Debug.Log("*** ComputeMarginSize() *** Current RectTransform's Width is " + m_rectTransform.rect.width + " and Height is " + m_rectTransform.rect.height); // + " and size delta is " + m_rectTransform.sizeDelta);
1470+
Rect rect = m_rectTransform.rect;
14701471

1471-
m_marginWidth = m_rectTransform.rect.width - m_margin.x - m_margin.z;
1472-
m_marginHeight = m_rectTransform.rect.height - m_margin.y - m_margin.w;
1472+
m_marginWidth = rect.width - m_margin.x - m_margin.z;
1473+
m_marginHeight = rect.height - m_margin.y - m_margin.w;
1474+
1475+
// Cache current RectTransform width and pivot referenced in OnRectTransformDimensionsChange() to get around potential rounding error in the reported width of the RectTransform.
1476+
m_PreviousRectTransformSize = rect.size;
1477+
m_PreviousPivotPosition = m_rectTransform.pivot;
14731478

14741479
// Update the corners of the RectTransform
14751480
m_RectTransformCorners = GetTextContainerLocalCorners();
@@ -1535,9 +1540,6 @@ protected override void OnRectTransformDimensionsChange()
15351540
return;
15361541
}
15371542

1538-
m_PreviousRectTransformSize = m_rectTransform.rect.size;
1539-
m_PreviousPivotPosition = m_rectTransform.pivot;
1540-
15411543
ComputeMarginSize();
15421544

15431545
UpdateSubObjectPivot();
@@ -4510,9 +4512,12 @@ internal override Rect GetCanvasSpaceClippingRect()
45104512
Transform rootCanvasTransform = m_canvas.rootCanvas.transform;
45114513
Bounds compoundBounds = GetCompoundBounds();
45124514

4513-
Vector3 position = rootCanvasTransform.InverseTransformPoint(m_rectTransform.position);
4515+
Vector2 position = rootCanvasTransform.InverseTransformPoint(m_rectTransform.position);
4516+
4517+
Vector2 canvasLossyScale = rootCanvasTransform.lossyScale;
4518+
Vector2 lossyScale = m_rectTransform.lossyScale / canvasLossyScale;
45144519

4515-
return new Rect(position + compoundBounds.min, compoundBounds.size);
4520+
return new Rect(position + compoundBounds.min * lossyScale, compoundBounds.size * lossyScale);
45164521
}
45174522

45184523

Scripts/Runtime/TextMeshProUGUI.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public override void RecalculateMasking()
369369
public override void Cull(Rect clipRect, bool validRect)
370370
{
371371
//Debug.Log("***** Cull (" + clipRect + ", " + validRect + ") Cull: " + m_canvasRenderer.cull + " *****");
372-
if (m_canvas == null)
372+
if (m_canvas == null || m_canvas.rootCanvas == null)
373373
return;
374374

375375
// Get compound rect for the text object and sub text objects in local canvas space.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.unity.textmeshpro",
33
"displayName": "TextMeshPro",
4-
"version": "1.5.0-preview.12",
4+
"version": "1.5.0-preview.13",
55
"unity": "2018.3",
66
"description": "TextMeshPro is the ultimate text solution for Unity. It's the perfect replacement for Unity's UI Text and the legacy Text Mesh.\n\nPowerful and easy to use, TextMeshPro (also known as TMP) uses Advanced Text Rendering techniques along with a set of custom shaders; delivering substantial visual quality improvements while giving users incredible flexibility when it comes to text styling and texturing.\n\nTextMeshPro provides Improved Control over text formatting and layout with features like character, word, line and paragraph spacing, kerning, justified text, Links, over 30 Rich Text Tags available, support for Multi Font & Sprites, Custom Styles and more.\n\nGreat performance. Since the geometry created by TextMeshPro uses two triangles per character just like Unity's text components, this improved visual quality and flexibility comes at no additional performance cost.",
77
"keywords": [
@@ -16,9 +16,9 @@
1616
"repository": {
1717
"type": "git",
1818
"url": "https://github.cds.internal.unity3d.com/unity/com.unity.textmeshpro.git",
19-
"revision": "444244c864ff938304b3482bb64c3df3600770e4"
19+
"revision": "1448aa571d4c804e4ff3209ae469eacc9387338d"
2020
},
2121
"upmCi": {
22-
"footprint": "04a5529de6d5e282fa5137b3e48bc77fd9583f98"
22+
"footprint": "458dc7747e3560202d6adcfe1ff6fa55499baad8"
2323
}
2424
}

0 commit comments

Comments
 (0)