Skip to content

Commit

Permalink
com.unity.textmeshpro@2.1.0-preview.13
Browse files Browse the repository at this point in the history
## [2.1.0-preview.13] - 2020-05-22
  • Loading branch information
Unity Technologies committed May 21, 2020
1 parent 2fe10ef commit 88be79d
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 45 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Changelog
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

## [2.1.0-preview.13] - 2020-05-22
## [1.5.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.

## [2.1.0-preview.12] - 2020-05-09
## [1.5.0-preview.12]
## [3.0.0-preview.12]
Expand Down
20 changes: 18 additions & 2 deletions Scripts/Editor/TMPro_FontAssetCreatorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ enum FontPackingModes { Fast = 0, Optimum = 4 };
float m_AtlasGenerationProgress;
string m_AtlasGenerationProgressLabel = string.Empty;
float m_RenderingProgress;
bool m_IsGlyphPackingDone;
bool m_IsGlyphRenderingDone;
bool m_IsRenderingDone;
bool m_IsProcessing;
bool m_IsGenerationDisabled;
Expand Down Expand Up @@ -281,6 +283,18 @@ public void Update()
m_IsRepaintNeeded = true;
}

if (m_IsGlyphPackingDone)
{
Debug.Log("Glyph packing completed in: " + m_GlyphPackingGenerationTime.ToString("0.000 ms."));
m_IsGlyphPackingDone = false;
}

if (m_IsGlyphRenderingDone)
{
Debug.Log("Font Atlas generation completed in: " + m_GlyphRenderingGenerationTime.ToString("0.000 ms."));
m_IsGlyphRenderingDone = false;
}

// Update Feedback Window & Create Font Texture once Rendering is done.
if (m_IsRenderingDone)
{
Expand Down Expand Up @@ -921,7 +935,8 @@ void DrawControls()
//Stop StopWatch
m_StopWatch.Stop();
m_GlyphPackingGenerationTime = m_StopWatch.Elapsed.TotalMilliseconds;
Debug.Log("Glyph packing completed in: " + m_GlyphPackingGenerationTime.ToString("0.000 ms."));
m_IsGlyphPackingDone = true;
//Debug.Log("Glyph packing completed in: " + m_GlyphPackingGenerationTime.ToString("0.000 ms."));
m_StopWatch.Reset();
m_FontCharacterTable.Clear();
Expand Down Expand Up @@ -987,7 +1002,8 @@ void DrawControls()
// Stop StopWatch
m_StopWatch.Stop();
m_GlyphRenderingGenerationTime = m_StopWatch.Elapsed.TotalMilliseconds;
Debug.Log("Font Atlas generation completed in: " + m_GlyphRenderingGenerationTime.ToString("0.000 ms."));
m_IsGlyphRenderingDone = true;
//Debug.Log("Font Atlas generation completed in: " + m_GlyphRenderingGenerationTime.ToString("0.000 ms."));
m_StopWatch.Reset();
});
}
Expand Down
57 changes: 30 additions & 27 deletions Scripts/Runtime/TMP_SubMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,32 @@ public TMP_Text textComponent
private bool m_isRegisteredForEvents;


public static TMP_SubMesh AddSubTextObject(TextMeshPro textComponent, MaterialReference materialReference)
{
GameObject go = new GameObject("TMP SubMesh [" + materialReference.material.name + "]", typeof(TMP_SubMesh));
go.hideFlags = HideFlags.DontSave;

TMP_SubMesh subMesh = go.GetComponent<TMP_SubMesh>();

go.transform.SetParent(textComponent.transform, false);
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
go.transform.localScale = Vector3.one;
go.layer = textComponent.gameObject.layer;

subMesh.m_TextComponent = textComponent;
subMesh.m_fontAsset = materialReference.fontAsset;
subMesh.m_spriteAsset = materialReference.spriteAsset;
subMesh.m_isDefaultMaterial = materialReference.isDefaultMaterial;
subMesh.SetSharedMaterial(materialReference.material);

subMesh.renderer.sortingLayerID = textComponent.renderer.sortingLayerID;
subMesh.renderer.sortingOrder = textComponent.renderer.sortingOrder;

return subMesh;
}


void OnEnable()
{
//Debug.Log("***** OnEnable() called on object ID " + GetInstanceID() + "]. Parent Text Object ID [" + (textComponent == null ? "" : textComponent.GetInstanceID().ToString()) + "] *****");
Expand All @@ -252,6 +278,10 @@ void OnEnable()
m_isRegisteredForEvents = true;
}

// Update HideFlags on previously created sub text objects.
if (hideFlags != HideFlags.DontSave)
hideFlags = HideFlags.DontSave;

// Make the geometry visible when the object is enabled.
meshFilter.sharedMesh = mesh;

Expand Down Expand Up @@ -420,33 +450,6 @@ void ON_TMP_SETTINGS_CHANGED()
#endif



public static TMP_SubMesh AddSubTextObject(TextMeshPro textComponent, MaterialReference materialReference)
{
GameObject go = new GameObject("TMP SubMesh [" + materialReference.material.name + "]", typeof(TMP_SubMesh));
go.hideFlags = HideFlags.DontSave;

TMP_SubMesh subMesh = go.GetComponent<TMP_SubMesh>();

go.transform.SetParent(textComponent.transform, false);
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
go.transform.localScale = Vector3.one;
go.layer = textComponent.gameObject.layer;

subMesh.m_TextComponent = textComponent;
subMesh.m_fontAsset = materialReference.fontAsset;
subMesh.m_spriteAsset = materialReference.spriteAsset;
subMesh.m_isDefaultMaterial = materialReference.isDefaultMaterial;
subMesh.SetSharedMaterial(materialReference.material);

subMesh.renderer.sortingLayerID = textComponent.renderer.sortingLayerID;
subMesh.renderer.sortingOrder = textComponent.renderer.sortingOrder;

return subMesh;
}


