Skip to content

Commit 2899fea

Browse files
author
Unity Technologies
committed
com.unity.textmeshpro@3.2.0-pre.9
## [3.2.0-pre.9] - 2024-02-20 ### Changes - Fix Incorrect cursor placement when selecting text and typing if text is center-aligned. - Setting the game object layer for the Dropdown blocker game object to match the Canvas value. - Fixed the virtual keyboard of InputField not closing upon Enter/Newline on Android. - Fixed Ideographic Variation Selector. - Ensure Dynamic FontAsset have a readable Atlas - Fixed compile error on TMP_PostBuildProcessorHandler.cs when building for iOS with "install into source code" - Fixed missing help documentation for SpriteAsset component in TextCore.
1 parent 067fd10 commit 2899fea

14 files changed

+66
-29
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
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.9] - 2024-02-20
5+
### Changes
6+
- Fix Incorrect cursor placement when selecting text and typing if text is center-aligned.
7+
- Setting the game object layer for the Dropdown blocker game object to match the Canvas value.
8+
- Fixed the virtual keyboard of InputField not closing upon Enter/Newline on Android.
9+
- Fixed Ideographic Variation Selector.
10+
- Ensure Dynamic FontAsset have a readable Atlas
11+
- Fixed compile error on TMP_PostBuildProcessorHandler.cs when building for iOS with "install into source code"
12+
- Fixed missing help documentation for SpriteAsset component in TextCore.
13+
414
## [3.2.0-pre.8] - 2024-01-30
515
### Changes
616
- Fix Dropdown creation causing a crash after undoing.

Package Resources/.buginfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
area: Text
1+
area: Text

Scripts/Editor/.buginfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
area: Text
1+
area: Text

Scripts/Editor/TMP_PostBuildProcessHandler.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj
1919
if (settings == null || TMP_Settings.enableEmojiSupport == false)
2020
return;
2121

22-
string file = Path.Combine(pathToBuiltProject, "Classes/UI/Keyboard.mm");
22+
string file = Path.Combine(pathToBuiltProject, "Trampoline", "Classes/UI/Keyboard.mm");
23+
24+
if (!File.Exists(file))
25+
{
26+
file = Path.Combine(pathToBuiltProject, "Classes/UI/Keyboard.mm");
27+
}
28+
2329
string content = File.ReadAllText(file);
2430
content = content.Replace("FILTER_EMOJIS_IOS_KEYBOARD 1", "FILTER_EMOJIS_IOS_KEYBOARD 0");
2531
File.WriteAllText(file, content);

Scripts/Editor/TMPro_FontAssetCreatorWindow.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,8 @@ void Save_Bitmap_FontAsset(string filePath)
15801580
}
15811581

15821582
// Set texture to non readable
1583-
FontEngineEditorUtilities.SetAtlasTextureIsReadable(fontAsset.atlasTexture, false);
1583+
if (fontAsset.atlasPopulationMode == AtlasPopulationMode.Static)
1584+
FontEngineEditorUtilities.SetAtlasTextureIsReadable(fontAsset.atlasTexture, false);
15841585

15851586
// Add list of GlyphRects to font asset.
15861587
fontAsset.freeGlyphRects = m_FreeGlyphRects;
@@ -1774,7 +1775,8 @@ void Save_SDF_FontAsset(string filePath)
17741775
//File.WriteAllBytes("Assets/Textures/Debug Distance Field.png", pngData);
17751776

17761777
// Set texture to non readable
1777-
FontEngineEditorUtilities.SetAtlasTextureIsReadable(fontAsset.atlasTexture, false);
1778+
if (fontAsset.atlasPopulationMode == AtlasPopulationMode.Static)
1779+
FontEngineEditorUtilities.SetAtlasTextureIsReadable(fontAsset.atlasTexture, false);
17781780

17791781
// Add list of GlyphRects to font asset.
17801782
fontAsset.freeGlyphRects = m_FreeGlyphRects;

Scripts/Runtime/.buginfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
area: Text
1+
area: Text

Scripts/Runtime/TMP_Dropdown.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,10 @@ protected virtual GameObject CreateBlocker(Canvas rootCanvas)
10101010
// Create blocker GameObject.
10111011
GameObject blocker = new GameObject("Blocker");
10121012

