Skip to content

Commit

Permalink
Fixed bugs with Unity 2019.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pnarimani committed May 6, 2019
1 parent 4dd7439 commit ee58242
Show file tree
Hide file tree
Showing 18 changed files with 10,779 additions and 1,576 deletions.
475 changes: 443 additions & 32 deletions Assets/RTLTMPro/Fonts/segoeui Numbers SDF.asset

Large diffs are not rendered by default.

3,062 changes: 3,040 additions & 22 deletions Assets/RTLTMPro/Fonts/segoeui RTL SDF.asset

Large diffs are not rendered by default.

583 changes: 566 additions & 17 deletions Assets/RTLTMPro/Fonts/segoeui Tashkil SDF.asset

Large diffs are not rendered by default.

25 changes: 8 additions & 17 deletions Assets/RTLTMPro/Scripts/Editor/RTLTextMeshPro3DEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ namespace RTLTMPro
public class RTLTextMeshPro3DEditor : TMP_UiEditorPanel
{
private SerializedProperty originalTextProp;
private SerializedProperty havePropertiesChangedProp;
private SerializedProperty inputSourceProp;
private SerializedProperty isInputPasingRequiredProp;
private SerializedProperty preserveNumbersProp;
private SerializedProperty farsiProp;
private SerializedProperty fixTagsProp;
private SerializedProperty forceFixProp;

private bool changed;
private bool foldout;
private RTLTextMeshPro3D tmpro;

Expand All @@ -29,7 +27,6 @@ public class RTLTextMeshPro3DEditor : TMP_UiEditorPanel
fixTagsProp = serializedObject.FindProperty("fixTags");
forceFixProp = serializedObject.FindProperty("forceFix");
originalTextProp = serializedObject.FindProperty("originalText");
havePropertiesChangedProp = serializedObject.FindProperty("m_havePropertiesChanged");
inputSourceProp = serializedObject.FindProperty("m_inputSource");
isInputPasingRequiredProp = serializedObject.FindProperty("m_isInputParsingRequired");
}
Expand All @@ -46,13 +43,6 @@ public override void OnInspectorGUI()
ListenForZeroWidthNoJoiner();

if (EditorGUI.EndChangeCheck())
{
inputSourceProp.enumValueIndex = 0;
isInputPasingRequiredProp.boolValue = true;
changed = true;
}

if (changed)
OnChanged();

serializedObject.ApplyModifiedProperties();
Expand All @@ -65,23 +55,24 @@ public override void OnInspectorGUI()
DrawOptions();

if (GUILayout.Button("Re-Fix"))
changed = true;
m_HavePropertiesChanged = true;

if (EditorGUI.EndChangeCheck())
{
changed = true;
}
m_HavePropertiesChanged = true;
}

if(changed)
if (m_HavePropertiesChanged)
OnChanged();

serializedObject.ApplyModifiedProperties();
}

protected void OnChanged()
{
tmpro.UpdateText();
havePropertiesChangedProp.boolValue = true;
changed = false;
m_HavePropertiesChanged = false;
m_TextComponent.havePropertiesChanged = true;
m_TextComponent.ComputeMarginSize();
EditorUtility.SetDirty(target);
}

Expand Down
23 changes: 6 additions & 17 deletions Assets/RTLTMPro/Scripts/Editor/RTLTextMeshProEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ namespace RTLTMPro
public class RTLTextMeshProEditor : TMP_UiEditorPanel
{
private SerializedProperty originalTextProp;
private SerializedProperty havePropertiesChangedProp;
private SerializedProperty inputSourceProp;
private SerializedProperty isInputPasingRequiredProp;
private SerializedProperty preserveNumbersProp;
private SerializedProperty farsiProp;
private SerializedProperty fixTagsProp;
private SerializedProperty forceFixProp;

private bool changed;
private bool foldout;
private RTLTextMeshPro tmpro;

Expand All @@ -29,7 +27,6 @@ public class RTLTextMeshProEditor : TMP_UiEditorPanel
fixTagsProp = serializedObject.FindProperty("fixTags");
forceFixProp = serializedObject.FindProperty("forceFix");
originalTextProp = serializedObject.FindProperty("originalText");
havePropertiesChangedProp = serializedObject.FindProperty("m_havePropertiesChanged");
inputSourceProp = serializedObject.FindProperty("m_inputSource");
isInputPasingRequiredProp = serializedObject.FindProperty("m_isInputParsingRequired");
}
Expand All @@ -46,13 +43,6 @@ public override void OnInspectorGUI()
ListenForZeroWidthNoJoiner();

