private void DrawControls()
        {
            GUILayout.BeginVertical();
            GUILayout.Label("<b>TextMeshPro - Font Asset Creator</b>", TMP_UIStyleManager.Section_Label, GUILayout.Width(300f));
            GUILayout.Label("Font Settings", TMP_UIStyleManager.Section_Label, GUILayout.Width(300f));
            GUILayout.BeginVertical(TMP_UIStyleManager.TextureAreaBox, GUILayout.Width(300f));
            EditorGUIUtility.labelWidth = 120f;
            EditorGUIUtility.fieldWidth = 160f;
            EditorGUI.BeginChangeCheck();
            font_TTF = (EditorGUILayout.ObjectField("Font Source", font_TTF, typeof(Font), false, GUILayout.Width(290f)) as Font);
            if (EditorGUI.EndChangeCheck())
            {
            }
            if (FontSizingOption_Selection == 0)
            {
                FontSizingOption_Selection = EditorGUILayout.Popup("Font Size", FontSizingOption_Selection, FontSizingOptions, GUILayout.Width(290f));
            }
            else
            {
                EditorGUIUtility.labelWidth = 120f;
                EditorGUIUtility.fieldWidth = 40f;
                GUILayout.BeginHorizontal(GUILayout.Width(290f));
                FontSizingOption_Selection = EditorGUILayout.Popup("Font Size", FontSizingOption_Selection, FontSizingOptions, GUILayout.Width(225f));
                font_size = EditorGUILayout.IntField(font_size);
                GUILayout.EndHorizontal();
            }
            EditorGUIUtility.labelWidth = 120f;
            EditorGUIUtility.fieldWidth = 160f;
            font_padding           = EditorGUILayout.IntField("Font Padding", font_padding, GUILayout.Width(290f));
            font_padding           = (int)Mathf.Clamp(font_padding, 0f, 64f);
            m_fontPackingSelection = (FontPackingModes)(object)EditorGUILayout.EnumPopup("Packing Method", m_fontPackingSelection, GUILayout.Width(225f));
            GUILayout.BeginHorizontal(GUILayout.Width(290f));
            GUI.changed = false;
            EditorGUIUtility.labelWidth = 120f;
            EditorGUIUtility.fieldWidth = 40f;
            GUILayout.Label("Atlas Resolution:", GUILayout.Width(116f));
            font_atlas_width  = EditorGUILayout.IntPopup(font_atlas_width, FontResolutionLabels, FontAtlasResolutions);
            font_atlas_height = EditorGUILayout.IntPopup(font_atlas_height, FontResolutionLabels, FontAtlasResolutions);
            GUILayout.EndHorizontal();
            EditorGUI.BeginChangeCheck();
            bool flag = false;

            font_CharacterSet_Selection = EditorGUILayout.Popup("Character Set", font_CharacterSet_Selection, FontCharacterSets, GUILayout.Width(290f));
            if (EditorGUI.EndChangeCheck())
            {
                characterSequence = "";
                flag = true;
            }
            switch (font_CharacterSet_Selection)
            {
            case 0:
                characterSequence = "32 - 126, 160, 8203, 8230, 9633";
                break;

            case 1:
                characterSequence = "32 - 126, 160 - 255, 8192 - 8303, 8364, 8482, 9633";
                break;

            case 2:
                characterSequence = "32 - 64, 91 - 126, 160";
                break;

            case 3:
                characterSequence = "32 - 96, 123 - 126, 160";
                break;

            case 4:
                characterSequence = "32 - 64, 91 - 96, 123 - 126, 160";
                break;

            case 5:
            {
                EditorGUILayout.BeginVertical(TMP_UIStyleManager.TextureAreaBox);
                GUILayout.Label("Enter a sequence of decimal values to define the characters to be included in the font asset or retrieve one from another font asset.", TMP_UIStyleManager.Label);
                GUILayout.Space(10f);
                EditorGUI.BeginChangeCheck();
                m_fontAssetSelection = (EditorGUILayout.ObjectField("Select Font Asset", m_fontAssetSelection, typeof(TMP_FontAsset), false, GUILayout.Width(290f)) as TMP_FontAsset);
                if ((EditorGUI.EndChangeCheck() || flag) && m_fontAssetSelection != null)
                {
                    characterSequence = TMP_EditorUtility.GetDecimalCharacterSequence(TMP_FontAsset.GetCharactersArray(m_fontAssetSelection));
                }
                EditorGUIUtility.labelWidth = 120f;
                char character = Event.current.character;
                if ((character < '0' || character > '9') && (character < ',' || character > '-'))
                {
                    Event.current.character = '\0';
                }
                GUILayout.Label("Character Sequence (Decimal)", TMP_UIStyleManager.Section_Label);
                characterSequence = EditorGUILayout.TextArea(characterSequence, TMP_UIStyleManager.TextAreaBoxWindow, GUILayout.Height(120f), GUILayout.MaxWidth(290f));
                EditorGUILayout.EndVertical();
                break;
            }

            case 6:
            {
                EditorGUILayout.BeginVertical(TMP_UIStyleManager.TextureAreaBox);
                GUILayout.Label("Enter a sequence of Unicode (hex) values to define the characters to be included in the font asset or retrieve one from another font asset.", TMP_UIStyleManager.Label);
                GUILayout.Space(10f);
                EditorGUI.BeginChangeCheck();
                m_fontAssetSelection = (EditorGUILayout.ObjectField("Select Font Asset", m_fontAssetSelection, typeof(TMP_FontAsset), false, GUILayout.Width(290f)) as TMP_FontAsset);
                if ((EditorGUI.EndChangeCheck() || flag) && m_fontAssetSelection != null)
                {
                    characterSequence = TMP_EditorUtility.GetUnicodeCharacterSequence(TMP_FontAsset.GetCharactersArray(m_fontAssetSelection));
                }
                EditorGUIUtility.labelWidth = 120f;
                char character = Event.current.character;
                if ((character < '0' || character > '9') && (character < 'a' || character > 'f') && (character < 'A' || character > 'F') && (character < ',' || character > '-'))
                {
                    Event.current.character = '\0';
                }
                GUILayout.Label("Character Sequence (Hex)", TMP_UIStyleManager.Section_Label);
                characterSequence = EditorGUILayout.TextArea(characterSequence, TMP_UIStyleManager.TextAreaBoxWindow, GUILayout.Height(120f), GUILayout.MaxWidth(290f));
                EditorGUILayout.EndVertical();
                break;
            }

            case 7:
                EditorGUILayout.BeginVertical(TMP_UIStyleManager.TextureAreaBox);
                GUILayout.Label("Type the characters to be included in the font asset or retrieve them from another font asset.", TMP_UIStyleManager.Label);
                GUILayout.Space(10f);
                EditorGUI.BeginChangeCheck();
                m_fontAssetSelection = (EditorGUILayout.ObjectField("Select Font Asset", m_fontAssetSelection, typeof(TMP_FontAsset), false, GUILayout.Width(290f)) as TMP_FontAsset);
                if ((EditorGUI.EndChangeCheck() || flag) && m_fontAssetSelection != null)
                {
                    characterSequence = TMP_FontAsset.GetCharacters(m_fontAssetSelection);
                }
                EditorGUIUtility.labelWidth = 120f;
                EditorGUI.indentLevel       = 0;
                GUILayout.Label("Custom Character List", TMP_UIStyleManager.Section_Label);
                characterSequence = EditorGUILayout.TextArea(characterSequence, TMP_UIStyleManager.TextAreaBoxWindow, GUILayout.Height(120f), GUILayout.MaxWidth(290f));
                EditorGUILayout.EndVertical();
                break;

            case 8:
                characterList = (EditorGUILayout.ObjectField("Character File", characterList, typeof(TextAsset), false, GUILayout.Width(290f)) as TextAsset);
                if (characterList != null)
                {
                    characterSequence = characterList.text;
                }
                break;
            }
            EditorGUIUtility.labelWidth = 120f;
            EditorGUIUtility.fieldWidth = 40f;
            GUILayout.BeginHorizontal(GUILayout.Width(290f));
            font_style     = (FaceStyles)(object)EditorGUILayout.EnumPopup("Font Style:", font_style, GUILayout.Width(225f));
            font_style_mod = EditorGUILayout.IntField((int)font_style_mod);
            GUILayout.EndHorizontal();
            EditorGUI.BeginChangeCheck();
            font_renderMode = (RenderModes)(object)EditorGUILayout.EnumPopup("Font Render Mode:", font_renderMode, GUILayout.Width(290f));
            if (EditorGUI.EndChangeCheck())
            {
            }
            includeKerningPairs         = EditorGUILayout.Toggle("Get Kerning Pairs?", includeKerningPairs, GUILayout.MaxWidth(290f));
            EditorGUIUtility.labelWidth = 120f;
            EditorGUIUtility.fieldWidth = 160f;
            GUILayout.Space(20f);
            GUI.enabled = ((!(font_TTF == null) && !isProcessing) ? true : false);
            if (GUILayout.Button("Generate Font Atlas", GUILayout.Width(290f)) && characterSequence.Length != 0 && GUI.enabled && font_TTF != null)
            {
                int error_Code = TMPro_FontPlugin.Initialize_FontEngine();
                if (error_Code != 0)
                {
                    if (error_Code == 99)
                    {
                        error_Code = 0;
                    }
                    else
                    {
                        Debug.Log("Error Code: " + error_Code + "  occurred while Initializing the FreeType Library.");
                    }
                }
                string assetPath = AssetDatabase.GetAssetPath(font_TTF);
                if (error_Code == 0)
                {
                    error_Code = TMPro_FontPlugin.Load_TrueType_Font(assetPath);
                    if (error_Code != 0)
                    {
                        if (error_Code == 99)
                        {
                            error_Code = 0;
                        }
                        else
                        {
                            Debug.Log("Error Code: " + error_Code + "  occurred while Loading the font.");
                        }
                    }
                }
                if (error_Code == 0)
                {
                    if (FontSizingOption_Selection == 0)
                    {
                        font_size = 72;
                    }
                    error_Code = TMPro_FontPlugin.FT_Size_Font(font_size);
                    if (error_Code != 0)
                    {
                        Debug.Log("Error Code: " + error_Code + "  occurred while Sizing the font.");
                    }
                }
                if (error_Code == 0)
                {
                    int[] character_Set = null;
                    if (font_CharacterSet_Selection == 7 || font_CharacterSet_Selection == 8)
                    {
                        List <int> list = new List <int>();
                        int        i;
                        for (i = 0; i < characterSequence.Length; i++)
                        {
                            if (list.FindIndex((int item) => item == characterSequence[i]) == -1)
                            {
                                list.Add(characterSequence[i]);
                            }
                        }
                        character_Set = list.ToArray();
                    }
                    else if (font_CharacterSet_Selection == 6)
                    {
                        character_Set = ParseHexNumberSequence(characterSequence);
                    }
                    else
                    {
                        character_Set = ParseNumberSequence(characterSequence);
                    }
                    m_character_Count = character_Set.Length;
                    m_texture_buffer  = new byte[font_atlas_width * font_atlas_height];
                    m_font_faceInfo   = default(FT_FaceInfo);
                    m_font_glyphInfo  = new FT_GlyphInfo[m_character_Count];
                    int   padding    = font_padding;
                    bool  autoSizing = (FontSizingOption_Selection == 0) ? true : false;
                    float strokeSize = font_style_mod;
                    if (font_renderMode == RenderModes.DistanceField16)
                    {
                        strokeSize = font_style_mod * 16f;
                    }
                    if (font_renderMode == RenderModes.DistanceField32)
                    {
                        strokeSize = font_style_mod * 32f;
                    }
                    isProcessing = true;
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        isRenderingDone = false;
                        error_Code      = TMPro_FontPlugin.Render_Characters(m_texture_buffer, font_atlas_width, font_atlas_height, padding, character_Set, m_character_Count, font_style, strokeSize, autoSizing, font_renderMode, (int)m_fontPackingSelection, ref m_font_faceInfo, m_font_glyphInfo);
                        isRenderingDone = true;
                    });
                    previewSelection = PreviewSelectionTypes.PreviewFont;
                }
            }
            GUILayout.Space(1f);
            progressRect = GUILayoutUtility.GetRect(288f, 20f, TMP_UIStyleManager.TextAreaBoxWindow, GUILayout.Width(288f), GUILayout.Height(20f));
            GUI.BeginGroup(progressRect);
            GUI.DrawTextureWithTexCoords(new Rect(2f, 0f, 288f, 20f), TMP_UIStyleManager.progressTexture, new Rect(1f - m_renderingProgress, 0f, 1f, 1f));
            GUI.EndGroup();
            GUISkin skin = GUI.skin;

            GUI.skin = TMP_UIStyleManager.TMP_GUISkin;
            GUILayout.Space(5f);
            GUILayout.BeginVertical(TMP_UIStyleManager.TextAreaBoxWindow);
            output_ScrollPosition = EditorGUILayout.BeginScrollView(output_ScrollPosition, GUILayout.Height(145f));
            EditorGUILayout.LabelField(output_feedback, TMP_UIStyleManager.Label);
            EditorGUILayout.EndScrollView();
            GUILayout.EndVertical();
            GUI.skin = skin;
            GUILayout.Space(10f);
            GUI.enabled = ((m_font_Atlas != null) ? true : false);
            if (GUILayout.Button("Save TextMeshPro Font Asset", GUILayout.Width(290f)) && GUI.enabled)
            {
                string empty = string.Empty;
                if (font_renderMode < RenderModes.DistanceField16)
                {
                    empty = EditorUtility.SaveFilePanel("Save TextMesh Pro! Font Asset File", new FileInfo(AssetDatabase.GetAssetPath(font_TTF)).DirectoryName, font_TTF.name, "asset");
                    if (empty.Length == 0)
                    {
                        return;
                    }
                    Save_Normal_FontAsset(empty);
                }
                else if (font_renderMode >= RenderModes.DistanceField16)
                {
                    empty = EditorUtility.SaveFilePanel("Save TextMesh Pro! Font Asset File", new FileInfo(AssetDatabase.GetAssetPath(font_TTF)).DirectoryName, font_TTF.name + " SDF", "asset");
                    if (empty.Length == 0)
                    {
                        return;
                    }
                    Save_SDF_FontAsset(empty);
                }
            }
            GUI.enabled = true;
            GUILayout.Space(5f);
            GUILayout.EndVertical();
            GUILayout.Space(25f);
            Rect controlRect = EditorGUILayout.GetControlRect(false, 5f);

            if (Event.current.type == EventType.Repaint)
            {
                m_UI_Panel_Size = controlRect;
            }
            GUILayout.EndVertical();
        }