Skip to content

Commit

Permalink
com.unity.textmeshpro@3.2.0-pre.10
Browse files Browse the repository at this point in the history
## [3.2.0-pre.10] - 2024-05-27
### Changes
- Ensure space and underline are always added to Static FontAsset. (UUM-45512)
- Fix bug that occurs with the Input Field, resulting in an incorrect cursor position when modifying long text input. (UUM-58685)
- Fixed compile error on TMP_PostBuildProcessorHandler.cs when building for iOS with "install into source code (UUM-57710)
- Fixed opening style tag overflow and TextSettings upgrade (UUM-30205)
- Fixed crash occurring in the FontAssetCreatorWindow. (UUM-66950)
- Fixed incorrect handling of Emoji Presentation forms ensuring emojis such as ©️ are displayed in text form, whereas 🚀 is displayed in its color presentation form.
- Added support for Emoji Variant Selectors u+FE0E and u+FE0F to control whether an emoji is displayed in text or presentation form: GitHub PR #48504
  • Loading branch information
Unity Technologies committed May 27, 2024
1 parent 2899fea commit 053c344
Show file tree
Hide file tree
Showing 21 changed files with 220 additions and 86 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# 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

## [3.2.0-pre.10] - 2024-05-27
### Changes
- Ensure space and underline are always added to Static FontAsset. (UUM-45512)
- Fix bug that occurs with the Input Field, resulting in an incorrect cursor position when modifying long text input. (UUM-58685)
- Fixed compile error on TMP_PostBuildProcessorHandler.cs when building for iOS with "install into source code (UUM-57710)
- Fixed opening style tag overflow and TextSettings upgrade (UUM-30205)
- Fixed crash occurring in the FontAssetCreatorWindow. (UUM-66950)
- Fixed incorrect handling of Emoji Presentation forms ensuring emojis such as ©️ are displayed in text form, whereas 🚀 is displayed in its color presentation form.
- Added support for Emoji Variant Selectors u+FE0E and u+FE0F to control whether an emoji is displayed in text or presentation form: GitHub PR #48504

## [3.2.0-pre.9] - 2024-02-20
### Changes
- Fix Incorrect cursor placement when selecting text and typing if text is center-aligned.
Expand Down
Binary file modified Package Resources/TMP Essential Resources.unitypackage
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
if (elementIndex != -1)
{
// Get a reference to the Sprite Glyph Table
SerializedProperty prop_SpriteGlyphTable = property.serializedObject.FindProperty("m_SpriteGlyphTable");
SerializedProperty prop_SpriteGlyphTable = property.serializedObject.FindProperty("m_GlyphTable");

SerializedProperty prop_SpriteGlyph = prop_SpriteGlyphTable.GetArrayElementAtIndex(elementIndex);
SerializedProperty prop_GlyphMetrics = prop_SpriteGlyph.FindPropertyRelative("m_Metrics");
Expand Down
9 changes: 6 additions & 3 deletions Scripts/Editor/TMP_EditorResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,16 @@ void OnPreRenderCanvases()
}

#if UNITY_2023_3_OR_NEWER
void OnEndOfFrame(ScriptableRenderContext renderContext, List<Camera> cameras)
void OnEndOfFrame(ScriptableRenderContext renderContext, List<Camera> cameras)
{
DoPostRenderUpdates();
}
#else
void OnEndOfFrame(ScriptableRenderContext renderContext, Camera[] cameras)
#endif
void OnEndOfFrame(ScriptableRenderContext renderContext, Camera[] cameras)
{
DoPostRenderUpdates();
}
#endif

/// <summary>
/// Register resource for re-import.
Expand Down
22 changes: 22 additions & 0 deletions Scripts/Editor/TMP_FontAssetEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,15 @@ public override void OnInspectorGUI()
m_DisplayDestructiveChangeWarning = false;