public void DestroySelf()
{
Destroy(this.gameObject, 1f);
Expand Down
4 changes: 4 additions & 0 deletions Scripts/Runtime/TMP_SubMeshUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ protected override void OnEnable()
m_isRegisteredForEvents = true;
}

// Update HideFlags on previously created sub text objects.
if (hideFlags != HideFlags.DontSave)
hideFlags = HideFlags.DontSave;

m_ShouldRecalculateStencil = true;
RecalculateClipping();
RecalculateMasking();
Expand Down
12 changes: 7 additions & 5 deletions Scripts/Runtime/TMPro_Private.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1389,9 +1389,14 @@ public override void ComputeMarginSize()
if (this.rectTransform != null)
{
//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);
Rect rect = m_rectTransform.rect;

m_marginWidth = m_rectTransform.rect.width - m_margin.x - m_margin.z;
m_marginHeight = m_rectTransform.rect.height - m_margin.y - m_margin.w;
m_marginWidth = rect.width - m_margin.x - m_margin.z;
m_marginHeight = rect.height - m_margin.y - m_margin.w;

// Cache current RectTransform width and pivot referenced in OnRectTransformDimensionsChange() to get around potential rounding error in the reported width of the RectTransform.
m_PreviousRectTransformSize = rect.size;
m_PreviousPivotPosition = m_rectTransform.pivot;

// Update the corners of the RectTransform
m_RectTransformCorners = GetTextContainerLocalCorners();
Expand Down Expand Up @@ -1431,9 +1436,6 @@ protected override void OnRectTransformDimensionsChange()
return;
}

m_PreviousRectTransformSize = m_rectTransform.rect.size;
m_PreviousPivotPosition = m_rectTransform.pivot;

ComputeMarginSize();

SetVerticesDirty();
Expand Down
19 changes: 12 additions & 7 deletions Scripts/Runtime/TMPro_UGUI_Private.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1467,9 +1467,14 @@ public override void ComputeMarginSize()
if (this.rectTransform != null)
{
//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);
Rect rect = m_rectTransform.rect;

m_marginWidth = m_rectTransform.rect.width - m_margin.x - m_margin.z;
m_marginHeight = m_rectTransform.rect.height - m_margin.y - m_margin.w;
m_marginWidth = rect.width - m_margin.x - m_margin.z;
m_marginHeight = rect.height - m_margin.y - m_margin.w;

// Cache current RectTransform width and pivot referenced in OnRectTransformDimensionsChange() to get around potential rounding error in the reported width of the RectTransform.
m_PreviousRectTransformSize = rect.size;
m_PreviousPivotPosition = m_rectTransform.pivot;

// Update the corners of the RectTransform
m_RectTransformCorners = GetTextContainerLocalCorners();
Expand Down Expand Up @@ -1535,9 +1540,6 @@ protected override void OnRectTransformDimensionsChange()
return;
}

m_PreviousRectTransformSize = m_rectTransform.rect.size;
m_PreviousPivotPosition = m_rectTransform.pivot;

ComputeMarginSize();

UpdateSubObjectPivot();
Expand Down Expand Up @@ -4510,9 +4512,12 @@ internal override Rect GetCanvasSpaceClippingRect()
Transform rootCanvasTransform = m_canvas.rootCanvas.transform;
Bounds compoundBounds = GetCompoundBounds();

Vector3 position = rootCanvasTransform.InverseTransformPoint(m_rectTransform.position);
Vector2 position = rootCanvasTransform.InverseTransformPoint(m_rectTransform.position);

Vector2 canvasLossyScale = rootCanvasTransform.lossyScale;
Vector2 lossyScale = m_rectTransform.lossyScale / canvasLossyScale;

return new Rect(position + compoundBounds.min, compoundBounds.size);
return new Rect(position + compoundBounds.min * lossyScale, compoundBounds.size * lossyScale);
}


Expand Down
2 changes: 1 addition & 1 deletion Scripts/Runtime/TextMeshProUGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public override void RecalculateMasking()
public override void Cull(Rect clipRect, bool validRect)
{
//Debug.Log("***** Cull (" + clipRect + ", " + validRect + ") Cull: " + m_canvasRenderer.cull + " *****");
if (m_canvas == null)
if (m_canvas == null || m_canvas.rootCanvas == null)
return;

// Get compound rect for the text object and sub text objects in local canvas space.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.unity.textmeshpro",
"displayName": "TextMeshPro",
"version": "2.1.0-preview.12",
"version": "2.1.0-preview.13",
"unity": "2019.1",
"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.",
"keywords": [
Expand All @@ -18,9 +18,9 @@
"repository": {
"type": "git",
"url": "https://github.cds.internal.unity3d.com/unity/com.unity.textmeshpro.git",
"revision": "519a80532dac6569e4fcd1896045c6eb0f63aba0"
"revision": "2e03ff9e1624d8fb3b464cd212ea2df1d5e16eb0"
},
"upmCi": {
"footprint": "d9daa40441a9b101fd60c66787728d95e32eab9e"
"footprint": "efc885a90a536ccd3fe4247316486c23738bdf87"
}
}

0 comments on commit 88be79d

Please sign in to comment.