1013+
// Set the game object layer to match the Canvas' game object layer, as not doing this can lead to issues
1014+
// especially in XR applications like PolySpatial on VisionOS (UUM-62470).
1015+
blocker.layer = rootCanvas.gameObject.layer;
1016+
10131017
// Setup blocker RectTransform to cover entire root canvas area.
10141018
RectTransform blockerRect = blocker.AddComponent<RectTransform>();
10151019
blockerRect.SetParent(rootCanvas.transform, false);

Scripts/Runtime/TMP_InputField.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public class TouchScreenKeyboardEvent : UnityEvent<TouchScreenKeyboard.Status> {
331331

332332
private bool m_IsTextComponentUpdateRequired = false;
333333

334-
private bool m_isLastKeyBackspace = false;
334+
private bool m_HasTextBeenRemoved = false;
335335
private float m_PointerDownClickStartTime;
336336
private float m_KeyDownStartTime;
337337
private float m_DoubleClickDelay = 0.5f;
@@ -452,7 +452,7 @@ public bool shouldHideSoftKeyboard
452452
case RuntimePlatform.Android:
453453
case RuntimePlatform.IPhonePlayer:
454454
case RuntimePlatform.tvOS:
455-
#if UNITY_2022_3_OR_NEWER
455+
#if UNITY_XR_VISIONOS_SUPPORTED
456456
case RuntimePlatform.VisionOS:
457457
#endif
458458
case RuntimePlatform.WSAPlayerX86:
@@ -485,7 +485,7 @@ public bool shouldHideSoftKeyboard
485485
case RuntimePlatform.Android:
486486
case RuntimePlatform.IPhonePlayer:
487487
case RuntimePlatform.tvOS:
488-
#if UNITY_2022_3_OR_NEWER
488+
#if UNITY_XR_VISIONOS_SUPPORTED
489489
case RuntimePlatform.VisionOS:
490490
#endif
491491
case RuntimePlatform.WSAPlayerX86:
@@ -528,7 +528,7 @@ private bool isKeyboardUsingEvents()
528528
return InPlaceEditing() && m_HideSoftKeyboard;
529529
case RuntimePlatform.IPhonePlayer:
530530
case RuntimePlatform.tvOS:
531-
#if UNITY_2022_3_OR_NEWER
531+
#if UNITY_XR_VISIONOS_SUPPORTED
532532
case RuntimePlatform.VisionOS:
533533
#endif
534534
return m_HideSoftKeyboard;
@@ -1791,7 +1791,7 @@ protected virtual void LateUpdate()
17911791
hasValidateUpdatedText = textBeforeValidate != m_Text;
17921792
}
17931793

