Skip to content

Commit d1cb960

Browse files
author
JunichiEnomoto
committed
Merge branch 'master'
# Conflicts: # Packages/manifest.json # Packages/packages-lock.json # ProjectSettings/ProjectVersion.txt # UserSettings/EditorUserSettings.asset
2 parents bf13079 + 5fa1907 commit d1cb960

10 files changed

Lines changed: 514 additions & 507 deletions

File tree

Assets/RubyTextMeshPro/Demo/Fonts/rounded-mplus-1c-regular SDF.asset

Lines changed: 102 additions & 91 deletions
Large diffs are not rendered by default.

Assets/RubyTextMeshPro/Demo/Scene/RubySampleScene3 (AllVComVCompensationSample).unity

Lines changed: 178 additions & 385 deletions
Large diffs are not rendered by default.

Assets/RubyTextMeshPro/Source/RubyTextMeshPro.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,38 @@ protected enum RubyShowType
3333
[SerializeField]
3434
[TextArea(5, 10)]
3535
private string m_uneditedText;
36-
36+
3737
public string UnditedText
3838
{
39-
set { m_uneditedText = value; SetTextCustom(m_uneditedText); }
39+
set
40+
{
41+
m_uneditedText = value;
42+
SetTextCustom(m_uneditedText);
43+
}
4044
}
4145

4246
private void SetTextCustom(string value)
4347
{
4448
text = ReplaceRubyTags(value);
4549

46-
// SetLayoutDirty called
47-
if (m_isLayoutDirty)
50+
// m_havePropertiesChanged : text changed => true, ForceMeshUpdate in OnPreRenderCanvas => false
51+
if (m_havePropertiesChanged)
4852
{
4953
// changes to the text object properties need to be applied immediately.
5054
ForceMeshUpdate();
5155
}
5256
}
5357

58+
public override void ForceMeshUpdate(bool ignoreActiveState = false, bool forceTextReparsing = false)
59+
{
60+
base.ForceMeshUpdate(ignoreActiveState,forceTextReparsing);
61+
if (m_enableAutoSizing)
62+
{
63+
// change auto size timing, update ruby tag size.
64+
SetTextCustom(m_uneditedText);
65+
}
66+
}
67+
5468
/// <summary>
5569
/// replace ruby tags.
5670
/// </summary>
@@ -70,6 +84,7 @@ private string ReplaceRubyTags(string str)
7084
fontSizeScale = (this.m_fontSize / this.m_maxFontSize);
7185
}
7286
var dir = isRightToLeftText ? 1 : -1;
87+
// Q. Why (m_isOrthographic ? 1 : 10f) => A. TMP_Text.cs L7622, L7625
7388
var hiddenSpaceW = dir * nonBreakSpaceW * (m_isOrthographic ? 1 : 10f) * rubyScale * fontSizeScale;
7489
// Replace <ruby> tags text layout.
7590
var matches = RubyRegex.Matches(str);
@@ -212,8 +227,6 @@ protected override void OnValidate()
212227
{
213228
base.OnValidate();
214229

215-
ForceMeshUpdate();
216-
217230
SetTextCustom(m_uneditedText);
218231
}
219232
#endif

Assets/RubyTextMeshPro/Source/RubyTextMeshProUGUI.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,35 @@ protected enum RubyShowType
3333
[SerializeField]
3434
[TextArea(5, 10)]
3535
private string m_uneditedText;
36-
36+
3737
public string UnditedText
3838
{
39-
set { m_uneditedText = value; SetTextCustom(m_uneditedText); }
39+
set {
40+
m_uneditedText = value;
41+
SetTextCustom(m_uneditedText);
42+
}
4043
}
4144

4245
private void SetTextCustom(string value)
4346
{
4447
text = ReplaceRubyTags(value);
4548

46-
// SetLayoutDirty called
47-
if (m_isLayoutDirty)
49+
// m_havePropertiesChanged : text changed => true, ForceMeshUpdate in OnPreRenderCanvas => false
50+
if (m_havePropertiesChanged)
4851
{
49-
// changes to the text object properties need to be applied immediately.
5052
ForceMeshUpdate();
5153
}
5254
}
55+
56+
public override void ForceMeshUpdate(bool ignoreActiveState = false, bool forceTextReparsing = false)
57+
{
58+
base.ForceMeshUpdate(ignoreActiveState,forceTextReparsing);
59+
if (m_enableAutoSizing)
60+
{
61+
// change auto size timing, update ruby tag size.
62+
SetTextCustom(m_uneditedText);
63+
}
64+
}
5365

