Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.6.0-preview.1] - 2021-08-06
## [2.2.0-preview.1]
## [3.2.0-pre.1]
### Changes
- Added support for manually defining Diacritical Mark-to-Base and Mark-to-Mark glyph positional adjustments in font assets.
- Updated the font asset editor to include new Mark-to-Base and Mark-to-Mark adjustment tables along with new Preview window to make it easier to edit adjustment records.
- Added OnMissingCharacter event delegate called when the requested Unicode character is missing from the font asset.
- Fixed Argument Null Exception when attempting to create a font asset via the Create Context menu prior to importing the TMP Essential Resources. Case #1290444
- Changes to Sorting Layer ID and Sorting Order of <TextMeshPro> will now be reflected on any potential sub text objects.
- Replaced Word Wrapping in the text component inspector by Text Wrapping Mode to introduce new text wrapping options that control whether whitespaces are preserved or ignored at the end of a line.
- Input Field OnSubmit event will no longer be invoked on focus change or edit cancellation. OnEndEdit will continue to be invoked on submit, focus change or cancellation of edit.
- Added support for <SHY> tag which is replaced internally by a soft hyphen or \u00AD.
- Fixed potential text parsing issue when using markup tags without using quotes to encapsulate their values or attribute values. Case #1316658.
- Revised the textInfo property to return a new TMP_TextInfo instance instead of null when the text component has not yet been awaken. Case #1318194.
- Added new property to TMP Settings to control whether or not sub text objects will be visible in the scene hierarchy.
- Added new "Clear Dynamic Data On Build" property to TMP Settings which determines if the "clearDynamicDataOnBuild" font asset property will be set to true or false on newly created dynamic font assets.
- Added fallback character lookup caching to improve subsequent lookups of these characters coming from font assets assigned as local or global fallbacks.
- Added support for Dynamic OS Font Assets. This new dynamic font asset type will enable users to use fonts present on target platforms and devices. See the following video for more details.
- Fixed issue where the <mark> tag color may be incorrect based on line breaking location. See [forum post](https://forum.unity.com/threads/rich-text-tags-dont-apply-to-space-characters-is-there-a-way.1103887/) for details.
- Fixed glyph positional adjustment (kerning) incorrectly being applied to some characters at the end of a line.
- Fixed incorrect text alignment when using <cspace> tag. Case 1333571
- Fixed potential NullReferenceException in TMP Input Field in SendTouchScreenKeyboardStatusChanged(). See [forum post](https://forum.unity.com/threads/nullreferenceexception-at-tmpro-tmp_inputfield-sendtouchscreenkeyboardstatuschanged.1109678/) for details.
- Obsoleted the SetText(string, bool) function since the text in the Text Input Box is always synced now. Re-added the SetText(string) function. See [forum post](https://forum.unity.com/threads/updating-unity-broke-tmpro.1110794/#post-7183375) for details.
- Revised GetPreferredValues(string, float, float) where it will now return the width of the longest line of text given the width restrictions. See [forum post](https://forum.unity.com/threads/question-on-getpreferredvalues-and-text-wrapping.564970/#post-7189120) for details.
- Fixed GetPreferredValues() potentially returning incorrect values. See [forum post](https://forum.unity.com/threads/question-on-getpreferredvalues-and-text-wrapping.564970/#post-7189120) for details.
- Fixed potential sub text object shader mismatch when changing the shader of the text object.
- Added isAlert property to the TMP Input Field to control if the TouchScreenKeyboard is opened in alert mode. See [forum post](https://forum.unity.com/threads/tmp_inputfield-dark-keyboard-option.698900/#post-7126367) for details.
- Added new property "shouldActivateOnSelect" to the TMP Input Field which determines if the input field will be activated automatically when selected.
- Fixed potential text rendering issue due to incorrect "Additional Shader Channels" when using nested canvases. Case #1337742
- Newly created sprite assets will now be given a unique name to prevent potential AssetDatabase issue. Case #1345123
- Fixed potential IndexOutOfRangeException in the Input Field when the text height exceeds the height of the Text Area in conjunction with using text overflow mode Ellipsis or Truncate. Case #1341172
- Fixed <mark> tag not rendering correctly when using one of the SSD shaders. See [forum post](https://forum.unity.com/threads/mobile-tmpro-support-for-mark-mark.1132414/#post-7335727) for details.
- Fixed potential culling issue that was resulting in the culling being delayed by one frame. Case #1335854
- Vertex colors of the <TextMeshPro> component will be converted to linear space when Project Settings are set to Linear color space. Case #1349920
- Fixed potential TouchScreenKeyboard handling issue in the TMP Input Field with UWP. Case #1337129
- Revised handling of <CR><LF> in the Input Field text where these characters will be treated as one when using Left, Right, Backspace and Del keys when "Allow Rich Text Editing" property is disabled. See [forum post](https://forum.unity.com/threads/pasted-r-n-arent-removed-and-break-input-fields.1139056/#post-7397879) for details.
- Added new property "keepTextSelectionVisible" to the Input Field which maintains the text selection visible when selecting other Input Fields or UI Elements. See [forum post](https://forum.unity.com/threads/input-field-selection-disappear-when-another-ui-item-is-activated.1145375/) for details.
- Fixed potential Input Field text area viewport vertical alignment issue when using a vertical scrollbar and when the child text object's vertical margins are not zero. Case #1353535
- Revised handling of SDF Scale updates where the SDF Scale will now only be updated when the lossy scale of the text object changes by more than 20%. Case #1352120
  • Loading branch information
Unity Technologies committed Aug 6, 2021
1 parent 5b1ab98 commit 90108f3
Show file tree
Hide file tree
Showing 72 changed files with 4,475 additions and 1,167 deletions.
42 changes: 41 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,46 @@
# 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.6.0-preview.1] - 2021-08-06
## [2.2.0-preview.1]
## [3.2.0-pre.1]
### Changes
- Added support for manually defining Diacritical Mark-to-Base and Mark-to-Mark glyph positional adjustments in font assets.
- Updated the font asset editor to include new Mark-to-Base and Mark-to-Mark adjustment tables along with new Preview window to make it easier to edit adjustment records.
- Added OnMissingCharacter event delegate called when the requested Unicode character is missing from the font asset.
- Fixed Argument Null Exception when attempting to create a font asset via the Create Context menu prior to importing the TMP Essential Resources. Case #1290444
- Changes to Sorting Layer ID and Sorting Order of <TextMeshPro> will now be reflected on any potential sub text objects.
- Replaced Word Wrapping in the text component inspector by Text Wrapping Mode to introduce new text wrapping options that control whether whitespaces are preserved or ignored at the end of a line.
- Input Field OnSubmit event will no longer be invoked on focus change or edit cancellation. OnEndEdit will continue to be invoked on submit, focus change or cancellation of edit.
- Added support for <SHY> tag which is replaced internally by a soft hyphen or \u00AD.
- Fixed potential text parsing issue when using markup tags without using quotes to encapsulate their values or attribute values. Case #1316658.
- Revised the textInfo property to return a new TMP_TextInfo instance instead of null when the text component has not yet been awaken. Case #1318194.
- Added new property to TMP Settings to control whether or not sub text objects will be visible in the scene hierarchy.
- Added new "Clear Dynamic Data On Build" property to TMP Settings which determines if the "clearDynamicDataOnBuild" font asset property will be set to true or false on newly created dynamic font assets.
- Added fallback character lookup caching to improve subsequent lookups of these characters coming from font assets assigned as local or global fallbacks.
- Added support for Dynamic OS Font Assets. This new dynamic font asset type will enable users to use fonts present on target platforms and devices. See the following video for more details.
- Fixed issue where the <mark> tag color may be incorrect based on line breaking location. See [forum post](https://forum.unity.com/threads/rich-text-tags-dont-apply-to-space-characters-is-there-a-way.1103887/) for details.
- Fixed glyph positional adjustment (kerning) incorrectly being applied to some characters at the end of a line.
- Fixed incorrect text alignment when using <cspace> tag. Case 1333571
- Fixed potential NullReferenceException in TMP Input Field in SendTouchScreenKeyboardStatusChanged(). See [forum post](https://forum.unity.com/threads/nullreferenceexception-at-tmpro-tmp_inputfield-sendtouchscreenkeyboardstatuschanged.1109678/) for details.
- Obsoleted the SetText(string, bool) function since the text in the Text Input Box is always synced now. Re-added the SetText(string) function. See [forum post](https://forum.unity.com/threads/updating-unity-broke-tmpro.1110794/#post-7183375) for details.
- Revised GetPreferredValues(string, float, float) where it will now return the width of the longest line of text given the width restrictions. See [forum post](https://forum.unity.com/threads/question-on-getpreferredvalues-and-text-wrapping.564970/#post-7189120) for details.
- Fixed GetPreferredValues() potentially returning incorrect values. See [forum post](https://forum.unity.com/threads/question-on-getpreferredvalues-and-text-wrapping.564970/#post-7189120) for details.
- Fixed potential sub text object shader mismatch when changing the shader of the text object.
- Added isAlert property to the TMP Input Field to control if the TouchScreenKeyboard is opened in alert mode. See [forum post](https://forum.unity.com/threads/tmp_inputfield-dark-keyboard-option.698900/#post-7126367) for details.
- Added new property "shouldActivateOnSelect" to the TMP Input Field which determines if the input field will be activated automatically when selected.
- Fixed potential text rendering issue due to incorrect "Additional Shader Channels" when using nested canvases. Case #1337742
- Newly created sprite assets will now be given a unique name to prevent potential AssetDatabase issue. Case #1345123
- Fixed potential IndexOutOfRangeException in the Input Field when the text height exceeds the height of the Text Area in conjunction with using text overflow mode Ellipsis or Truncate. Case #1341172
- Fixed <mark> tag not rendering correctly when using one of the SSD shaders. See [forum post](https://forum.unity.com/threads/mobile-tmpro-support-for-mark-mark.1132414/#post-7335727) for details.
- Fixed potential culling issue that was resulting in the culling being delayed by one frame. Case #1335854
- Vertex colors of the <TextMeshPro> component will be converted to linear space when Project Settings are set to Linear color space. Case #1349920
- Fixed potential TouchScreenKeyboard handling issue in the TMP Input Field with UWP. Case #1337129
- Revised handling of <CR><LF> in the Input Field text where these characters will be treated as one when using Left, Right, Backspace and Del keys when "Allow Rich Text Editing" property is disabled. See [forum post](https://forum.unity.com/threads/pasted-r-n-arent-removed-and-break-input-fields.1139056/#post-7397879) for details.
- Added new property "keepTextSelectionVisible" to the Input Field which maintains the text selection visible when selecting other Input Fields or UI Elements. See [forum post](https://forum.unity.com/threads/input-field-selection-disappear-when-another-ui-item-is-activated.1145375/) for details.
- Fixed potential Input Field text area viewport vertical alignment issue when using a vertical scrollbar and when the child text object's vertical margins are not zero. Case #1353535
- Revised handling of SDF Scale updates where the SDF Scale will now only be updated when the lossy scale of the text object changes by more than 20%. Case #1352120

## [1.5.6] - 2021-04-23
## [2.1.6]
## [3.0.6]
Expand All @@ -19,7 +59,7 @@ These are the release notes for the TextMesh Pro UPM package which was first int
- Fixed text rendering issue due to incorrectly SDF scaling when using a CanvasScaler and resizing the game view.
- Fixed TextMeshPro component Sorting Layer field in the Inspector's Extra Settings not showing the correct layer. Case #1326985

## [1.5.4] - 2021-02-19
## [3.0.4] - 2021-02-19
## [2.1.4]
## [3.0.4]
### 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.
Binary file added Package Resources/TMP Shaders.unitypackage
Binary file not shown.

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

2 changes: 1 addition & 1 deletion Scripts/Editor/GlyphMetricsPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace TMPro.EditorUtilities
{

[CustomPropertyDrawer(typeof(GlyphMetrics))]
public class GlyphMetricsPropertyDrawer : PropertyDrawer
internal class GlyphMetricsPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
Expand Down
11 changes: 5 additions & 6 deletions Scripts/Editor/TMP_BaseEditorPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class TMP_BaseEditorPanel : Editor
static readonly GUIContent k_LineSpacingLabel = new GUIContent("Line");
static readonly GUIContent k_ParagraphSpacingLabel = new GUIContent("Paragraph");

static readonly GUIContent k_AlignmentLabel = new GUIContent("Alignment", "Horizontal and vertical aligment of the text within its container.");
static readonly GUIContent k_AlignmentLabel = new GUIContent("Alignment", "Horizontal and vertical alignment of the text within its container.");
static readonly GUIContent k_WrapMixLabel = new GUIContent("Wrap Mix (W <-> C)", "How much to favor words versus characters when distributing the text.");

static readonly GUIContent k_WrappingLabel = new GUIContent("Wrapping", "Wraps text to the next line when reaching the edge of the container.");
Expand Down Expand Up @@ -140,7 +140,7 @@ protected struct Foldout
protected SerializedProperty m_VerticalMappingProp;
protected SerializedProperty m_UvLineOffsetProp;

protected SerializedProperty m_EnableWordWrappingProp;
protected SerializedProperty m_TextWrappingModeProp;
protected SerializedProperty m_WordWrappingRatiosProp;
protected SerializedProperty m_TextOverflowModeProp;
protected SerializedProperty m_PageToDisplayProp;
Expand Down Expand Up @@ -219,7 +219,7 @@ protected virtual void OnEnable()
m_VerticalMappingProp = serializedObject.FindProperty("m_verticalMapping");
m_UvLineOffsetProp = serializedObject.FindProperty("m_uvLineOffset");

m_EnableWordWrappingProp = serializedObject.FindProperty("m_enableWordWrapping");
m_TextWrappingModeProp = serializedObject.FindProperty("m_TextWrappingMode");
m_WordWrappingRatiosProp = serializedObject.FindProperty("m_wordWrappingRatios");
m_TextOverflowModeProp = serializedObject.FindProperty("m_overflowMode");
m_PageToDisplayProp = serializedObject.FindProperty("m_pageToDisplay");
Expand Down Expand Up @@ -993,13 +993,12 @@ void DrawWrappingOverflow()
{
// TEXT WRAPPING
Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
EditorGUI.BeginProperty(rect, k_WrappingLabel, m_EnableWordWrappingProp);
EditorGUI.BeginProperty(rect, k_WrappingLabel, m_TextWrappingModeProp);

EditorGUI.BeginChangeCheck();
int wrapSelection = EditorGUI.Popup(rect, k_WrappingLabel, m_EnableWordWrappingProp.boolValue ? 1 : 0, k_WrappingOptions);
EditorGUI.PropertyField(rect, m_TextWrappingModeProp);
if (EditorGUI.EndChangeCheck())
{
m_EnableWordWrappingProp.boolValue = wrapSelection == 1;
m_HavePropertiesChanged = true;
}

Expand Down
77 changes: 61 additions & 16 deletions Scripts/Editor/TMP_BaseShaderGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static TMP_BaseShaderGUI()
protected MaterialEditor m_Editor;

protected Material m_Material;
private int m_ShaderID;

protected MaterialProperty[] m_Properties;

Expand All @@ -141,7 +142,7 @@ void PrepareGUI()
{
// There's been at least one undo/redo since the last time this GUI got constructed.
// Maybe the undo/redo was for this material? Assume that is was.
TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_Material as Material);
TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_Material);
}

s_LastSeenUndoRedoCount = s_UndoRedoCount;
Expand All @@ -154,9 +155,7 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro
this.m_Properties = properties;

if (m_IsNewGUI)
{
PrepareGUI();
}

DoDragAndDropBegin();
EditorGUI.BeginChangeCheck();
Expand All @@ -169,6 +168,13 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro
DoDragAndDropEnd();
}

public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
{
base.AssignNewShaderToMaterial(material, oldShader, newShader);

TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, material);
}

/// <summary>Override this method to create the specific shader GUI.</summary>
protected abstract void DoGUI();

Expand Down Expand Up @@ -331,7 +337,7 @@ void DoTilingOffset(Rect rect, MaterialProperty property)
float labelWidth = EditorGUIUtility.labelWidth;
int indentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
EditorGUIUtility.labelWidth = Mathf.Min(37f, rect.width * 0.40f);
EditorGUIUtility.labelWidth = Mathf.Min(40f, rect.width * 0.40f);

Vector4 vector = property.textureScaleAndOffset;

Expand Down Expand Up @@ -381,16 +387,25 @@ protected void DoUVSpeed(Rect rect, string[] names)
float labelWidth = EditorGUIUtility.labelWidth;
int indentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
EditorGUIUtility.labelWidth = Mathf.Min(37f, rect.width * 0.40f);
EditorGUIUtility.labelWidth = Mathf.Min(40f, rect.width * 0.40f);

s_TempLabel.text = "Speed";
rect = EditorGUI.PrefixLabel(rect, s_TempLabel);

EditorGUIUtility.labelWidth = 13f;
EditorGUIUtility.labelWidth = 10f;
rect.width = rect.width * 0.5f - 2f;
DoFloat(rect, names[0], "X");
rect.x += rect.width + 3f;
DoFloat(rect, names[1], "Y");

if (names.Length == 1)
{
DoFloat2(rect, names[0]);
}
else
{
DoFloat(rect, names[0], "X");
rect.x += rect.width + 4f;
DoFloat(rect, names[1], "Y");
}

EditorGUIUtility.labelWidth = labelWidth;
EditorGUI.indentLevel = indentLevel;
}
Expand Down Expand Up @@ -441,14 +456,26 @@ void DoFloat(Rect rect, string name, string label)
}
}

void DoFloat2(Rect rect, string name)
{
MaterialProperty property = BeginProperty(name);

float x = EditorGUI.FloatField(rect, "X", property.vectorValue.x);
rect.x += rect.width + 4f;
float y = EditorGUI.FloatField(rect, "Y", property.vectorValue.y);

if (EndProperty())
{
property.vectorValue = new Vector2(x, y);
}
}

protected void DoSlider(string name, string label)
{
MaterialProperty property = BeginProperty(name);
Vector2 range = property.rangeLimits;
s_TempLabel.text = label;
float value = EditorGUI.Slider(
EditorGUILayout.GetControlRect(), s_TempLabel, property.floatValue, range.x, range.y
);
float value = EditorGUI.Slider(EditorGUILayout.GetControlRect(), s_TempLabel, property.floatValue, range.x, range.y);
if (EndProperty())
{
property.floatValue = value;
Expand Down Expand Up @@ -492,6 +519,21 @@ protected void DoVector(string name, string label, GUIContent[] subLabels)
}
}

bool IsNewShader()
{
if (m_Material == null)
return false;

int currentShaderID = m_Material.shader.GetInstanceID();

if (m_ShaderID == currentShaderID)
return false;

m_ShaderID = currentShaderID;

return true;
}

void DoDragAndDropBegin()
{
m_DragAndDropMinY = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true)).y;
Expand All @@ -501,15 +543,13 @@ void DoDragAndDropEnd()
{
Rect rect = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));
Event evt = Event.current;

if (evt.type == EventType.DragUpdated)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
evt.Use();
}
else if (
evt.type == EventType.DragPerform &&
Rect.MinMaxRect(rect.xMin, m_DragAndDropMinY, rect.xMax, rect.yMax).Contains(evt.mousePosition)
)
else if (evt.type == EventType.DragPerform && Rect.MinMaxRect(rect.xMin, m_DragAndDropMinY, rect.xMax, rect.yMax).Contains(evt.mousePosition))
{
DragAndDrop.AcceptDrag();
evt.Use();
Expand All @@ -519,6 +559,11 @@ void DoDragAndDropEnd()
PerformDrop(droppedMaterial);
}
}
else if (evt.type == EventType.DragExited)
{
if (IsNewShader())
TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_Material);
}
}

void PerformDrop(Material droppedMaterial)
Expand Down
Loading

0 comments on commit 90108f3

Please sign in to comment.