Example #1
0
        public void OnEnable()
        {
            font_atlas_prop = serializedObject.FindProperty("atlas");
            font_material_prop = serializedObject.FindProperty("material");
            font_normalStyle_prop = serializedObject.FindProperty("NormalStyle");
            font_boldStyle_prop = serializedObject.FindProperty("BoldStyle");
            font_italicStyle_prop = serializedObject.FindProperty("ItalicStyle");

            m_fontInfo_prop = serializedObject.FindProperty("m_fontInfo");
            m_glyphInfoList_prop = serializedObject.FindProperty("m_glyphInfoList");
            m_kerningInfo_prop = serializedObject.FindProperty("m_kerningInfo");
            m_kerningPair_prop = serializedObject.FindProperty("m_kerningPair");

            //m_isGlyphInfoListExpanded_prop = serializedObject.FindProperty("isGlyphInfoListExpanded");
            //m_isKerningTableExpanded_prop = serializedObject.FindProperty("isKerningTableExpanded");

            m_fontAsset = target as TextMeshProFont;
            m_kerningTable = m_fontAsset.kerningInfo;

            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();      

            // GUI Skin 
            if (EditorGUIUtility.isProSkin)
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
            else
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;

            if (mySkin != null)
            {
                SectionLabel = mySkin.FindStyle("Section Label");
                GroupLabel = mySkin.FindStyle("Group Label");
                SquareAreaBox85G = mySkin.FindStyle("Square Area Box (85 Grey)");
            }
        }
Example #2
0
        public void ChangeText(string newtxt)
        {
            TextMeshProFont currentFont = GameSystem.Instance.MainUIController.GetCurrentFont();

            ButtonTextMesh.font = currentFont;
            ButtonTextMesh.text = newtxt;
        }
Example #3
0
        private void Awake()
        {
            gameSystem           = GameSystem.Instance;
            textHistory          = gameSystem.TextHistory;
            stepCount            = textHistory.LineCount - 4;
            Slider.numberOfSteps = Mathf.Clamp(stepCount, 1, 100);
            Slider.value         = 1f;
            lastStep             = Slider.numberOfSteps;
            stepsize             = 1f / (float)lastStep;
            textButtons          = new HistoryTextButton[5];
            TextMeshProFont currentFont = GameSystem.Instance.MainUIController.GetCurrentFont();

            Debug.Log(currentFont);
            for (int i = 0; i < 5; i++)
            {
                textButtons[i] = Labels[i].gameObject.GetComponent <HistoryTextButton>();
                textButtons[i].GetTextMesh().font = currentFont;
            }
            FillText();
            HistoryTextButton[] array = textButtons;
            foreach (HistoryTextButton historyTextButton in array)
            {
                historyTextButton.FadeIn(0.2f);
            }
            BackgroundTexture.alpha = 0f;
            HistoryPanel.alpha      = 0f;
            LeanTween.value(BackgroundTexture.gameObject, delegate(float f)
            {
                BackgroundTexture.alpha = f;
            }, 0f, 0.5f, 0.2f);
            LeanTween.value(HistoryPanel.gameObject, delegate(float f)
            {
                HistoryPanel.alpha = f;
            }, 0f, 1f, 0.2f);
        }
Example #4
0
 public void PushHistory()
 {
     if (historyTextMesh == null)
     {
         historyTextMesh = GameSystem.Instance.HistoryTextMesh;
         fontEnglish     = GameSystem.Instance.MainUIController.GetEnglishFont();
         fontJapanese    = GameSystem.Instance.MainUIController.GetJapaneseFont();
     }
     while (last != null)
     {
         int num  = -1;
         int num2 = -1;
         historyTextMesh.font = fontJapanese;
         historyTextMesh.text = last.TextJapanese;
         TMP_TextInfo textInfo = historyTextMesh.GetTextInfo(last.TextJapanese);
         if (textInfo.lineCount > 4)
         {
             num = textInfo.lineInfo[3].lastCharacterIndex + 1;
         }
         historyTextMesh.font = fontEnglish;
         historyTextMesh.text = last.TextEnglish;
         textInfo             = historyTextMesh.GetTextInfo(last.TextEnglish);
         if (textInfo.lineCount > 4)
         {
             num2 = textInfo.lineInfo[3].lastCharacterIndex + 1;
         }
         if (num == -1 && num2 == -1)
         {
             lines.Add(last);
             last = null;
         }
         else
         {
             string japanese = string.Empty;
             string english  = string.Empty;
             if (num > 0)
             {
                 japanese          = last.TextJapanese.Substring(num);
                 last.TextJapanese = last.TextJapanese.Substring(0, num);
             }
             if (num2 > 0)
             {
                 english          = last.TextEnglish.Substring(num2).Trim();
                 last.TextEnglish = last.TextEnglish.Substring(0, num2);
             }
             lines.Add(last);
             last = new HistoryLine(english, japanese, null);
         }
     }
     if (lines.Count > 100)
     {
         lines.RemoveAt(0);
     }
     last = null;
 }