5466
/// <summary>
5567
/// replace ruby tags.
@@ -70,6 +82,7 @@ private string ReplaceRubyTags(string str)
7082
fontSizeScale = (this.m_fontSize / this.m_maxFontSize);
7183
}
7284
var dir = isRightToLeftText ? 1 : -1;
85+
// Q. Why (m_isOrthographic ? 1 : 10f) => A. TMP_Text.cs L7622, L7625
7386
var hiddenSpaceW = dir * nonBreakSpaceW * (m_isOrthographic ? 1 : 10f) * rubyScale * fontSizeScale;
7487
// Replace <ruby> tags text layout.
7588
var matches = RubyRegex.Matches(str);
@@ -151,8 +164,6 @@ protected override void OnValidate()
151164
{
152165
base.OnValidate();
153166

154-
ForceMeshUpdate();
155-
156167
SetTextCustom(m_uneditedText);
157168
}
158169
#endif

Packages/manifest.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"dependencies": {
33
"com.unity.2d.sprite": "1.0.0",
4-
"com.unity.collab-proxy": "1.3.9",
4+
"com.unity.collab-proxy": "1.7.1",
55
"com.unity.ext.nunit": "1.0.6",
66
"com.unity.ide.rider": "2.0.7",
7-
"com.unity.ide.visualstudio": "2.0.7",
7+
"com.unity.ide.visualstudio": "2.0.11",
88
"com.unity.ide.vscode": "1.2.3",
9-
"com.unity.test-framework": "1.1.24",
10-
"com.unity.textmeshpro": "3.0.1",
11-
"com.unity.timeline": "1.4.7",
9+
"com.unity.test-framework": "1.1.27",
10+
"com.unity.textmeshpro": "3.0.6",
11+
"com.unity.timeline": "1.4.8",
1212
"com.unity.ugui": "1.0.0",
1313
"com.unity.modules.ai": "1.0.0",
1414
"com.unity.modules.androidjni": "1.0.0",

Packages/packages-lock.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
"dependencies": {}
88
},
99
"com.unity.collab-proxy": {
10-
"version": "1.3.9",
10+
"version": "1.7.1",
1111
"depth": 0,
1212
"source": "registry",
13-
"dependencies": {},
13+
"dependencies": {
14+
"com.unity.nuget.newtonsoft-json": "2.0.0"
15+
},
1416
"url": "https://packages.unity.com"
1517
},
1618
"com.unity.ext.nunit": {
@@ -30,7 +32,7 @@
3032
"url": "https://packages.unity.com"
3133
},
3234
"com.unity.ide.visualstudio": {
33-
"version": "2.0.7",
35+
"version": "2.0.11",
3436
"depth": 0,
3537
"source": "registry",
3638
"dependencies": {
@@ -45,8 +47,15 @@
4547
"dependencies": {},
4648
"url": "https://packages.unity.com"
4749
},
50+
"com.unity.nuget.newtonsoft-json": {
51+
"version": "2.0.0",
52+
"depth": 1,
53+
"source": "registry",
54+
"dependencies": {},
55+
"url": "https://packages.unity.com"
56+
},
4857
"com.unity.test-framework": {
49-
"version": "1.1.24",
58+
"version": "1.1.27",
5059
"depth": 0,
5160
"source": "registry",
5261
"dependencies": {
@@ -57,7 +66,7 @@
5766
"url": "https://packages.unity.com"
5867
},
5968
"com.unity.textmeshpro": {
60-
"version": "3.0.1",
69+
"version": "3.0.6",
6170
"depth": 0,
6271
"source": "registry",
6372
"dependencies": {
@@ -66,7 +75,7 @@
6675
"url": "https://packages.unity.com"
6776
},
6877
"com.unity.timeline": {
69-
"version": "1.4.7",
78+
"version": "1.4.8",
7079
"depth": 0,
7180
"source": "registry",
7281
"dependencies": {

ProjectSettings/ProjectVersion.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2020.3.7f1
2-
m_EditorVersionWithRevision: 2020.3.7f1 (dd97f2c94397)
1+
m_EditorVersion: 2020.3.17f1
2+
m_EditorVersionWithRevision: 2020.3.17f1 (a4537701e4ab)
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"templatePinStates": [],
3+
"dependencyTypeInfos": [
4+
{
5+
"userAdded": false,
6+
"type": "UnityEngine.AnimationClip",
7+
"ignore": false,
8+
"defaultInstantiationMode": 0,
9+
"supportsModification": true
10+
},
11+
{
12+
"userAdded": false,
13+
"type": "UnityEditor.Animations.AnimatorController",
14+
"ignore": false,
15+
"defaultInstantiationMode": 0,
16+
"supportsModification": true
17+
},
18+
{
19+
"userAdded": false,
20+
"type": "UnityEngine.AnimatorOverrideController",
21+
"ignore": false,
22+
"defaultInstantiationMode": 0,
23+
"supportsModification": true
24+
},
25+
{
26+
"userAdded": false,
27+
"type": "UnityEditor.Audio.AudioMixerController",
28+
"ignore": false,
29+
"defaultInstantiationMode": 0,
30+
"supportsModification": true
31+
},
32+
{
33+
"userAdded": false,
34+
"type": "UnityEngine.ComputeShader",
35+
"ignore": true,
36+
"defaultInstantiationMode": 1,
37+
"supportsModification": true
38+
},
39+
{
40+
"userAdded": false,
41+
"type": "UnityEngine.Cubemap",
42+
"ignore": false,
43+
"defaultInstantiationMode": 0,
44+
"supportsModification": true
45+
},
46+
{
47+
"userAdded": false,
48+
"type": "UnityEngine.GameObject",
49+
"ignore": false,
50+
"defaultInstantiationMode": 0,
51+
"supportsModification": true
52+
},
53+
{
54+
"userAdded": false,
55+
"type": "UnityEditor.LightingDataAsset",
56+
"ignore": false,
57+
"defaultInstantiationMode": 0,
58+
"supportsModification": false
59+
},
60+
{
61+
"userAdded": false,
62+
"type": "UnityEngine.LightingSettings",
63+
"ignore": false,
64+
"defaultInstantiationMode": 0,
65+
"supportsModification": true
66+
},
67+
{
68+
"userAdded": false,
69+
"type": "UnityEngine.Material",
70+
"ignore": false,
71+
"defaultInstantiationMode": 0,
72+
"supportsModification": true
73+
},
74+
{
75+
"userAdded": false,
76+
"type": "UnityEditor.MonoScript",
77+
"ignore": true,
78+
"defaultInstantiationMode": 1,
79+
"supportsModification": true
80+
},
81+
{
82+
"userAdded": false,
83+
"type": "UnityEngine.PhysicMaterial",
84+
"ignore": false,
85+
"defaultInstantiationMode": 0,
86+
"supportsModification": true
87+
},
88+
{
89+
"userAdded": false,
90+
"type": "UnityEngine.PhysicsMaterial2D",
91+
"ignore": false,
92+
"defaultInstantiationMode": 0,
93+
"supportsModification": true
94+
},
95+
{
96+
"userAdded": false,
97+
"type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile",
98+
"ignore": false,
99+
"defaultInstantiationMode": 0,
100+
"supportsModification": true
101+
},
102+
{
103+
"userAdded": false,
104+
"type": "UnityEngine.Rendering.PostProcessing.PostProcessResources",
105+
"ignore": false,
106+
"defaultInstantiationMode": 0,
107+
"supportsModification": true
108+
},
109+
{
110+
"userAdded": false,
111+
"type": "UnityEngine.Rendering.VolumeProfile",
112+
"ignore": false,
113+
"defaultInstantiationMode": 0,
114+
"supportsModification": true
115+
},
116+
{
117+
"userAdded": false,
118+
"type": "UnityEditor.SceneAsset",
119+
"ignore": false,
120+
"defaultInstantiationMode": 0,
121+
"supportsModification": false
122+
},
123+
{
124+
"userAdded": false,
125+
"type": "UnityEngine.Shader",
126+
"ignore": true,
127+
"defaultInstantiationMode": 1,
128+
"supportsModification": true
129+
},
130+
{
131+
"userAdded": false,
132+
"type": "UnityEngine.ShaderVariantCollection",
133+
"ignore": true,
134+
"defaultInstantiationMode": 1,
135+
"supportsModification": true
136+
},
137+
{
138+
"userAdded": false,
139+
"type": "UnityEngine.Texture",
140+
"ignore": false,
141+
"defaultInstantiationMode": 0,
142+
"supportsModification": true
143+
},
144+
{
145+
"userAdded": false,
146+
"type": "UnityEngine.Texture2D",
147+
"ignore": false,
148+
"defaultInstantiationMode": 0,
149+
"supportsModification": true
150+
},
151+
{
152+
"userAdded": false,
153+
"type": "UnityEngine.Timeline.TimelineAsset",
154+
"ignore": false,
155+
"defaultInstantiationMode": 0,
156+
"supportsModification": true
157+
}
158+
],
159+
"defaultDependencyTypeInfo": {
160+
"userAdded": false,
161+
"type": "<default_scene_template_dependencies>",
162+
"ignore": false,
163+
"defaultInstantiationMode": 1,
164+
"supportsModification": true
165+
},
166+
"newSceneOverride": 0
167+
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ You need to have `TextMeshPro` plugin in your project. You can install TMPro via
1414

1515
I checked Unity and TextMeshPro Version are below.
1616

17-
UnityVer:2019.4.9f1
17+
UnityVer:2020.3.17f1
1818

19-
TextMeshProVer:2.1.1
19+
TextMeshProVer:3.0.6
2020

2121
# Features
2222
### Realtime Ruby Text

0 commit comments

Comments
 (0)