1794-
if (lineType == LineType.MultiLineSubmit && c == '\n')
1794+
if (lineType != LineType.MultiLineNewline && c == '\n')
17951795
{
17961796
m_SoftKeyboard.text = m_Text;
17971797

@@ -3099,7 +3099,7 @@ private void DeleteKey()
30993099

31003100
if (hasSelection)
31013101
{
3102-
m_isLastKeyBackspace = true;
3102+
m_HasTextBeenRemoved = true;
31033103

31043104
Delete();
31053105
UpdateTouchKeyboardFromEditChanges();
@@ -3117,7 +3117,7 @@ private void DeleteKey()
31173117
else
31183118
m_Text = text.Remove(stringPositionInternal, 1);
31193119

3120-
m_isLastKeyBackspace = true;
3120+
m_HasTextBeenRemoved = true;
31213121

31223122
UpdateTouchKeyboardFromEditChanges();
31233123
SendOnValueChangedAndUpdateLabel();
@@ -3138,7 +3138,7 @@ private void DeleteKey()
31383138

31393139
m_Text = text.Remove(nextCharacterStringPosition, numberOfCharactersToRemove);
31403140

3141-
m_isLastKeyBackspace = true;
3141+
m_HasTextBeenRemoved = true;
31423142

31433143
SendOnValueChangedAndUpdateLabel();
31443144
}
@@ -3160,7 +3160,7 @@ private void Backspace()
31603160

31613161
if (hasSelection)
31623162
{
3163-
m_isLastKeyBackspace = true;
3163+
m_HasTextBeenRemoved = true;
31643164

31653165
Delete();
31663166
UpdateTouchKeyboardFromEditChanges();
@@ -3184,7 +3184,7 @@ private void Backspace()
31843184

31853185
caretSelectPositionInternal = caretPositionInternal = caretPositionInternal - 1;
31863186

3187-
m_isLastKeyBackspace = true;
3187+
m_HasTextBeenRemoved = true;
31883188

31893189
UpdateTouchKeyboardFromEditChanges();
31903190
SendOnValueChangedAndUpdateLabel();
@@ -3215,7 +3215,7 @@ private void Backspace()
32153215
caretSelectPositionInternal = caretPositionInternal = caretPositionIndex;
32163216
}
32173217

3218-
m_isLastKeyBackspace = true;
3218+
m_HasTextBeenRemoved = true;
32193219

32203220
UpdateTouchKeyboardFromEditChanges();
32213221
SendOnValueChangedAndUpdateLabel();
@@ -3267,6 +3267,9 @@ protected virtual void Append(char input)
32673267

32683268
if (selectionFocusPosition != selectionAnchorPosition)
32693269
{
3270+
3271+
m_HasTextBeenRemoved = true;
3272+
32703273
if (m_isRichTextEditingAllowed || m_isSelectAll)
32713274
{
32723275
// Handling of Delete when Rich Text is allowed.
@@ -3876,7 +3879,7 @@ private void GenerateCaret(VertexHelper vbo, Vector2 roundingOffset)
38763879
}
38773880

38783881
// Adjust the position of the RectTransform based on the caret position in the viewport (only if we have focus).
3879-
if (isFocused && startPosition != m_LastPosition || m_forceRectTransformAdjustment || m_isLastKeyBackspace)
3882+
if (isFocused && startPosition != m_LastPosition || m_forceRectTransformAdjustment || m_HasTextBeenRemoved)
38803883
AdjustRectTransformRelativeToViewport(startPosition, height, currentCharacter.isVisible);
38813884

38823885
m_LastPosition = startPosition;
@@ -4124,8 +4127,8 @@ private void AdjustRectTransformRelativeToViewport(Vector2 startPosition, float
41244127
}
41254128
}
41264129

4127-
// Special handling of backspace
4128-
if (m_isLastKeyBackspace)
4130+
// Special handling of backspace/text being removed
4131+
if (m_HasTextBeenRemoved)
41294132
{
41304133
float anchoredPositionX = m_TextComponent.rectTransform.anchoredPosition.x;
41314134

@@ -4154,7 +4157,7 @@ private void AdjustRectTransformRelativeToViewport(Vector2 startPosition, float
41544157
AssignPositioningIfNeeded();
41554158
}
41564159

4157-
m_isLastKeyBackspace = false;
4160+
m_HasTextBeenRemoved = false;
41584161
}
41594162

41604163
m_forceRectTransformAdjustment = false;

Scripts/Runtime/TMP_SpriteAsset.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace TMPro
99
{
10+
[HelpURL("https://docs.unity3d.com/Packages/com.unity.ugui@2.0/manual/TextMeshPro/Sprites.html")]
1011
[ExcludeFromPresetAttribute]
1112
public class TMP_SpriteAsset : TMP_Asset
1213
{

Scripts/Runtime/TextMeshPro.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ internal override int SetArraySizes(TextProcessingElement[] textProcessingArray)
16571657

16581658
#region VARIATION SELECTOR
16591659
uint nextCharacter = i + 1 < textProcessingArray.Length ? (uint)textProcessingArray[i + 1].unicode : 0;
1660-
if (nextCharacter >= 0xFE00 && nextCharacter <= 0xFE0F)
1660+
if (nextCharacter >= 0xFE00 && nextCharacter <= 0xFE0F || nextCharacter >= 0xE0100 && nextCharacter <= 0xE01EF)
16611661
{
16621662
// Get potential variant glyph index
16631663
uint variantGlyphIndex = m_currentFontAsset.GetGlyphVariantIndex((uint)unicode, nextCharacter);

Scripts/Runtime/TextMeshProUGUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ internal override int SetArraySizes(TextProcessingElement[] textProcessingArray)
19721972

19731973
#region VARIATION SELECTOR
19741974
uint nextCharacter = i + 1 < textProcessingArray.Length ? (uint)textProcessingArray[i + 1].unicode : 0;
1975-
if (nextCharacter >= 0xFE00 && nextCharacter <= 0xFE0F)
1975+
if (nextCharacter >= 0xFE00 && nextCharacter <= 0xFE0F || nextCharacter >= 0xE0100 && nextCharacter <= 0xE01EF)
19761976
{
19771977
// Get potential variant glyph index
19781978
uint variantGlyphIndex = m_currentFontAsset.GetGlyphVariantIndex((uint)unicode, nextCharacter);

Scripts/Runtime/Unity.TextMeshPro.asmdef

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
"precompiledReferences": [],
1010
"autoReferenced": true,
1111
"defineConstraints": [],
12-
"versionDefines": [],
12+
"versionDefines": [
13+
{
14+
"name": "Unity",
15+
"expression": "[2022.3.16f1,2023.1)",
16+
"define": "UNITY_XR_VISIONOS_SUPPORTED"
17+
},
18+
{
19+
"name": "Unity",
20+
"expression": "2023.3.0b4",
21+
"define": "UNITY_XR_VISIONOS_SUPPORTED"
22+
}
23+
],
1324
"noEngineReferences": false
1425
}

ValidationExceptions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[
44
{
55
"ValidationTest": "API Validation",
6-
"PackageVersion": "3.2.0-pre.8"
6+
"PackageVersion": "3.2.0-pre.9"
77
}
88
]
99
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.unity.textmeshpro",
33
"displayName": "TextMeshPro",
4-
"version": "3.2.0-pre.8",
4+
"version": "3.2.0-pre.9",
55
"unity": "2020.3",
66
"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.\n\n\n\nUPGRADE NOTE\n--------------------\nThis latest release of the TMP package includes updated TMP Essential Resources and TMP Examples & Extras. Be sure to update those via the \"Window - TextMeshPro - Import...\" menu options.",
77
"keywords": [
@@ -16,15 +16,15 @@
1616
"com.unity.ugui": "1.0.0"
1717
},
1818
"_upm": {
19-
"changelog": "### Changes\n- Fix Dropdown creation causing a crash after undoing.\n- Addressed issue surrounding dropdown not closing correctly in certain situations\n- Resolves issue in editor where a null mesh may be set with still present submesh data, not having the canvas update.\n- Ensure enabling and disabling Canvases does not cause a regeneration of the text.\n- Fixed un-detected sprite asset changes after adding new sprites.\n- Ensure Kerning is not applied to Sprites"
19+
"changelog": "### Changes\n- Fix Incorrect cursor placement when selecting text and typing if text is center-aligned.\n- Setting the game object layer for the Dropdown blocker game object to match the Canvas value.\n- Fixed the virtual keyboard of InputField not closing upon Enter/Newline on Android.\n- Fixed Ideographic Variation Selector.\n- Ensure Dynamic FontAsset have a readable Atlas\n- Fixed compile error on TMP_PostBuildProcessorHandler.cs when building for iOS with \"install into source code\"\n- Fixed missing help documentation for SpriteAsset component in TextCore."
2020
},
2121
"upmCi": {
22-
"footprint": "aab610f160b417f22bf7091ae667d0a795b917d7"
22+
"footprint": "86848703e1786f2fe299c216facdb77fa5bbde80"
2323
},
2424
"documentationUrl": "https://docs.unity3d.com/Packages/com.unity.textmeshpro@3.2/manual/index.html",
2525
"repository": {
2626
"url": "https://github.cds.internal.unity3d.com/unity/unity.git",
2727
"type": "git",
28-
"revision": "d83c6f451b7a6d68cc6beac158dc425eb0530ccb"
28+
"revision": "33af836c4402901269ec9e18f5bf21cbdd17d978"
2929
}
3030
}

0 commit comments

Comments
 (0)