Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.5.0-preview.3] - 2019-12-16
## [2.1.0-preview.3]
### Changes
- Fixed potential issue with TMP Dropdown where calling Show() and Hide() in very short interval could result in additional Blockers. Case #1194114
- Fixed potential issues that could occur when upgrading to version 1.5.0-preview.2 or newer of the TMP package without also updating the TMP Essential Resources in the project.
- Added check and warning when trying to create a font asset whose source font file has "Incl. Font Data" disabled in the Font Import Settings. Case #1198587 and #1198112
- Fixed Ellipsis overflow mode issue when using small caps. Case #1198392
- Fixed potential layout issue when adding a Layout Group to the text object itself. Case #1197614
- Fixed Font Asset Creator issue where too many adjustment records with adjustment value of zero were added to the font asset.
- Added support for Line Separator \u2028 and Paragraph Separator \u2029.
- TMP shaders have been moved from "TextMesh Pro/Resources/Shaders" folder to "TextMesh Pro/Shaders" folder. See the following [post](https://forum.unity.com/threads/version-1-5-0-2-1-0-preview-2-now-available-for-testing.753587/#post-5206853) for details.
- Added new experimental SDF and Mobile SDF Shaders that use Screen Space Derivatives (SSD) where these shaders no longer require SDF Scale to be passed via Vertex Attributes. These shaders have higher performance overhead but are more flexible. This overhead should only be noticeable on mobile platforms.
- Fixed potential text alignment issue where upgrading from package version 1.4.1 to 1.5.0-preview.2 would result in incorrect alignment on prefabs. Case #1198833
- Added \u061C Arabic Letter Mark, \u200E Left-to-Right Mark and \u200F Right-to-Left Mark to list of control and non renderable characters.
- Fixed Missing Reference Exception that would appear when expanding the Extra Settings of a TextMeshPro Preset asset. Case #1201072
- Fixed Missing Reference Exception that would appear when editing the Vertex Color or Color Gradient of a TMP component Preset asset. Case #1201069
- Fixed Inspector layout issue preventing enabling or disabling the Outline, Underlay, Lighting and Glow features when selecting a Preset asset material. Case #1196963
- Revised the Create Material Preset context menu option to issue a warning and ignore materials outside the project. Case #1200109
- Added experimental ITextPreprocessor interface to allow users to create custom components to handle text preprocessing and shaping. This interface includes a PreprocessText(string text) function that is called when the object contains a component that inherits from this interface.
- Added support for Unity Presets in the Editor for both <TextMeshPro> and <TextMeshProUGUI> components. Case #1191793
- Optimization to ensure the TMP Update Manager only rebuilds text objects once per frame regardless of the number of cameras in the scene.
  • Loading branch information
Unity Technologies committed Dec 15, 2019
1 parent 07f5e3a commit 1185c75
Show file tree
Hide file tree
Showing 25 changed files with 494 additions and 171 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
# 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

## [1.5.0-preview.3] - 2019-12-16
## [2.1.0-preview.3]
### Changes
- Fixed potential issue with TMP Dropdown where calling Show() and Hide() in very short interval could result in additional Blockers. Case #1194114
- Fixed potential issues that could occur when upgrading to version 1.5.0-preview.2 or newer of the TMP package without also updating the TMP Essential Resources in the project.
- Added check and warning when trying to create a font asset whose source font file has "Incl. Font Data" disabled in the Font Import Settings. Case #1198587 and #1198112
- Fixed Ellipsis overflow mode issue when using small caps. Case #1198392
- Fixed potential layout issue when adding a Layout Group to the text object itself. Case #1197614
- Fixed Font Asset Creator issue where too many adjustment records with adjustment value of zero were added to the font asset.
- Added support for Line Separator \u2028 and Paragraph Separator \u2029.
- TMP shaders have been moved from "TextMesh Pro/Resources/Shaders" folder to "TextMesh Pro/Shaders" folder. See the following [post](https://forum.unity.com/threads/version-1-5-0-2-1-0-preview-2-now-available-for-testing.753587/#post-5206853) for details.
- Added new experimental SDF and Mobile SDF Shaders that use Screen Space Derivatives (SSD) where these shaders no longer require SDF Scale to be passed via Vertex Attributes. These shaders have higher performance overhead but are more flexible. This overhead should only be noticeable on mobile platforms.
- Fixed potential text alignment issue where upgrading from package version 1.4.1 to 1.5.0-preview.2 would result in incorrect alignment on prefabs. Case #1198833
- Added \u061C Arabic Letter Mark, \u200E Left-to-Right Mark and \u200F Right-to-Left Mark to list of control and non renderable characters.
- Fixed Missing Reference Exception that would appear when expanding the Extra Settings of a TextMeshPro Preset asset. Case #1201072
- Fixed Missing Reference Exception that would appear when editing the Vertex Color or Color Gradient of a TMP component Preset asset. Case #1201069
- Fixed Inspector layout issue preventing enabling or disabling the Outline, Underlay, Lighting and Glow features when selecting a Preset asset material. Case #1196963
- Revised the Create Material Preset context menu option to issue a warning and ignore materials outside the project. Case #1200109
- Added experimental ITextPreprocessor interface to allow users to create custom components to handle text preprocessing and shaping. This interface includes a PreprocessText(string text) function that is called when the object contains a component that inherits from this interface.
- Added support for Unity Presets in the Editor for both <TextMeshPro> and <TextMeshProUGUI> components. Case #1191793
- Optimization to ensure the TMP Update Manager only rebuilds text objects once per frame regardless of the number of cameras in the scene.

## [1.5.0-preview.2] - 2019-10-30
## [2.1.0-preview.2]
### Changes
Expand Down
Binary file modified Package Resources/TMP Essential Resources.unitypackage
Binary file not shown.
Binary file modified Package Resources/TMP Examples & Extras.unitypackage
Binary file not shown.
4 changes: 3 additions & 1 deletion Scripts/Editor/TMP_BaseEditorPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ protected void DrawTextInput()
Rect rect = EditorGUILayout.GetControlRect(false, 22);
GUI.Label(rect, new GUIContent("<b>Text Input</b>"), TMP_UIStyleManager.sectionHeader);

EditorGUI.indentLevel = 0;

// If the text component is linked, disable the text input box.
if (m_ParentLinkedTextComponentProp.objectReferenceValue != null)
{
Expand Down Expand Up @@ -425,7 +427,7 @@ protected void DrawTextInput()
}
}

// Toggle showing Rich Tags
// Toggle showing RTL mode
float labelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 110f;
m_IsRightToLeftProp.boolValue = EditorGUI.Toggle(new Rect(rect.width - 120, rect.y + 3, 130, 20), k_RtlToggleLabel, m_IsRightToLeftProp.boolValue);
Expand Down
5 changes: 4 additions & 1 deletion Scripts/Editor/TMP_BaseShaderGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro

protected bool BeginPanel(string panel, bool expanded)
{
EditorGUI.indentLevel = 0;

EditorGUILayout.BeginVertical(EditorStyles.helpBox);

Rect r = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(20, 18));
r.x += 20;
r.width += 6;
Expand All @@ -197,6 +198,8 @@ protected bool BeginPanel(string panel, bool expanded)

protected bool BeginPanel(string panel, ShaderFeature feature, bool expanded, bool readState = true)
{
EditorGUI.indentLevel = 0;

if (readState)
{
feature.ReadState(m_Material);
Expand Down
15 changes: 11 additions & 4 deletions Scripts/Editor/TMP_FontAsset_CreationMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,22 @@ public static void CreateFontAsset()

string newAssetFilePathWithName = AssetDatabase.GenerateUniqueAssetPath(folderPath + "/" + assetName + " SDF.asset");

//// Create new TM Font Asset.
// Initialize FontEngine
FontEngine.InitializeFontEngine();

// Load Font Face
if (FontEngine.LoadFontFace(sourceFont, 90) != FontEngineError.Success)
{
Debug.LogWarning("Unable to load font face for [" + sourceFont.name + "]. Make sure \"Include Font Data\" is enabled in the Font Import Settings.", sourceFont);
return;
}

// Create new Font Asset
TMP_FontAsset fontAsset = ScriptableObject.CreateInstance<TMP_FontAsset>();
AssetDatabase.CreateAsset(fontAsset, newAssetFilePathWithName);

fontAsset.version = "1.1.0";

// Set face information
FontEngine.InitializeFontEngine();
FontEngine.LoadFontFace(sourceFont, 90);
fontAsset.faceInfo = FontEngine.GetFaceInfo();

// Set font reference and GUID
Expand Down
53 changes: 52 additions & 1 deletion Scripts/Editor/TMP_PackageUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AssetConversionData

public class TMP_ProjectConversionUtility : EditorWindow
{
// Create Sprite Asset Editor Window
// Create Project Files GUID Remapping Tool window
[MenuItem("Window/TextMeshPro/Project Files GUID Remapping Tool", false, 2100)]
static void ShowConverterWindow()
{
Expand Down Expand Up @@ -461,6 +461,57 @@ private static bool CheckProjectSerializationAndSourceControlModes()
}


/*
public class TMP_ShaderRemappingTool : EditorWindow
{
// Create Shader Reference Upgrade Tool window
[MenuItem("Window/TextMeshPro/Shader Reference Remapping Tool", false, 2110)]
static void ShowShaderUpgradeWindow()
{
var window = GetWindow<TMP_ShaderRemappingTool>();
window.titleContent = new GUIContent("Shader Upgrade Tool");
window.Focus();
}
private static string k_ProjectMaterialScanReportDefaultText = "<color=#FFFF80><b>Project Scan Results</b></color>\n";
private static string m_ProjectMaterialScanResults = string.Empty;
void OnEnable()
{
// Set Editor Window Size
SetEditorWindowSize();
m_ProjectMaterialScanResults = k_ProjectMaterialScanReportDefaultText;
}
private void OnGUI()
{
}
void OnInspectorUpdate()
{
Repaint();
}
/// <summary>
/// Limits the minimum size of the editor window.
/// </summary>
void SetEditorWindowSize()
{
EditorWindow editorWindow = this;
Vector2 currentWindowSize = editorWindow.minSize;
editorWindow.minSize = new Vector2(Mathf.Max(640, currentWindowSize.x), Mathf.Max(420, currentWindowSize.y));
}
}
*/


public class TMP_PackageUtilities : Editor
{
Expand Down
18 changes: 10 additions & 8 deletions Scripts/Editor/TMPro_ContextMenus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ static void DuplicateMaterial(MenuCommand command)
Material source_Mat = (Material)command.context;
if (!EditorUtility.IsPersistent(source_Mat))
{
Debug.LogWarning("Material is an instance and cannot be converted into a permanent asset.");
Debug.LogWarning("Material is an instance and cannot be converted into a persistent asset.");
return;
}

string assetPath = AssetDatabase.GetAssetPath(source_Mat).Split('.')[0];

string assetPath = AssetDatabase.GetAssetPath(source_Mat).Split('.')[0];

if (assetPath.IndexOf("Assets/", System.StringComparison.InvariantCultureIgnoreCase) == -1)
{
Debug.LogWarning("Material Preset cannot be created from a material that is located outside the project.");
return;
}

Material duplicate = new Material(source_Mat);

// Need to manually copy the shader keywords
Expand Down Expand Up @@ -93,7 +98,7 @@ static void DuplicateMaterial(MenuCommand command)
}


//[MenuItem("CONTEXT/MaterialComponent/Copy Material Properties", false)]
// COPY MATERIAL PROPERTIES
[MenuItem("CONTEXT/Material/Copy Material Properties", false)]
static void CopyMaterialProperties(MenuCommand command)
{
Expand All @@ -118,7 +123,6 @@ static void CopyMaterialProperties(MenuCommand command)
[MenuItem("CONTEXT/Material/Paste Material Properties", false)]
static void PasteMaterialProperties(MenuCommand command)
{

if (m_copiedProperties == null)
{
Debug.LogWarning("No Material Properties to Paste. Use Copy Material Properties first.");
Expand Down Expand Up @@ -159,7 +163,6 @@ static void PasteMaterialProperties(MenuCommand command)
[MenuItem("CONTEXT/Material/Reset", false, 2100)]
static void ResetSettings(MenuCommand command)
{

Material mat = null;
if (command.context.GetType() == typeof(Material))
mat = (Material)command.context;
Expand Down Expand Up @@ -221,7 +224,6 @@ static void ResetSettings(MenuCommand command)
}



//This function is used for debugging and fixing potentially broken font atlas links.
[MenuItem("CONTEXT/Material/Copy Atlas", false, 2000)]
static void CopyAtlas(MenuCommand command)
Expand Down Expand Up @@ -320,7 +322,7 @@ static void ForceFontAssetUpgrade(MenuCommand command)


/// <summary>
/// Clear Font Asset Data
/// Clear Dynamic Font Asset data such as glyph, character and font features.
/// </summary>
/// <param name="command"></param>
[MenuItem("CONTEXT/TMP_FontAsset/Reset", false, 100)]
Expand Down
53 changes: 44 additions & 9 deletions Scripts/Editor/TMPro_CreateObjectMenu.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using UnityEngine;
using UnityEditor;
using UnityEditor.Presets;
using UnityEditor.SceneManagement;
using UnityEditor.Experimental.SceneManagement;
using UnityEngine.SceneManagement;
Expand All @@ -19,18 +20,34 @@ public static class TMPro_CreateObjectMenu
[MenuItem("GameObject/3D Object/Text - TextMeshPro", false, 30)]
static void CreateTextMeshProObjectPerform(MenuCommand command)
{
GameObject go = new GameObject("Text (TMP)");
GameObject go = ObjectFactory.CreateGameObject("Text (TMP)");

// Add support for new prefab mode
StageUtility.PlaceGameObjectInCurrentStage(go);

TextMeshPro textMeshPro = go.AddComponent<TextMeshPro>();
textMeshPro.text = "Sample text";
textMeshPro.alignment = TextAlignmentOptions.TopLeft;
TextMeshPro textComponent = ObjectFactory.AddComponent<TextMeshPro>(go);


if (textComponent.m_isWaitingOnResourceLoad == false)
{
// Apply TMP Settings Defaults if no Preset is defined
if (Preset.GetDefaultForObject(textComponent) == null)
{
textComponent.text = "Sample text";
textComponent.alignment = TextAlignmentOptions.TopLeft;
}

if (TMP_Settings.autoSizeTextContainer)
{
Vector2 size = textComponent.GetPreferredValues(TMP_Math.FLOAT_MAX, TMP_Math.FLOAT_MAX);
textComponent.rectTransform.sizeDelta = size;
}
else
{
textComponent.rectTransform.sizeDelta = TMP_Settings.defaultTextMeshProTextContainerSize;
}
}

Undo.RegisterCreatedObjectUndo((Object)go, "Create " + go.name);
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);

GameObject contextObject = command.context as GameObject;
if (contextObject != null)
Expand All @@ -53,10 +70,28 @@ static void CreateTextMeshProGuiObjectPerform(MenuCommand menuCommand)
GameObject go = TMP_DefaultControls.CreateText(GetStandardResources());

// Override text color and font size
TMP_Text textComponent = go.GetComponent<TMP_Text>();
textComponent.color = Color.white;
TextMeshProUGUI textComponent = go.GetComponent<TextMeshProUGUI>();

if (textComponent.m_isWaitingOnResourceLoad == false)
textComponent.fontSize = TMP_Settings.defaultFontSize;
{
// Apply TMP Settings Defaults if no Preset is defined
if (Preset.GetDefaultForObject(textComponent) == null)
{
textComponent.fontSize = TMP_Settings.defaultFontSize;
textComponent.color = Color.white;
textComponent.text = "New Text";
}

if (TMP_Settings.autoSizeTextContainer)
{
Vector2 size = textComponent.GetPreferredValues(TMP_Math.FLOAT_MAX, TMP_Math.FLOAT_MAX);
textComponent.rectTransform.sizeDelta = size;
}
else
{
textComponent.rectTransform.sizeDelta = TMP_Settings.defaultTextMeshProUITextContainerSize;
}
}

PlaceUIElementRoot(go, menuCommand);
}
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Editor/TMPro_FontAssetCreatorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ public TMP_FontFeatureTable GetKerningTable()

TMP_FontFeatureTable fontFeatureTable = new TMP_FontFeatureTable();

for (int i = 0; i < adjustmentRecords.Length; i++)
for (int i = 0; i < adjustmentRecords.Length && adjustmentRecords[i].firstAdjustmentRecord.glyphIndex != 0; i++)
{
fontFeatureTable.glyphPairAdjustmentRecords.Add(new TMP_GlyphPairAdjustmentRecord(adjustmentRecords[i]));
}
Expand Down
17 changes: 17 additions & 0 deletions Scripts/Runtime/ITextPreProcessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


namespace TMPro
{
/// <summary>
/// Interface used for preprocessing and shaping of text.
/// </summary>
public interface ITextPreprocessor
{
/// <summary>
/// Function used for preprocessing of text
/// </summary>
/// <param name="text">Source text to be processed</param>
/// <returns>Processed text</returns>
string PreprocessText(string text);
}
}
11 changes: 11 additions & 0 deletions Scripts/Runtime/ITextPreProcessor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 17 additions & 5 deletions Scripts/Runtime/TMP_DefaultControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
using System.Collections;
using UnityEngine.UI;

#if UNITY_EDITOR
using UnityEditor;
#endif


namespace TMPro
{
Expand Down Expand Up @@ -148,11 +152,19 @@ public static GameObject CreateButton(Resources resources)

public static GameObject CreateText(Resources resources)
{
GameObject go = CreateUIElementRoot("Text (TMP)", s_TextElementSize);

TextMeshProUGUI lbl = go.AddComponent<TextMeshProUGUI>();
lbl.text = "New Text";
SetDefaultTextValues(lbl);
GameObject go = null;
#if UNITY_EDITOR
go = ObjectFactory.CreateGameObject("Text (TMP)");
#else
go = CreateUIElementRoot("Text (TMP)", s_TextElementSize);
#endif

TextMeshProUGUI textComponent = null;
#if UNITY_EDITOR
textComponent = ObjectFactory.AddComponent<TextMeshProUGUI>(go);
#else
textComponent = go.AddComponent<TextMeshProUGUI>();
#endif

return go;
}
Expand Down
Loading

0 comments on commit 1185c75

Please sign in to comment.