Example #5
0
        static void ExtractAtlas(MenuCommand command)
        {
            TextMeshProFont font = command.context as TextMeshProFont;
            Texture2D       tex  = Instantiate(font.material.mainTexture) as Texture2D;

            string fontPath = AssetDatabase.GetAssetPath(font);
            string texPath  = Path.GetDirectoryName(fontPath) + "/" + Path.GetFileNameWithoutExtension(fontPath) + " Atlas.png";

            Debug.Log(texPath);
            // Saving File for Debug
            var pngData = tex.EncodeToPNG();

            File.WriteAllBytes(texPath, pngData);

            AssetDatabase.Refresh();
            DestroyImmediate(tex);
        }
        void Start()
        {
            // Add new TextMesh Pro Component
            m_textMeshPro = gameObject.AddComponent <TextMeshPro>();
            //m_textContainer = GetComponent<TextContainer>();

            // Load the Font Asset to be used.
            m_FontAsset        = Resources.Load("Fonts & Materials/ARIAL SDF", typeof(TextMeshProFont)) as TextMeshProFont;
            m_textMeshPro.font = m_FontAsset;

            // Assign Material to TextMesh Pro Component
            //m_textMeshPro.fontSharedMaterial = Resources.Load("Fonts & Materials/ARIAL SDF Bevel", typeof(Material)) as Material;
            //m_textMeshPro.fontSharedMaterial.EnableKeyword("BEVEL_ON");
            // Set various font settings.
            m_textMeshPro.fontSize = 48;

            //m_textMeshPro.anchor = AnchorPositions.Center;
            m_textMeshPro.alignment       = TextAlignmentOptions.Center;
            m_textMeshPro.anchorDampening = true;
            //m_textMeshPro.enableAutoSizing = true;
            //textMeshPro.lineJustification = LineJustificationTypes.Center;
            //textMeshPro.characterSpacing = 0.2f;
            //m_textMeshPro.enableCulling = true;
            //textMeshPro.enableWordWrapping = true;
            //textMeshPro.lineLength = 60;

            //textMeshPro.fontColor = new Color32(255, 255, 255, 255);

            /*
             * for (int i = 0; i <= 1000000; i++)
             * {
             *
             *  m_textMeshPro.SetText(label, i % 1000);
             *
             *  // Example to test the .char function.
             *  //m_chars = (i % 100).ToString().ToCharArray();
             *  //textMeshPro.chars = m_chars;
             *
             *  yield return new WaitForSeconds(0.1f);
             * }
             */
        }
Example #7
0
        void Start()
        {
            // Add new TextMesh Pro Component
            m_textMeshPro = gameObject.AddComponent<TextMeshPro>();
            //m_textContainer = GetComponent<TextContainer>();

            // Load the Font Asset to be used.
            m_FontAsset = Resources.Load("Fonts & Materials/ARIAL SDF", typeof(TextMeshProFont)) as TextMeshProFont;
            m_textMeshPro.font = m_FontAsset;

            // Assign Material to TextMesh Pro Component
            //m_textMeshPro.fontSharedMaterial = Resources.Load("Fonts & Materials/ARIAL SDF Bevel", typeof(Material)) as Material;
            //m_textMeshPro.fontSharedMaterial.EnableKeyword("BEVEL_ON");
            // Set various font settings.
            m_textMeshPro.fontSize = 48;

            //m_textMeshPro.anchor = AnchorPositions.Center;
            m_textMeshPro.alignment = TextAlignmentOptions.Center;
            m_textMeshPro.anchorDampening = true;
            //m_textMeshPro.enableAutoSizing = true;
            //textMeshPro.lineJustification = LineJustificationTypes.Center; 
            //textMeshPro.characterSpacing = 0.2f;
            //m_textMeshPro.enableCulling = true;
            //textMeshPro.enableWordWrapping = true; 
            //textMeshPro.lineLength = 60;

            //textMeshPro.fontColor = new Color32(255, 255, 255, 255);      

            /*
            for (int i = 0; i <= 1000000; i++)
            {
        
                m_textMeshPro.SetText(label, i % 1000);
       
                // Example to test the .char function.
                //m_chars = (i % 100).ToString().ToCharArray();
                //textMeshPro.chars = m_chars;
                         
                yield return new WaitForSeconds(0.1f);
            }
            */
        }
