Skip to content

Commit 053c344

Browse files
author
Unity Technologies
committed
com.unity.textmeshpro@3.2.0-pre.10
## [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
1 parent 2899fea commit 053c344

21 files changed

+220
-86
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
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+
## [3.2.0-pre.10] - 2024-05-27
5+
### Changes
6+
- Ensure space and underline are always added to Static FontAsset. (UUM-45512)
7+
- Fix bug that occurs with the Input Field, resulting in an incorrect cursor position when modifying long text input. (UUM-58685)
8+
- Fixed compile error on TMP_PostBuildProcessorHandler.cs when building for iOS with "install into source code (UUM-57710)
9+
- Fixed opening style tag overflow and TextSettings upgrade (UUM-30205)
10+
- Fixed crash occurring in the FontAssetCreatorWindow. (UUM-66950)
11+
- Fixed incorrect handling of Emoji Presentation forms ensuring emojis such as ©️ are displayed in text form, whereas 🚀 is displayed in its color presentation form.
12+
- 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
13+
414
## [3.2.0-pre.9] - 2024-02-20
515
### Changes
616
- Fix Incorrect cursor placement when selecting text and typing if text is center-aligned.
Binary file not shown.

Scripts/Editor/PropertyDrawers/TMP_SpriteCharacterPropertyDrawer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
127127
if (elementIndex != -1)
128128
{
129129
// Get a reference to the Sprite Glyph Table
130-
SerializedProperty prop_SpriteGlyphTable = property.serializedObject.FindProperty("m_SpriteGlyphTable");
130+
SerializedProperty prop_SpriteGlyphTable = property.serializedObject.FindProperty("m_GlyphTable");
131131

132132
SerializedProperty prop_SpriteGlyph = prop_SpriteGlyphTable.GetArrayElementAtIndex(elementIndex);
133133
SerializedProperty prop_GlyphMetrics = prop_SpriteGlyph.FindPropertyRelative("m_Metrics");

Scripts/Editor/TMP_EditorResourceManager.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,16 @@ void OnPreRenderCanvases()
103103
}
104104

105105
#if UNITY_2023_3_OR_NEWER
106-
void OnEndOfFrame(ScriptableRenderContext renderContext, List<Camera> cameras)
106+
void OnEndOfFrame(ScriptableRenderContext renderContext, List<Camera> cameras)
107+
{
108+
DoPostRenderUpdates();
109+
}
107110
#else
108-
void OnEndOfFrame(ScriptableRenderContext renderContext, Camera[] cameras)
109-
#endif
111+
void OnEndOfFrame(ScriptableRenderContext renderContext, Camera[] cameras)
110112
{
111113
DoPostRenderUpdates();
112114
}
115+
#endif
113116

114117
/// <summary>
115118
/// Register resource for re-import.

Scripts/Editor/TMP_FontAssetEditor.cs

+22
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,15 @@ public override void OnInspectorGUI()
578578
m_DisplayDestructiveChangeWarning = false;
579579