// Update face info if sampling point size was changed.
#if UNITY_2023_3_OR_NEWER
if (m_GenerationSettings.pointSize != m_SamplingPointSize_prop.floatValue || m_FaceInfoDirty)
{
LoadFontFace((int)m_SamplingPointSize_prop.floatValue, m_FontFaceIndex_prop.intValue);
#else
if (m_GenerationSettings.pointSize != m_SamplingPointSize_prop.intValue || m_FaceInfoDirty)
{
LoadFontFace(m_SamplingPointSize_prop.intValue, m_FontFaceIndex_prop.intValue);
#endif
m_fontAsset.faceInfo = FontEngine.GetFaceInfo();
m_FaceInfoDirty = false;
}
Expand Down Expand Up @@ -1990,7 +1996,11 @@ string[] GetFontFaces()

string[] GetFontFaces(int faceIndex)
{
#if UNITY_2023_3_OR_NEWER
if (LoadFontFace((int)m_SamplingPointSize_prop.floatValue, faceIndex) == FontEngineError.Success)
#else
if (LoadFontFace(m_SamplingPointSize_prop.intValue, faceIndex) == FontEngineError.Success)
#endif
return FontEngine.GetFontFaces();

return k_InvalidFontFaces;
Expand Down Expand Up @@ -2042,7 +2052,11 @@ void SavedGenerationSettings()
{
m_GenerationSettings.faceIndex = m_FontFaceIndex_prop.intValue;
m_GenerationSettings.glyphRenderMode = (GlyphRenderMode)m_AtlasRenderMode_prop.intValue;
#if UNITY_2023_3_OR_NEWER
m_GenerationSettings.pointSize = (int)m_SamplingPointSize_prop.floatValue;
#else
m_GenerationSettings.pointSize = m_SamplingPointSize_prop.intValue;
#endif
m_GenerationSettings.padding = m_AtlasPadding_prop.intValue;
m_GenerationSettings.atlasWidth = m_AtlasWidth_prop.intValue;
m_GenerationSettings.atlasHeight = m_AtlasHeight_prop.intValue;
Expand All @@ -2052,7 +2066,11 @@ void RestoreGenerationSettings()
{
m_fontAsset.SourceFont_EditorRef = m_GenerationSettings.sourceFont;
m_FontFaceIndex_prop.intValue = m_GenerationSettings.faceIndex;
#if UNITY_2023_3_OR_NEWER
m_SamplingPointSize_prop.floatValue = m_GenerationSettings.pointSize;
#else
m_SamplingPointSize_prop.intValue = m_GenerationSettings.pointSize;
#endif
m_FontFaces = GetFontFaces();

m_AtlasRenderMode_prop.intValue = (int)m_GenerationSettings.glyphRenderMode;
Expand All @@ -2065,7 +2083,11 @@ void RestoreGenerationSettings()
void UpdateFontAssetCreationSettings()
{
m_fontAsset.m_CreationSettings.faceIndex = m_FontFaceIndex_prop.intValue;
#if UNITY_2023_3_OR_NEWER
m_fontAsset.m_CreationSettings.pointSize = (int)m_SamplingPointSize_prop.floatValue;
#else
m_fontAsset.m_CreationSettings.pointSize = m_SamplingPointSize_prop.intValue;
#endif
m_fontAsset.m_CreationSettings.renderMode = m_AtlasRenderMode_prop.intValue;
m_fontAsset.m_CreationSettings.padding = m_AtlasPadding_prop.intValue;
m_fontAsset.m_CreationSettings.atlasWidth = m_AtlasWidth_prop.intValue;
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Editor/TMP_FontAsset_CreationMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static void CreateFontAssetFromSelectedObject(Object target, GlyphRenderMode ren
AssetDatabase.AddObjectToAsset(mat, fontAsset);

// Add Font Asset Creation Settings
fontAsset.creationSettings = new FontAssetCreationSettings(fontAsset.m_SourceFontFileGUID, fontAsset.faceInfo.pointSize, 0, atlasPadding, 0, 1024, 1024, 7, string.Empty, (int)renderMode);
fontAsset.creationSettings = new FontAssetCreationSettings(fontAsset.m_SourceFontFileGUID, (int)fontAsset.faceInfo.pointSize, 0, atlasPadding, 0, 1024, 1024, 7, string.Empty, (int)renderMode);

// Not sure if this is still necessary in newer versions of Unity.
//EditorUtility.SetDirty(fontAsset);
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Editor/TMP_PackageUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,11 +1087,11 @@ private static void ImportCallback(string packageName)
{
// Restore backup of TMP Settings from byte[]
File.WriteAllBytes(k_SettingsFilePath, k_SettingsBackup);
AssetDatabase.Refresh();

TMP_Settings.instance.SetAssetVersion();
EditorUtility.SetDirty(TMP_Settings.instance);
AssetDatabase.SaveAssetIfDirty(TMP_Settings.instance);
AssetDatabase.Refresh();

AssetDatabase.importPackageCompleted -= ImportCallback;
}
Expand Down
16 changes: 12 additions & 4 deletions Scripts/Editor/TMP_SpriteAssetEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct UI_PanelState

int m_moveToIndex;
int m_selectedElement = -1;
bool m_isCharacterSelected = false;
bool m_isSpriteSelected = false;
int m_CurrentCharacterPage;
int m_CurrentGlyphPage;

Expand Down Expand Up @@ -257,7 +259,7 @@ public override void OnInspectorGUI()

EditorGUILayout.BeginVertical(EditorStyles.helpBox);
{
EditorGUI.BeginDisabledGroup(i != m_selectedElement);
EditorGUI.BeginDisabledGroup(i != m_selectedElement || !m_isCharacterSelected);
{
EditorGUILayout.PropertyField(spriteCharacterProperty);
}
Expand All @@ -275,16 +277,19 @@ public override void OnInspectorGUI()
if (m_selectedElement == i)
{
m_selectedElement = -1;
m_isCharacterSelected = false;
}
else
{
m_selectedElement = i;
m_isCharacterSelected = true;
m_isSpriteSelected = false;
GUIUtility.keyboardControl = 0;
}
}

// Draw & Handle Section Area
if (m_selectedElement == i)
if (m_selectedElement == i && m_isCharacterSelected)
{
// Draw selection highlight
TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
Expand Down Expand Up @@ -482,7 +487,7 @@ public override void OnInspectorGUI()

EditorGUILayout.BeginVertical(EditorStyles.helpBox);
{
EditorGUI.BeginDisabledGroup(i != m_selectedElement);
EditorGUI.BeginDisabledGroup(i != m_selectedElement || !m_isSpriteSelected);
{
EditorGUILayout.PropertyField(spriteGlyphProperty);
}
Expand All @@ -500,16 +505,19 @@ public override void OnInspectorGUI()
if (m_selectedElement == i)
{
m_selectedElement = -1;
m_isSpriteSelected = false;
}
else
{
m_selectedElement = i;
m_isCharacterSelected = false;
m_isSpriteSelected = true;
GUIUtility.keyboardControl = 0;
}
}

// Draw & Handle Section Area
if (m_selectedElement == i)
if (m_selectedElement == i && m_isSpriteSelected)
{
// Draw selection highlight
TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
Expand Down
8 changes: 8 additions & 0 deletions Scripts/Editor/TMPro_CreateObjectMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using UnityEditor.Presets;
using UnityEditor.SceneManagement;
using UnityEditor.Experimental.SceneManagement;
using UnityEditor.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.EventSystems;
Expand Down Expand Up @@ -339,10 +340,17 @@ private static void CreateEventSystem(bool select, GameObject parent)
var esys = Object.FindFirstObjectByType<EventSystem>();
if (esys == null)
{
#if UNITY_2023_3_OR_NEWER
var eventSystem = ObjectFactory.CreateGameObject("EventSystem");
GameObjectUtility.SetParentAndAlign(eventSystem, parent);
esys = ObjectFactory.AddComponent<EventSystem>(eventSystem);
InputModuleComponentFactory.AddInputModule(eventSystem);
#else
var eventSystem = new GameObject("EventSystem");
GameObjectUtility.SetParentAndAlign(eventSystem, parent);
esys = eventSystem.AddComponent<EventSystem>();
eventSystem.AddComponent<StandaloneInputModule>();
#endif

Undo.RegisterCreatedObjectUndo(eventSystem, "Create " + eventSystem.name);
}
Expand Down
15 changes: 11 additions & 4 deletions Scripts/Editor/TMPro_FontAssetCreatorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ void DrawControls()
{
m_SelectedFontAsset = null;
m_IsFontAtlasInvalid = true;
m_SourceFontFaces = GetFontFaces();
if (m_SourceFont != null)
m_SourceFontFaces = GetFontFaces();
m_SourceFontFaceIndex = 0;
}

Expand Down Expand Up @@ -734,7 +735,12 @@ void DrawControls()
// Get list of characters that need to be packed and rendered to the atlas texture.
if (m_CharacterSetSelectionMode == 7 || m_CharacterSetSelectionMode == 8)
{
List<uint> char_List = new List<uint>();
// Ensure these characters are always added
List<uint> char_List = new List<uint>()
{
0x09, // Tab
0x5F // Underline
};

for (int i = 0; i < m_CharacterSequence.Length; i++)
{
Expand Down Expand Up @@ -1224,7 +1230,7 @@ string[] GetFontFaces()
/// </summary>
void UpdateRenderFeedbackWindow()
{
m_PointSize = m_FaceInfo.pointSize;
m_PointSize = (int)m_FaceInfo.pointSize;

string missingGlyphReport = string.Empty;

Expand Down Expand Up @@ -1839,7 +1845,8 @@ void LoadFontCreationSettings(FontAssetCreationSettings settings)
{
m_SourceFont = AssetDatabase.LoadAssetAtPath<Font>(AssetDatabase.GUIDToAssetPath(settings.sourceFontFileGUID));
m_SourceFontFaceIndex = settings.faceIndex;
m_SourceFontFaces = GetFontFaces();
if (m_SourceFont != null)
m_SourceFontFaces = GetFontFaces();
m_PointSizeSamplingMode = settings.pointSizeSamplingMode;
m_PointSize = settings.pointSize;
m_Padding = settings.padding;
Expand Down
1 change: 1 addition & 0 deletions Scripts/Runtime/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// Allow internal visibility for testing purposes.
[assembly: InternalsVisibleTo("Unity.TextCore")]
[assembly: InternalsVisibleTo("Unity.TextCore.FontEngine.Tools")]

[assembly: InternalsVisibleTo("Unity.FontEngine.Tests")]
[assembly: InternalsVisibleTo("Unity.TextCore.Editor")]
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Runtime/TMP_InputField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ protected virtual void LateUpdate()

if (lineType != LineType.MultiLineNewline && c == '\n')
{
m_SoftKeyboard.text = m_Text;
UpdateLabel();

OnSubmit(null);
OnDeselect(null);
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Runtime/TMP_PackageResourceImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ void ImportCallback(string packageName)
{
// Restore backup of TMP Settings from byte[]
File.WriteAllBytes(k_SettingsFilePath, k_SettingsBackup);
AssetDatabase.Refresh();

TMP_Settings.instance.SetAssetVersion();
EditorUtility.SetDirty(TMP_Settings.instance);
AssetDatabase.SaveAssetIfDirty(TMP_Settings.instance);
AssetDatabase.Refresh();
}
m_EssentialResourcesImported = true;
TMPro_EventManager.ON_RESOURCES_LOADED();
Expand Down
10 changes: 1 addition & 9 deletions Scripts/Runtime/TMP_SubMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -558,15 +558,7 @@ public void UpdateMeshPadding(bool isExtraPadding, bool isUsingBold)
/// </summary>
public void SetVerticesDirty()
{
if (!this.enabled)
return;

// This is called on the parent TextMeshPro component.
if (m_TextComponent != null)
{
m_TextComponent.havePropertiesChanged = true;
m_TextComponent.SetVerticesDirty();
}
// Do nothing as updates of the text are driven by the parent text component
}


Expand Down
20 changes: 1 addition & 19 deletions Scripts/Runtime/TMP_SubMeshUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,7 @@ public override void SetAllDirty()
/// </summary>
public override void SetVerticesDirty()
{
if (!this.IsActive())
return;

// This is called on the parent TextMeshPro component.
if (m_TextComponent != null)
{
m_TextComponent.havePropertiesChanged = true;
m_TextComponent.SetVerticesDirty();
}
// Do nothing as updates of the text are driven by the parent text component
}


Expand All @@ -605,22 +597,12 @@ public override void SetLayoutDirty()
/// </summary>
public override void SetMaterialDirty()
{
//Debug.Log("*** STO-UI - SetMaterialDirty() *** FRAME (" + Time.frameCount + ")");

//if (!this.IsActive())
// return;

m_materialDirty = true;

UpdateMaterial();

if (m_OnDirtyMaterialCallback != null)
m_OnDirtyMaterialCallback();

//TMP_ITextElementUpdateManager.RegisterTextElementForGraphicRebuild(this);

//TMP_UpdateRegistry.RegisterCanvasElementForGraphicRebuild((ICanvasElement)this);
//m_TextComponent.SetMaterialDirty();
}


Expand Down
Loading

0 comments on commit 053c344

Please sign in to comment.