Example #8
0
        public void OnEnable()
        {
            font_atlas_prop       = serializedObject.FindProperty("atlas");
            font_material_prop    = serializedObject.FindProperty("material");
            font_normalStyle_prop = serializedObject.FindProperty("NormalStyle");
            font_boldStyle_prop   = serializedObject.FindProperty("BoldStyle");
            font_italicStyle_prop = serializedObject.FindProperty("ItalicStyle");

            m_fontInfo_prop      = serializedObject.FindProperty("m_fontInfo");
            m_glyphInfoList_prop = serializedObject.FindProperty("m_glyphInfoList");
            m_kerningInfo_prop   = serializedObject.FindProperty("m_kerningInfo");
            m_kerningPair_prop   = serializedObject.FindProperty("m_kerningPair");

            //m_isGlyphInfoListExpanded_prop = serializedObject.FindProperty("isGlyphInfoListExpanded");
            //m_isKerningTableExpanded_prop = serializedObject.FindProperty("isKerningTableExpanded");

            m_fontAsset    = target as TextMeshProFont;
            m_kerningTable = m_fontAsset.kerningInfo;

            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            // GUI Skin
            if (EditorGUIUtility.isProSkin)
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }
            else
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }

            if (mySkin != null)
            {
                SectionLabel     = mySkin.FindStyle("Section Label");
                GroupLabel       = mySkin.FindStyle("Group Label");
                SquareAreaBox85G = mySkin.FindStyle("Square Area Box (85 Grey)");
            }
        }
        public void OnEnable()
        {
            font_atlas_prop = serializedObject.FindProperty("atlas");
            font_material_prop = serializedObject.FindProperty("material");
            font_normalStyle_prop = serializedObject.FindProperty("NormalStyle");
            font_boldStyle_prop = serializedObject.FindProperty("BoldStyle");
            font_italicStyle_prop = serializedObject.FindProperty("ItalicStyle");
            font_tabSize_prop = serializedObject.FindProperty("TabSize");

            m_fontInfo_prop = serializedObject.FindProperty("m_fontInfo");
            m_glyphInfoList_prop = serializedObject.FindProperty("m_glyphInfoList");
            m_kerningInfo_prop = serializedObject.FindProperty("m_kerningInfo");
            m_kerningPair_prop = serializedObject.FindProperty("m_kerningPair");

            //m_isGlyphInfoListExpanded_prop = serializedObject.FindProperty("isGlyphInfoListExpanded");
            //m_isKerningTableExpanded_prop = serializedObject.FindProperty("isKerningTableExpanded");

            m_fontAsset = target as TextMeshProFont;
            m_kerningTable = m_fontAsset.kerningInfo;

            // Get the UI Skin and Styles for the various Editors
            TMP_UIStyleManager.GetUIStyles();
        }
        public void OnEnable()
        {
            font_atlas_prop       = serializedObject.FindProperty("atlas");
            font_material_prop    = serializedObject.FindProperty("material");
            font_normalStyle_prop = serializedObject.FindProperty("NormalStyle");
            font_boldStyle_prop   = serializedObject.FindProperty("BoldStyle");
            font_italicStyle_prop = serializedObject.FindProperty("ItalicStyle");
            font_tabSize_prop     = serializedObject.FindProperty("TabSize");

            m_fontInfo_prop      = serializedObject.FindProperty("m_fontInfo");
            m_glyphInfoList_prop = serializedObject.FindProperty("m_glyphInfoList");
            m_kerningInfo_prop   = serializedObject.FindProperty("m_kerningInfo");
            m_kerningPair_prop   = serializedObject.FindProperty("m_kerningPair");

            //m_isGlyphInfoListExpanded_prop = serializedObject.FindProperty("isGlyphInfoListExpanded");
            //m_isKerningTableExpanded_prop = serializedObject.FindProperty("isKerningTableExpanded");

            m_fontAsset    = target as TextMeshProFont;
            m_kerningTable = m_fontAsset.kerningInfo;

            // Get the UI Skin and Styles for the various Editors
            TMP_UIStyleManager.GetUIStyles();
        }
        void Save_SDF_FontAsset(string filePath)
        {
            filePath = filePath.Substring(0, filePath.Length - 6); // Trim file extension from filePath.

            string dataPath = Application.dataPath;

            if (filePath.IndexOf(dataPath) == -1)
            {
                Debug.LogError("You're saving the font asset in a directory outside of this project folder. This is not supported. Please select a directory under \"" + dataPath + "\"");
                return;
            }

            string relativeAssetPath = filePath.Substring(dataPath.Length - 6);
            string tex_DirName       = Path.GetDirectoryName(relativeAssetPath);
            string tex_FileName      = Path.GetFileNameWithoutExtension(relativeAssetPath);
            string tex_Path_NoExt    = tex_DirName + "/" + tex_FileName;


            // Check if TextMeshPro font asset already exists. If not, create a new one. Otherwise update the existing one.
            TextMeshProFont font_asset = AssetDatabase.LoadAssetAtPath(tex_Path_NoExt + ".asset", typeof(TextMeshProFont)) as TextMeshProFont;

            if (font_asset == null)
            {
                //Debug.Log("Creating TextMeshPro font asset!");
                font_asset = ScriptableObject.CreateInstance <TextMeshProFont>(); // Create new TextMeshPro Font Asset.
                AssetDatabase.CreateAsset(font_asset, tex_Path_NoExt + ".asset");

                if (m_destination_Atlas != null)
                {
                    m_font_Atlas = m_destination_Atlas;
                }

                // If using the C# SDF creation mode, we need the scaledown factor.
                int scaleDownFactor = font_renderMode >= RenderModes.DistanceField16 ? 1 : font_scaledownFactor;

                // Add FaceInfo to Font Asset
                FaceInfo face = GetFaceInfo(m_font_faceInfo, scaleDownFactor);
                font_asset.AddFaceInfo(face);

                // Add GlyphInfo[] to Font Asset
                GlyphInfo[] glyphs = GetGlyphInfo(m_font_glyphInfo, scaleDownFactor);
                font_asset.AddGlyphInfo(glyphs);

                // Get and Add Kerning Pairs to Font Asset
                if (includeKerningPairs)
                {
                    string       fontFilePath = AssetDatabase.GetAssetPath(font_TTF);
                    KerningTable kerningTable = GetKerningTable(fontFilePath, (int)face.PointSize);
                    font_asset.AddKerningInfo(kerningTable);
                }

                // Add Line Breaking Rules
                //LineBreakingTable lineBreakingTable = new LineBreakingTable();
                //

                // Add Font Atlas as Sub-Asset
                font_asset.atlas       = m_font_Atlas;
                m_font_Atlas.name      = tex_FileName + " Atlas";
                m_font_Atlas.hideFlags = HideFlags.HideInHierarchy;
                AssetDatabase.AddObjectToAsset(m_font_Atlas, font_asset);

                // Create new Material and Add it as Sub-Asset
                Shader   default_Shader = Shader.Find("TMPro/Distance Field");
                Material tmp_material   = new Material(default_Shader);
                //tmp_material.shaderKeywords = new string[] { "BEVEL_OFF", "GLOW_OFF", "UNDERLAY_OFF" };
                tmp_material.name = tex_FileName + " Material";
                tmp_material.SetTexture(ShaderUtilities.ID_MainTex, m_font_Atlas);
                tmp_material.SetFloat(ShaderUtilities.ID_TextureWidth, m_font_Atlas.width);
                tmp_material.SetFloat(ShaderUtilities.ID_TextureHeight, m_font_Atlas.height);


                tmp_material.SetFloat(ShaderUtilities.ID_WeightNormal, font_asset.NormalStyle);
                tmp_material.SetFloat(ShaderUtilities.ID_WeightBold, font_asset.BoldStyle);

                int spread = font_renderMode >= RenderModes.DistanceField16 ? font_padding + 1 : font_spread;
                tmp_material.SetFloat(ShaderUtilities.ID_GradientScale, spread); // Spread = Padding for Brute Force SDF.

                font_asset.material    = tmp_material;
                tmp_material.hideFlags = HideFlags.HideInHierarchy;
                AssetDatabase.AddObjectToAsset(tmp_material, font_asset);
            }
            else
            {
                // Find all Materials referencing this font atlas.
                Material[] material_references = TMPro_EditorUtility.FindMaterialReferences(font_asset.material);

                // Destroy Assets that will be replaced.
                DestroyImmediate(font_asset.atlas, true);

                int scaleDownFactor = font_renderMode >= RenderModes.DistanceField16 ? 1 : font_scaledownFactor;
                // Add FaceInfo to Font Asset
                FaceInfo face = GetFaceInfo(m_font_faceInfo, scaleDownFactor);
                font_asset.AddFaceInfo(face);

                // Add GlyphInfo[] to Font Asset
                GlyphInfo[] glyphs = GetGlyphInfo(m_font_glyphInfo, scaleDownFactor);
                font_asset.AddGlyphInfo(glyphs);

                // Get and Add Kerning Pairs to Font Asset
                if (includeKerningPairs)
                {
                    string       fontFilePath = AssetDatabase.GetAssetPath(font_TTF);
                    KerningTable kerningTable = GetKerningTable(fontFilePath, (int)face.PointSize);
                    font_asset.AddKerningInfo(kerningTable);
                }

                // Add Font Atlas as Sub-Asset
                font_asset.atlas       = m_font_Atlas;
                m_font_Atlas.name      = tex_FileName + " Atlas";
                m_font_Atlas.hideFlags = HideFlags.HideInHierarchy;
                AssetDatabase.AddObjectToAsset(m_font_Atlas, font_asset);

                // Update the Texture reference on the Material
                for (int i = 0; i < material_references.Length; i++)
                {
                    material_references[i].SetTexture(ShaderUtilities.ID_MainTex, font_asset.atlas);
                    material_references[i].SetFloat(ShaderUtilities.ID_TextureWidth, m_font_Atlas.width);
                    material_references[i].SetFloat(ShaderUtilities.ID_TextureHeight, m_font_Atlas.height);

                    material_references[i].SetFloat(ShaderUtilities.ID_WeightNormal, font_asset.NormalStyle);
                    material_references[i].SetFloat(ShaderUtilities.ID_WeightBold, font_asset.BoldStyle);

                    int spread = font_renderMode >= RenderModes.DistanceField16 ? font_padding + 1 : font_spread;
                    material_references[i].SetFloat(ShaderUtilities.ID_GradientScale, spread); // Spread = Padding for Brute Force SDF.
                }
            }

            // Saving File for Debug
            //var pngData = destination_Atlas.EncodeToPNG();
            //File.WriteAllBytes("Assets/Textures/Debug Distance Field.png", pngData);
            //font_asset.fontCreationSettings = SaveFontCreationSettings();


            AssetDatabase.SaveAssets();

            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(font_asset));  // Re-import font asset to get the new updated version.

            font_asset.ReadFontDefinition();

            AssetDatabase.Refresh();

            // NEED TO GENERATE AN EVENT TO FORCE A REDRAW OF ANY TEXTMESHPRO INSTANCES THAT MIGHT BE USING THIS FONT ASSET
            TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, font_asset);
        }
        void Save_Normal_FontAsset(string filePath)
        {
            filePath = filePath.Substring(0, filePath.Length - 6); // Trim file extension from filePath.

            string dataPath = Application.dataPath;

            if (filePath.IndexOf(dataPath) == -1)
            {
                Debug.LogError("You're saving the font asset in a directory outside of this project folder. This is not supported. Please select a directory under \"" + dataPath + "\"");
                return;
            }

            string relativeAssetPath = filePath.Substring(dataPath.Length - 6);
            string tex_DirName       = Path.GetDirectoryName(relativeAssetPath);
            string tex_FileName      = Path.GetFileNameWithoutExtension(relativeAssetPath);
            string tex_Path_NoExt    = tex_DirName + "/" + tex_FileName;

            // Check if TextMeshPro font asset already exists. If not, create a new one. Otherwise update the existing one.
            TextMeshProFont font_asset = AssetDatabase.LoadAssetAtPath(tex_Path_NoExt + ".asset", typeof(TextMeshProFont)) as TextMeshProFont;

            if (font_asset == null)
            {
                //Debug.Log("Creating TextMeshPro font asset!");
                font_asset = ScriptableObject.CreateInstance <TextMeshProFont>(); // Create new TextMeshPro Font Asset.
                AssetDatabase.CreateAsset(font_asset, tex_Path_NoExt + ".asset");

                // Add FaceInfo to Font Asset
                FaceInfo face = GetFaceInfo(m_font_faceInfo, 1);
                font_asset.AddFaceInfo(face);

                // Add GlyphInfo[] to Font Asset
                GlyphInfo[] glyphs = GetGlyphInfo(m_font_glyphInfo, 1);
                font_asset.AddGlyphInfo(glyphs);

                // Get and Add Kerning Pairs to Font Asset
                if (includeKerningPairs)
                {
                    string       fontFilePath = AssetDatabase.GetAssetPath(font_TTF);
                    KerningTable kerningTable = GetKerningTable(fontFilePath, (int)face.PointSize);
                    font_asset.AddKerningInfo(kerningTable);
                }


                // Add Font Atlas as Sub-Asset
                font_asset.atlas       = m_font_Atlas;
                m_font_Atlas.name      = tex_FileName + " Atlas";
                m_font_Atlas.hideFlags = HideFlags.HideInHierarchy;
                AssetDatabase.AddObjectToAsset(m_font_Atlas, font_asset);

                // Create new Material and Add it as Sub-Asset
                Shader   default_Shader = Shader.Find("TMPro/Bitmap");
                Material tmp_material   = new Material(default_Shader);
                tmp_material.name = tex_FileName + " Material";
                tmp_material.SetTexture(ShaderUtilities.ID_MainTex, m_font_Atlas);
                font_asset.material    = tmp_material;
                tmp_material.hideFlags = HideFlags.HideInHierarchy;
                AssetDatabase.AddObjectToAsset(tmp_material, font_asset);
            }
            else
            {
                // Find all Materials referencing this font atlas.
                Material[] material_references = TMPro_EditorUtility.FindMaterialReferences(font_asset.material);

                // Destroy Assets that will be replaced.
                DestroyImmediate(font_asset.atlas, true);

                // Add FaceInfo to Font Asset
                FaceInfo face = GetFaceInfo(m_font_faceInfo, 1);
                font_asset.AddFaceInfo(face);

                // Add GlyphInfo[] to Font Asset
                GlyphInfo[] glyphs = GetGlyphInfo(m_font_glyphInfo, 1);
                font_asset.AddGlyphInfo(glyphs);

                // Get and Add Kerning Pairs to Font Asset
                if (includeKerningPairs)
                {
                    string       fontFilePath = AssetDatabase.GetAssetPath(font_TTF);
                    KerningTable kerningTable = GetKerningTable(fontFilePath, (int)face.PointSize);
                    font_asset.AddKerningInfo(kerningTable);
                }

                // Add Font Atlas as Sub-Asset
                font_asset.atlas       = m_font_Atlas;
                m_font_Atlas.name      = tex_FileName + " Atlas";
                m_font_Atlas.hideFlags = HideFlags.HideInHierarchy;
                AssetDatabase.AddObjectToAsset(m_font_Atlas, font_asset);

                // Update the Texture reference on the Material
                for (int i = 0; i < material_references.Length; i++)
                {
                    material_references[i].SetTexture(ShaderUtilities.ID_MainTex, font_asset.atlas);
                }
            }
            AssetDatabase.SaveAssets();

            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(font_asset));  // Re-import font asset to get the new updated version.

            //EditorUtility.SetDirty(font_asset);
            font_asset.ReadFontDefinition();

            AssetDatabase.Refresh();

            // NEED TO GENERATE AN EVENT TO FORCE A REDRAW OF ANY TEXTMESHPRO INSTANCES THAT MIGHT BE USING THIS FONT ASSET
            TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, font_asset);
        }