580580
// Update face info if sampling point size was changed.
581+
#if UNITY_2023_3_OR_NEWER
582+
if (m_GenerationSettings.pointSize != m_SamplingPointSize_prop.floatValue || m_FaceInfoDirty)
583+
{
584+
LoadFontFace((int)m_SamplingPointSize_prop.floatValue, m_FontFaceIndex_prop.intValue);
585+
#else
581586
if (m_GenerationSettings.pointSize != m_SamplingPointSize_prop.intValue || m_FaceInfoDirty)
582587
{
583588
LoadFontFace(m_SamplingPointSize_prop.intValue, m_FontFaceIndex_prop.intValue);
589+
#endif
584590
m_fontAsset.faceInfo = FontEngine.GetFaceInfo();
585591
m_FaceInfoDirty = false;
586592
}
@@ -1990,7 +1996,11 @@ string[] GetFontFaces()
19901996

19911997
string[] GetFontFaces(int faceIndex)
19921998
{
1999+
#if UNITY_2023_3_OR_NEWER
2000+
if (LoadFontFace((int)m_SamplingPointSize_prop.floatValue, faceIndex) == FontEngineError.Success)
2001+
#else
19932002
if (LoadFontFace(m_SamplingPointSize_prop.intValue, faceIndex) == FontEngineError.Success)
2003+
#endif
19942004
return FontEngine.GetFontFaces();
19952005

19962006
return k_InvalidFontFaces;
@@ -2042,7 +2052,11 @@ void SavedGenerationSettings()
20422052
{
20432053
m_GenerationSettings.faceIndex = m_FontFaceIndex_prop.intValue;
20442054
m_GenerationSettings.glyphRenderMode = (GlyphRenderMode)m_AtlasRenderMode_prop.intValue;
2055+
#if UNITY_2023_3_OR_NEWER
2056+
m_GenerationSettings.pointSize = (int)m_SamplingPointSize_prop.floatValue;
2057+
#else
20452058
m_GenerationSettings.pointSize = m_SamplingPointSize_prop.intValue;
2059+
#endif
20462060
m_GenerationSettings.padding = m_AtlasPadding_prop.intValue;
20472061
m_GenerationSettings.atlasWidth = m_AtlasWidth_prop.intValue;
20482062
m_GenerationSettings.atlasHeight = m_AtlasHeight_prop.intValue;
@@ -2052,7 +2066,11 @@ void RestoreGenerationSettings()
20522066
{
20532067
m_fontAsset.SourceFont_EditorRef = m_GenerationSettings.sourceFont;
20542068
m_FontFaceIndex_prop.intValue = m_GenerationSettings.faceIndex;
2069+
#if UNITY_2023_3_OR_NEWER
2070+
m_SamplingPointSize_prop.floatValue = m_GenerationSettings.pointSize;
2071+
#else
20552072
m_SamplingPointSize_prop.intValue = m_GenerationSettings.pointSize;
2073+
#endif
20562074
m_FontFaces = GetFontFaces();
20572075

20582076
m_AtlasRenderMode_prop.intValue = (int)m_GenerationSettings.glyphRenderMode;
@@ -2065,7 +2083,11 @@ void RestoreGenerationSettings()
20652083
void UpdateFontAssetCreationSettings()
20662084
{
20672085
m_fontAsset.m_CreationSettings.faceIndex = m_FontFaceIndex_prop.intValue;
2086+
#if UNITY_2023_3_OR_NEWER
2087+
m_fontAsset.m_CreationSettings.pointSize = (int)m_SamplingPointSize_prop.floatValue;
2088+
#else
20682089
m_fontAsset.m_CreationSettings.pointSize = m_SamplingPointSize_prop.intValue;
2090+
#endif
20692091
m_fontAsset.m_CreationSettings.renderMode = m_AtlasRenderMode_prop.intValue;
20702092
m_fontAsset.m_CreationSettings.padding = m_AtlasPadding_prop.intValue;
20712093
m_fontAsset.m_CreationSettings.atlasWidth = m_AtlasWidth_prop.intValue;

Scripts/Editor/TMP_FontAsset_CreationMenu.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static void CreateFontAssetFromSelectedObject(Object target, GlyphRenderMode ren
227227
AssetDatabase.AddObjectToAsset(mat, fontAsset);
228228

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

232232
// Not sure if this is still necessary in newer versions of Unity.
233233
//EditorUtility.SetDirty(fontAsset);

Scripts/Editor/TMP_PackageUtilities.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1087,11 +1087,11 @@ private static void ImportCallback(string packageName)
10871087
{
10881088
// Restore backup of TMP Settings from byte[]
10891089
File.WriteAllBytes(k_SettingsFilePath, k_SettingsBackup);
1090+
AssetDatabase.Refresh();
10901091

10911092
TMP_Settings.instance.SetAssetVersion();
10921093
EditorUtility.SetDirty(TMP_Settings.instance);
10931094
AssetDatabase.SaveAssetIfDirty(TMP_Settings.instance);
1094-
AssetDatabase.Refresh();
10951095

10961096
AssetDatabase.importPackageCompleted -= ImportCallback;
10971097
}

Scripts/Editor/TMP_SpriteAssetEditor.cs

+12-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ struct UI_PanelState
2424

2525
int m_moveToIndex;
2626
int m_selectedElement = -1;
27+
bool m_isCharacterSelected = false;
28+
bool m_isSpriteSelected = false;
2729
int m_CurrentCharacterPage;
2830
int m_CurrentGlyphPage;
2931

@@ -257,7 +259,7 @@ public override void OnInspectorGUI()
257259

258260
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
259261
{
260-
EditorGUI.BeginDisabledGroup(i != m_selectedElement);
262+
EditorGUI.BeginDisabledGroup(i != m_selectedElement || !m_isCharacterSelected);
261263
{
262264
EditorGUILayout.PropertyField(spriteCharacterProperty);
263265
}
@@ -275,16 +277,19 @@ public override void OnInspectorGUI()
275277
if (m_selectedElement == i)
276278
{
277279
m_selectedElement = -1;
280+
m_isCharacterSelected = false;
278281
}
279282
else
280283
{
281284
m_selectedElement = i;
285+
m_isCharacterSelected = true;
286+
m_isSpriteSelected = false;
282287
GUIUtility.keyboardControl = 0;
283288
}
284289
}
285290

286291
// Draw & Handle Section Area
287-
if (m_selectedElement == i)
292+
if (m_selectedElement == i && m_isCharacterSelected)
288293
{
289294
// Draw selection highlight
290295
TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));
@@ -482,7 +487,7 @@ public override void OnInspectorGUI()
482487

483488
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
484489
{
485-
EditorGUI.BeginDisabledGroup(i != m_selectedElement);
490+
EditorGUI.BeginDisabledGroup(i != m_selectedElement || !m_isSpriteSelected);
486491
{
487492
EditorGUILayout.PropertyField(spriteGlyphProperty);
488493
}
@@ -500,16 +505,19 @@ public override void OnInspectorGUI()
500505
if (m_selectedElement == i)
501506
{
502507
m_selectedElement = -1;
508+
m_isSpriteSelected = false;
503509
}
504510
else
505511
{
506512
m_selectedElement = i;
513+
m_isCharacterSelected = false;
514+
m_isSpriteSelected = true;
507515
GUIUtility.keyboardControl = 0;
508516
}
509517
}
510518

511519
// Draw & Handle Section Area
512-
if (m_selectedElement == i)
520+
if (m_selectedElement == i && m_isSpriteSelected)
513521
{
514522
// Draw selection highlight
515523
TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));

Scripts/Editor/TMPro_CreateObjectMenu.cs

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using UnityEditor.Presets;
44
using UnityEditor.SceneManagement;
55
using UnityEditor.Experimental.SceneManagement;
6+
using UnityEditor.EventSystems;
67
using UnityEngine.SceneManagement;
78
using UnityEngine.UI;
89
using UnityEngine.EventSystems;
@@ -339,10 +340,17 @@ private static void CreateEventSystem(bool select, GameObject parent)
339340
var esys = Object.FindFirstObjectByType<EventSystem>();
340341
if (esys == null)
341342
{
343+
#if UNITY_2023_3_OR_NEWER
344+
var eventSystem = ObjectFactory.CreateGameObject("EventSystem");
345+
GameObjectUtility.SetParentAndAlign(eventSystem, parent);
346+
esys = ObjectFactory.AddComponent<EventSystem>(eventSystem);
347+
InputModuleComponentFactory.AddInputModule(eventSystem);
348+
#else
342349
var eventSystem = new GameObject("EventSystem");
343350
GameObjectUtility.SetParentAndAlign(eventSystem, parent);
344351
esys = eventSystem.AddComponent<EventSystem>();
345352
eventSystem.AddComponent<StandaloneInputModule>();
353+
#endif
346354

347355
Undo.RegisterCreatedObjectUndo(eventSystem, "Create " + eventSystem.name);
348356
}

Scripts/Editor/TMPro_FontAssetCreatorWindow.cs

+11-4
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ void DrawControls()
438438
{
439439
m_SelectedFontAsset = null;
440440
m_IsFontAtlasInvalid = true;
441-
m_SourceFontFaces = GetFontFaces();
441+
if (m_SourceFont != null)
442+
m_SourceFontFaces = GetFontFaces();
442443
m_SourceFontFaceIndex = 0;
443444
}
444445

@@ -734,7 +735,12 @@ void DrawControls()
734735
// Get list of characters that need to be packed and rendered to the atlas texture.
735736
if (m_CharacterSetSelectionMode == 7 || m_CharacterSetSelectionMode == 8)
736737
{
737-
List<uint> char_List = new List<uint>();
738+
// Ensure these characters are always added
739+
List<uint> char_List = new List<uint>()
740+
{
741+
0x09, // Tab
742+
0x5F // Underline
743+
};
738744

739745
for (int i = 0; i < m_CharacterSequence.Length; i++)
740746
{
@@ -1224,7 +1230,7 @@ string[] GetFontFaces()
12241230
/// </summary>
12251231
void UpdateRenderFeedbackWindow()
12261232
{
1227-
m_PointSize = m_FaceInfo.pointSize;
1233+
m_PointSize = (int)m_FaceInfo.pointSize;
12281234

12291235
string missingGlyphReport = string.Empty;
12301236

@@ -1839,7 +1845,8 @@ void LoadFontCreationSettings(FontAssetCreationSettings settings)
18391845
{
18401846
m_SourceFont = AssetDatabase.LoadAssetAtPath<Font>(AssetDatabase.GUIDToAssetPath(settings.sourceFontFileGUID));
18411847
m_SourceFontFaceIndex = settings.faceIndex;
1842-
m_SourceFontFaces = GetFontFaces();
1848+
if (m_SourceFont != null)
1849+
m_SourceFontFaces = GetFontFaces();
18431850
m_PointSizeSamplingMode = settings.pointSizeSamplingMode;
18441851
m_PointSize = settings.pointSize;
18451852
m_Padding = settings.padding;

Scripts/Runtime/AssemblyInfo.cs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

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

67
[assembly: InternalsVisibleTo("Unity.FontEngine.Tests")]
78
[assembly: InternalsVisibleTo("Unity.TextCore.Editor")]

Scripts/Runtime/TMP_InputField.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ protected virtual void LateUpdate()
17931793

17941794
if (lineType != LineType.MultiLineNewline && c == '\n')
17951795
{
1796-
m_SoftKeyboard.text = m_Text;
1796+
UpdateLabel();
17971797

17981798
OnSubmit(null);
17991799
OnDeselect(null);

Scripts/Runtime/TMP_PackageResourceImporter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ void ImportCallback(string packageName)
135135
{
136136
// Restore backup of TMP Settings from byte[]
137137
File.WriteAllBytes(k_SettingsFilePath, k_SettingsBackup);
138+
AssetDatabase.Refresh();
138139

139140
TMP_Settings.instance.SetAssetVersion();
140141
EditorUtility.SetDirty(TMP_Settings.instance);
141142
AssetDatabase.SaveAssetIfDirty(TMP_Settings.instance);
142-
AssetDatabase.Refresh();
143143
}
144144
m_EssentialResourcesImported = true;
145145
TMPro_EventManager.ON_RESOURCES_LOADED();

Scripts/Runtime/TMP_SubMesh.cs

+1-9
Original file line numberDiff line numberDiff line change
@@ -558,15 +558,7 @@ public void UpdateMeshPadding(bool isExtraPadding, bool isUsingBold)
558558
/// </summary>
559559
public void SetVerticesDirty()
560560
{
561-
if (!this.enabled)
562-
return;
563-
564-
// This is called on the parent TextMeshPro component.
565-
if (m_TextComponent != null)
566-
{
567-
m_TextComponent.havePropertiesChanged = true;
568-
m_TextComponent.SetVerticesDirty();
569-
}
561+
// Do nothing as updates of the text are driven by the parent text component
570562
}
571563

572564

Scripts/Runtime/TMP_SubMeshUI.cs

+1-19
Original file line numberDiff line numberDiff line change
@@ -579,15 +579,7 @@ public override void SetAllDirty()
579579
/// </summary>
580580
public override void SetVerticesDirty()
581581
{
582-
if (!this.IsActive())
583-
return;
584-
585-
// This is called on the parent TextMeshPro component.
586-
if (m_TextComponent != null)
587-
{
588-
m_TextComponent.havePropertiesChanged = true;
589-
m_TextComponent.SetVerticesDirty();
590-
}
582+
// Do nothing as updates of the text are driven by the parent text component
591583
}
592584

593585

@@ -605,22 +597,12 @@ public override void SetLayoutDirty()
605597
/// </summary>
606598
public override void SetMaterialDirty()
607599
{
608-
//Debug.Log("*** STO-UI - SetMaterialDirty() *** FRAME (" + Time.frameCount + ")");
609-
610-
//if (!this.IsActive())
611-
// return;
612-
613600
m_materialDirty = true;
614601

615602
UpdateMaterial();
616603

617604
if (m_OnDirtyMaterialCallback != null)
618605
m_OnDirtyMaterialCallback();
619-
620-
//TMP_ITextElementUpdateManager.RegisterTextElementForGraphicRebuild(this);
621-
622-
//TMP_UpdateRegistry.RegisterCanvasElementForGraphicRebuild((ICanvasElement)this);
623-
//m_TextComponent.SetMaterialDirty();
624606
}
625607

626608

0 commit comments

Comments
 (0)