if (EditorGUI.EndChangeCheck())
{
inputSourceProp.enumValueIndex = 0;
isInputPasingRequiredProp.boolValue = true;
changed = true;
}

if (changed)
OnChanged();

serializedObject.ApplyModifiedProperties();
Expand All @@ -65,15 +55,13 @@ public override void OnInspectorGUI()
DrawOptions();

if (GUILayout.Button("Re-Fix"))
changed = true;
m_HavePropertiesChanged = true;

if (EditorGUI.EndChangeCheck())
{
changed = true;
}
m_HavePropertiesChanged = true;
}

if(changed)
if (m_HavePropertiesChanged)
OnChanged();

serializedObject.ApplyModifiedProperties();
Expand All @@ -82,8 +70,9 @@ public override void OnInspectorGUI()
protected void OnChanged()
{
tmpro.UpdateText();
havePropertiesChangedProp.boolValue = true;
changed = false;
m_HavePropertiesChanged = false;
m_TextComponent.havePropertiesChanged = true;
m_TextComponent.ComputeMarginSize();
EditorUtility.SetDirty(target);
}

Expand Down
93 changes: 93 additions & 0 deletions Assets/RTLTMPro/Tests/RTLSupportTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System.Collections;
using System.Collections.Generic;
using System.Security.Policy;
using NUnit.Framework;
using RTLTMPro;
using UnityEngine;
using UnityEngine.TestTools;

namespace Tests
{
public class RTLSupportTests
{
[Test]
public void ArabicTextIsSuccessfulyConverted()
{
const string input = "هَذَا النَّص العربي";
const string expected = "ﻲﺑﺮﻌﻟا ﺺﱠﻨﻟا اَﺬَﻫ";

var support = new RTLSupport
{
Farsi = false, PreserveNumbers = true, FixTextTags = false
};

string result = support.FixRTL(input);

Assert.AreEqual(expected, result);
}

[Test]
public void FarsiTextIsSuccessfulyConverted()
{
const string input = "متن فارسی";
const string expected = "ﯽﺳرﺎﻓ ﻦﺘﻣ";

var support = new RTLSupport
{
Farsi = true, PreserveNumbers = true, FixTextTags = false
};

string result = support.FixRTL(input);

Assert.AreEqual(expected, result);
}

[Test]
public void TashkeelIsMaintainedInBeginingOfText()
{
const string input = "ِصبا";
const string expected = "ِﺎﺒﺻ";

var support = new RTLSupport
{
Farsi = true, PreserveNumbers = true, FixTextTags = false
};

string result = support.FixRTL(input);

Assert.AreEqual(expected, result);
}

[Test]
public void TashkeelIsMaintainedInMiddleOfText()
{
const string input = "مَرد";
const string expected = "دﺮَﻣ";

var support = new RTLSupport
{
Farsi = true, PreserveNumbers = true, FixTextTags = false
};

string result = support.FixRTL(input);

Assert.AreEqual(expected, result);
}

[Test]
public void TashkeelIsMaintainedInEndOfText()
{
const string input = "صبحِ";
const string expected = "ِﺢﺒﺻ";

var support = new RTLSupport
{
Farsi = true, PreserveNumbers = true, FixTextTags = false
};

string result = support.FixRTL(input);

Assert.AreEqual(expected, result);
}
}
}
11 changes: 11 additions & 0 deletions Assets/RTLTMPro/Tests/RTLSupportTests.cs.meta

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

18 changes: 18 additions & 0 deletions Assets/RTLTMPro/Tests/RTLTMPro-Tests.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "RTLTMPro-Tests",
"references": [
"RTLTMPro"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}
7 changes: 7 additions & 0 deletions Assets/RTLTMPro/Tests/RTLTMPro-Tests.asmdef.meta

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

7 changes: 7 additions & 0 deletions Assets/TextMesh Pro/Glyph Report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Font: IRANSansDN Pt. Size: 98
Characters packed: 163/165

Missing Characters
----------------------------------------
ID: 64396 Hex: FB8C Char [ﮌ]
ID: 64397 Hex: FB8D Char [ﮍ]
7 changes: 7 additions & 0 deletions Assets/TextMesh Pro/Glyph Report.txt.meta

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

Loading

0 comments on commit ee58242

Please sign in to comment.