void PrepareGUI()

        {
            isNewGUI = false;

            TMP_UIStyleManager.GetUIStyles();

            ShaderUtilities.GetShaderPropertyIDs();

            // New GUI just got constructed. This happens in response to a selection,

            // but also after undo/redo events.

            if (lastSeenUndoRedoCount != undoRedoCount)

            {
                // There's been at least one undo/redo since the last time this GUI got constructed.

                // Maybe the undo/redo was for this material? Assume that is was.

                TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, material as Material);
            }

            lastSeenUndoRedoCount = undoRedoCount;
        }
Beispiel #2
0
        private static void ResetSettings(MenuCommand command)
        {
            Material material = null;

            material = ((command.context.GetType() != typeof(Material)) ? Selection.activeGameObject.GetComponent <CanvasRenderer>().GetMaterial() : ((Material)command.context));
            Undo.RecordObject(material, "Reset Material");
            Material material2 = new Material(material.shader);

            ShaderUtilities.GetShaderPropertyIDs();
            if (material.HasProperty(ShaderUtilities.ID_GradientScale))
            {
                material2.SetTexture(ShaderUtilities.ID_MainTex, material.GetTexture(ShaderUtilities.ID_MainTex));
                material2.SetFloat(ShaderUtilities.ID_GradientScale, material.GetFloat(ShaderUtilities.ID_GradientScale));
                material2.SetFloat(ShaderUtilities.ID_TextureWidth, material.GetFloat(ShaderUtilities.ID_TextureWidth));
                material2.SetFloat(ShaderUtilities.ID_TextureHeight, material.GetFloat(ShaderUtilities.ID_TextureHeight));
                material2.SetFloat(ShaderUtilities.ID_StencilID, material.GetFloat(ShaderUtilities.ID_StencilID));
                material2.SetFloat(ShaderUtilities.ID_StencilComp, material.GetFloat(ShaderUtilities.ID_StencilComp));
                material.CopyPropertiesFromMaterial(material2);
                material.shaderKeywords = new string[0];
            }
            else
            {
                material.CopyPropertiesFromMaterial(material2);
            }
            Object.DestroyImmediate(material2);
            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, material);
        }
 public void OnEnable()
 {
     m_editorWindow = this;
     UpdateEditorWindowSize(768f, 768f);
     TMP_UIStyleManager.GetUIStyles();
     ShaderUtilities.GetShaderPropertyIDs();
     TMPro_EventManager.COMPUTE_DT_EVENT.Add(ON_COMPUTE_DT_EVENT);
 }
 public override void OnEnable()
 {
     base.OnEnable();
     TMP_UIStyleManager.GetUIStyles();
     ShaderUtilities.GetShaderPropertyIDs();
     Undo.undoRedoPerformed = (Undo.UndoRedoCallback)Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(OnUndoRedo));
     if (Selection.activeGameObject != null)
     {
         m_textComponent = Selection.activeGameObject.GetComponent <TMP_Text>();
     }
 }
 private void PrepareGUI()
 {
     isNewGUI = false;
     TMP_UIStyleManager.GetUIStyles();
     ShaderUtilities.GetShaderPropertyIDs();
     if (lastSeenUndoRedoCount != undoRedoCount)
     {
         TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, material);
     }
     lastSeenUndoRedoCount = undoRedoCount;
 }
Beispiel #6
0
        static void ResetSettings(MenuCommand command)
        {
            Material mat = null;

            if (command.context.GetType() == typeof(Material))
            {
                mat = (Material)command.context;
            }
            else
            {
                mat = Selection.activeGameObject.GetComponent <CanvasRenderer>().GetMaterial();
            }

            Undo.RecordObject(mat, "Reset Material");

            ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs
            if (mat.HasProperty(ShaderUtilities.ID_GradientScale))
            {
                // Copy unique properties of the SDF Material
                var texture       = mat.GetTexture(ShaderUtilities.ID_MainTex);
                var gradientScale = mat.GetFloat(ShaderUtilities.ID_GradientScale);
                var texWidth      = mat.GetFloat(ShaderUtilities.ID_TextureWidth);
                var texHeight     = mat.GetFloat(ShaderUtilities.ID_TextureHeight);
                var stencilId     = mat.GetFloat(ShaderUtilities.ID_StencilID);
                var stencilComp   = mat.GetFloat(ShaderUtilities.ID_StencilComp);
                var normalWeight  = mat.GetFloat(ShaderUtilities.ID_WeightNormal);
                var boldWeight    = mat.GetFloat(ShaderUtilities.ID_WeightBold);

                // Reset the material
                Unsupported.SmartReset(mat);

                // Reset ShaderKeywords
                mat.shaderKeywords = new string[0]; // { "BEVEL_OFF", "GLOW_OFF", "UNDERLAY_OFF" };

                // Copy unique material properties back to the material.
                mat.SetTexture(ShaderUtilities.ID_MainTex, texture);
                mat.SetFloat(ShaderUtilities.ID_GradientScale, gradientScale);
                mat.SetFloat(ShaderUtilities.ID_TextureWidth, texWidth);
                mat.SetFloat(ShaderUtilities.ID_TextureHeight, texHeight);
                mat.SetFloat(ShaderUtilities.ID_StencilID, stencilId);
                mat.SetFloat(ShaderUtilities.ID_StencilComp, stencilComp);
                mat.SetFloat(ShaderUtilities.ID_WeightNormal, normalWeight);
                mat.SetFloat(ShaderUtilities.ID_WeightBold, boldWeight);
            }
            else
            {
                Unsupported.SmartReset(mat);
            }

            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, mat);
        }
Beispiel #7
0
    public void OnEnable()
    {
        minSize = new Vector2(315, minSize.y);

        // Used for Diagnostics
        m_StopWatch = new System.Diagnostics.Stopwatch();

        // Initialize & Get shader property IDs.
        ShaderUtilities.GetShaderPropertyIDs();

        // Debug Link to received message from Native Code
        //TMPro_FontPlugin.LinkDebugLog(); // Link with C++ Plugin to get Debug output
        OnMyEnable();
    }
Beispiel #8
0
        static void PasteAtlas(MenuCommand command)
        {
            Material mat = command.context as Material;

            Undo.RecordObject(mat, "Paste Texture");

            ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs
            mat.mainTexture = m_copiedAtlasProperties.mainTexture;
            mat.SetFloat(ShaderUtilities.ID_GradientScale, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_GradientScale));
            mat.SetFloat(ShaderUtilities.ID_TextureWidth, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_TextureWidth));
            mat.SetFloat(ShaderUtilities.ID_TextureHeight, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_TextureHeight));

            //DestroyImmediate(m_copiedAtlasProperties);
        }
Beispiel #9
0
    public static Material GetMaskingMaterial(Material baseMaterial, int stencilID)
    {
        // Check if Material supports masking
        if (!baseMaterial.HasProperty(ShaderUtilities.ID_StencilID))
        {
            Debug.LogWarning("Selected Shader does not support Stencil Masking. Please select the Distance Field or Mobile Distance Field Shader.");
            return(baseMaterial);
        }

        Material maskingMaterial = null;

        // Check if baseMaterial already has a masking material associated with it.
        int index = m_materialList.FindIndex(item => item.baseMaterial == baseMaterial && item.stencilID == stencilID);

        if (index == -1)
        {
            //Create new Masking Material Instance for this Base Material
            maskingMaterial = new Material(baseMaterial);
            //maskingMaterial.hideFlags = HideFlags.HideAndDontSave;
            maskingMaterial.name          += " Masking";
            maskingMaterial.shaderKeywords = baseMaterial.shaderKeywords;

            // Set Stencil Properties
            ShaderUtilities.GetShaderPropertyIDs();
            maskingMaterial.SetFloat(ShaderUtilities.ID_StencilID, stencilID);
            maskingMaterial.SetFloat(ShaderUtilities.ID_StencilComp, 3);

            MaskingMaterial temp = new MaskingMaterial();
            temp.baseMaterial    = baseMaterial;
            temp.maskingMaterial = maskingMaterial;
            temp.stencilID       = stencilID;
            temp.count           = 1;

            m_materialList.Add(temp);

            //Debug.Log("Masking material for " + baseMaterial.name + " DOES NOT exists. Creating new " + maskingMaterial.name + " with ID " + maskingMaterial.GetInstanceID() + " which is used " + temp.count + " time(s).");
        }
        else
        {
            maskingMaterial              = m_materialList[index].maskingMaterial;
            m_materialList[index].count += 1;

            //Debug.Log("Masking material for " + baseMaterial.name + " already exists. Passing reference to " + maskingMaterial.name + " with ID " + maskingMaterial.GetInstanceID() + " which is used " + m_materialList[index].count + " time(s).");
        }

        return(maskingMaterial);
    }
Beispiel #10
0
        static void ResetSettings(MenuCommand command)
        {
            Material mat = null;

            if (command.context.GetType() == typeof(Material))
            {
                mat = (Material)command.context;
            }
            else
            {
#if UNITY_4_6 || UNITY_5
                mat = Selection.activeGameObject.GetComponent <CanvasRenderer>().GetMaterial();
#endif
            }


            //Material mat = (Material)command.context;
            Undo.RecordObject(mat, "Reset Material");

            Material tmp_mat = new Material(mat.shader);

            ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs
            if (mat.HasProperty(ShaderUtilities.ID_GradientScale))
            {
                // Copy unique properties of the SDF Material over to the temp material.
                tmp_mat.SetTexture(ShaderUtilities.ID_MainTex, mat.GetTexture(ShaderUtilities.ID_MainTex));
                tmp_mat.SetFloat(ShaderUtilities.ID_GradientScale, mat.GetFloat(ShaderUtilities.ID_GradientScale));
                tmp_mat.SetFloat(ShaderUtilities.ID_TextureWidth, mat.GetFloat(ShaderUtilities.ID_TextureWidth));
                tmp_mat.SetFloat(ShaderUtilities.ID_TextureHeight, mat.GetFloat(ShaderUtilities.ID_TextureHeight));
                tmp_mat.SetFloat(ShaderUtilities.ID_StencilID, mat.GetFloat(ShaderUtilities.ID_StencilID));
                tmp_mat.SetFloat(ShaderUtilities.ID_StencilComp, mat.GetFloat(ShaderUtilities.ID_StencilComp));

                mat.CopyPropertiesFromMaterial(tmp_mat);

                // Reset ShaderKeywords
                mat.shaderKeywords = new string[0]; // { "BEVEL_OFF", "GLOW_OFF", "UNDERLAY_OFF" };
            }
            else
            {
                mat.CopyPropertiesFromMaterial(tmp_mat);
            }

            DestroyImmediate(tmp_mat);

            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, mat);
        }
Beispiel #11
0
        private static void PasteAtlas(MenuCommand command)
        {
            Material material = command.context as Material;

            if (m_copiedAtlasProperties != null)
            {
                Undo.RecordObject(material, "Paste Texture");
                ShaderUtilities.GetShaderPropertyIDs();
                material.SetTexture(ShaderUtilities.ID_MainTex, m_copiedAtlasProperties.GetTexture(ShaderUtilities.ID_MainTex));
                material.SetFloat(ShaderUtilities.ID_GradientScale, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_GradientScale));
                material.SetFloat(ShaderUtilities.ID_TextureWidth, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_TextureWidth));
                material.SetFloat(ShaderUtilities.ID_TextureHeight, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_TextureHeight));
            }
            else if (m_copiedTexture != null)
            {
                Undo.RecordObject(material, "Paste Texture");
                material.SetTexture(ShaderUtilities.ID_MainTex, m_copiedTexture);
            }
        }
Beispiel #12
0
        static void PasteMaterialProperties(MenuCommand command)
        {
            if (m_copiedProperties == null)
            {
                Debug.LogWarning("No Material Properties to Paste. Use Copy Material Properties first.");
                return;
            }

            Material mat = null;

            if (command.context.GetType() == typeof(Material))
            {
                mat = (Material)command.context;
            }
            else
            {
#if UNITY_4_6 || UNITY_5
                mat = Selection.activeGameObject.GetComponent <CanvasRenderer>().GetMaterial();
#endif
            }

            Undo.RecordObject(mat, "Paste Material");

            ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs
            if (mat.HasProperty(ShaderUtilities.ID_GradientScale))
            {
                // Preserve unique SDF properties from destination material.
                m_copiedProperties.SetTexture(ShaderUtilities.ID_MainTex, mat.GetTexture(ShaderUtilities.ID_MainTex));
                m_copiedProperties.SetFloat(ShaderUtilities.ID_GradientScale, mat.GetFloat(ShaderUtilities.ID_GradientScale));
                m_copiedProperties.SetFloat(ShaderUtilities.ID_TextureWidth, mat.GetFloat(ShaderUtilities.ID_TextureWidth));
                m_copiedProperties.SetFloat(ShaderUtilities.ID_TextureHeight, mat.GetFloat(ShaderUtilities.ID_TextureHeight));
            }

            EditorShaderUtilities.CopyMaterialProperties(m_copiedProperties, mat);

            // Copy ShaderKeywords from one material to the other.
            mat.shaderKeywords = m_copiedProperties.shaderKeywords;

            // Let TextMeshPro Objects that this mat has changed.
            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, mat);
        }
Beispiel #13
0
        public CostumeBuilder CostumeSprite(String name, Sprite sprite, float width, float height)
        {
            AddStep("COSTUME_SPRITE", (handler) =>
            {
                // set texture
                var spriteAsset            = ScriptableObject.CreateInstance <TMP_SpriteAsset>();
                spriteAsset.spriteInfoList = new List <TMP_Sprite>();
                spriteAsset.spriteInfoList.Add(new TMP_Sprite()
                {
                    name     = "ui_icon_entertainer_" + name,
                    unicode  = 0,
                    scale    = 1.0f,
                    sprite   = sprite,
                    height   = height,
                    width    = width,
                    pivot    = new Vector2(0, 0),
                    x        = 0,
                    y        = 0,
                    yOffset  = height,
                    xAdvance = width
                });
                spriteAsset.spriteSheet = sprite.texture;
                ShaderUtilities.GetShaderPropertyIDs();
                Material material = new Material(Shader.Find("TextMeshPro/Sprite"));
                material.SetTexture(ShaderUtilities.ID_MainTex, spriteAsset.spriteSheet);
                material.hideFlags   = HideFlags.HideInHierarchy;
                spriteAsset.material = material;
                spriteAsset.hashCode = TMP_TextUtilities.GetSimpleHashCode("ui_icon_entertainer_" + name);
                typeof(TMP_SpriteAsset).GetField("m_FaceInfo",
                                                 BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic)
                ?.SetValue(spriteAsset, FontEngine.GetFaceInfo());
                spriteAsset.UpdateLookupTables();
                MaterialReferenceManager.AddSpriteAsset(spriteAsset);

                handler.Target.costumeSpriteName = name;
                handler.Target.customeSprite     = sprite;
            });
            return(this);
        }
Beispiel #14
0
        private static void PasteMaterialProperties(MenuCommand command)
        {
            if (m_copiedProperties == null)
            {
                Debug.LogWarning("No Material Properties to Paste. Use Copy Material Properties first.");
                return;
            }
            Material material = null;

            material = ((command.context.GetType() != typeof(Material)) ? Selection.activeGameObject.GetComponent <CanvasRenderer>().GetMaterial() : ((Material)command.context));
            Undo.RecordObject(material, "Paste Material");
            ShaderUtilities.GetShaderPropertyIDs();
            if (material.HasProperty(ShaderUtilities.ID_GradientScale))
            {
                m_copiedProperties.SetTexture(ShaderUtilities.ID_MainTex, material.GetTexture(ShaderUtilities.ID_MainTex));
                m_copiedProperties.SetFloat(ShaderUtilities.ID_GradientScale, material.GetFloat(ShaderUtilities.ID_GradientScale));
                m_copiedProperties.SetFloat(ShaderUtilities.ID_TextureWidth, material.GetFloat(ShaderUtilities.ID_TextureWidth));
                m_copiedProperties.SetFloat(ShaderUtilities.ID_TextureHeight, material.GetFloat(ShaderUtilities.ID_TextureHeight));
            }
            EditorShaderUtilities.CopyMaterialProperties(m_copiedProperties, material);
            material.shaderKeywords = m_copiedProperties.shaderKeywords;
            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, material);
        }
Beispiel #15
0
        static void PasteAtlas(MenuCommand command)
        {
            Material mat = command.context as Material;

            if (mat == null)
            {
                return;
            }

            if (m_copiedAtlasProperties != null)
            {
                Undo.RecordObject(mat, "Paste Texture");

                ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs

                if (m_copiedAtlasProperties.HasProperty(ShaderUtilities.ID_MainTex))
                {
                    mat.SetTexture(ShaderUtilities.ID_MainTex, m_copiedAtlasProperties.GetTexture(ShaderUtilities.ID_MainTex));
                }

                if (m_copiedAtlasProperties.HasProperty(ShaderUtilities.ID_GradientScale))
                {
                    mat.SetFloat(ShaderUtilities.ID_GradientScale, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_GradientScale));
                    mat.SetFloat(ShaderUtilities.ID_TextureWidth, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_TextureWidth));
                    mat.SetFloat(ShaderUtilities.ID_TextureHeight, m_copiedAtlasProperties.GetFloat(ShaderUtilities.ID_TextureHeight));
                }
            }
            else if (m_copiedTexture != null)
            {
                Undo.RecordObject(mat, "Paste Texture");

                mat.SetTexture(ShaderUtilities.ID_MainTex, m_copiedTexture);
            }

            //DestroyImmediate(m_copiedAtlasProperties);
        }
Beispiel #16
0
        //==============================================================================
        // 関数
        //==============================================================================
        public void Start(TMP_FontAssetUpdaterSettings settings, Action onComplete = null)
        {
            ShaderUtilities.GetShaderPropertyIDs();

            m_settings      = settings;
            m_font          = settings.SourceFontFile;
            m_fontAssetPath = AssetDatabase.GetAssetPath(settings.FontAsset);

            var fontPath = AssetDatabase.GetAssetPath(m_font);
            var fontName = Path.GetFileNameWithoutExtension(fontPath);
            var filter   = "t:TMP_FontAsset " + fontName + " SDF";

            m_assets = AssetDatabase
                       .FindAssets(filter, new [] { "Assets" })
                       .Select(c => AssetDatabase.GUIDToAssetPath(c))
                       .ToArray()
            ;

            m_characterSequence = m_settings.CustomCharacterList.text;

            if (m_font == null)
            {
                return;
            }

            GameObject.DestroyImmediate(m_fontAtlas);
            m_fontAtlas = null;

            var initResult = TMPro_FontPlugin.Initialize_FontEngine();

            if (initResult != 0 && initResult != 0xF0)
            {
                Debug.Log("Error Code: " + initResult + "  occurred while Initializing the FreeType Library.");
                return;
            }

            var loadResult = TMPro_FontPlugin.Load_TrueType_Font(fontPath);

            if (loadResult != 0 && loadResult != 0xF1)
            {
                Debug.Log("Error Code: " + loadResult + "  occurred while Loading the [" + m_font.name + "] font file. This typically results from the use of an incompatible or corrupted font file.");
                return;
            }

            var sizeResult = TMPro_FontPlugin.FT_Size_Font(SamplingPointSize);

            if (sizeResult != 0)
            {
                Debug.Log("Error Code: " + sizeResult + "  occurred while Sizing the font.");
                return;
            }

            int[] characterSet;
            var   charList = new List <int>();

            for (int i = 0; i < m_characterSequence.Length; i++)
            {
                if (charList.FindIndex(item => item == m_characterSequence[i]) == -1)
                {
                    charList.Add(m_characterSequence[i]);
                }
                else
                {
                    //Debug.Log("Character [" + characterSequence[i] + "] is a duplicate.");
                }
            }

            characterSet = charList.ToArray();

            m_characterCount = characterSet.Length;
            m_textureBuffer  = new byte[AtlasWidth * AtlasHeight];
            m_fontFaceInfo   = new FT_FaceInfo();
            m_fontGlyphInfo  = new FT_GlyphInfo[m_characterCount];

            int padding = Padding;

            var autoSizing = SamplingPointSizeMode == SamplingPointSizes.AutoSizing;
            var strokeSize = FontStyleModifier;

            if (RenderMode == RenderModes.DistanceField16)
            {
                strokeSize = FontStyleModifier * 16;
            }
            if (RenderMode == RenderModes.DistanceField32)
            {
                strokeSize = FontStyleModifier * 32;
            }

            EditorApplication.update += OnUpdate;

            ThreadPool.QueueUserWorkItem(_ =>
            {
                TMPro_FontPlugin.Render_Characters
                (
                    buffer: m_textureBuffer,
                    buffer_width: AtlasWidth,
                    buffer_height: AtlasHeight,
                    character_padding: padding,
                    asc_set: characterSet,
                    char_count: m_characterCount,
                    style: FontStyle,
                    style_mod: strokeSize,
                    autoSize: autoSizing,
                    renderMode: RenderMode,
                    method: ( int )PackingMethod,
                    fontData: ref m_fontFaceInfo,
                    Output: m_fontGlyphInfo
                );

                EditorApplication.delayCall += () =>
                {
                    OnDone();

                    if (onComplete != null)
                    {
                        onComplete();
                    }
                };
            });
        }
Beispiel #17
0
        override public void UpdateGraphics(NGraphics graphics)
        {
            MaterialPropertyBlock block = graphics.materialPropertyBlock;

            if (_format.outline > 0)
            {
                graphics.ToggleKeyword("OUTLINE_ON", true);

                block.SetFloat(ShaderUtilities.ID_OutlineWidth, _format.outline);
                block.SetColor(ShaderUtilities.ID_OutlineColor, _format.outlineColor);
            }
            else
            {
                graphics.ToggleKeyword("OUTLINE_ON", false);

                block.SetFloat(ShaderUtilities.ID_OutlineWidth, 0);
            }

            if (_format.shadowOffset.x != 0 || _format.shadowOffset.y != 0)
            {
                graphics.ToggleKeyword("UNDERLAY_ON", true);

                block.SetColor(ShaderUtilities.ID_UnderlayColor, _format.shadowColor);
                block.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, _format.shadowOffset.x);
                block.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, -_format.shadowOffset.y);
                block.SetFloat(ShaderUtilities.ID_UnderlaySoftness, _format.underlaySoftness);
            }
            else
            {
                graphics.ToggleKeyword("UNDERLAY_ON", false);

                block.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, 0);
                block.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, 0);
                block.SetFloat(ShaderUtilities.ID_UnderlaySoftness, 0);
            }

            block.SetFloat(ShaderUtilities.ID_FaceDilate, _format.faceDilate);
            block.SetFloat(ShaderUtilities.ID_OutlineSoftness, _format.outlineSoftness);

            if (_material.HasProperty(ShaderUtilities.ID_ScaleRatio_A))
            {
                //ShaderUtilities.GetPadding does not support handle materialproperyblock, we have to use a temp material
                _material.SetFloat(ShaderUtilities.ID_OutlineWidth, block.GetFloat(ShaderUtilities.ID_OutlineWidth));
                _material.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, block.GetFloat(ShaderUtilities.ID_UnderlayOffsetX));
                _material.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, block.GetFloat(ShaderUtilities.ID_UnderlayOffsetY));
                _material.SetFloat(ShaderUtilities.ID_UnderlaySoftness, block.GetFloat(ShaderUtilities.ID_UnderlaySoftness));
                _material.SetFloat(ShaderUtilities.ID_FaceDilate, block.GetFloat(ShaderUtilities.ID_FaceDilate));
                _material.SetFloat(ShaderUtilities.ID_OutlineSoftness, block.GetFloat(ShaderUtilities.ID_OutlineSoftness));

                _padding = ShaderUtilities.GetPadding(_material, false, false);

                //and then set back the properteis
                block.SetFloat(ShaderUtilities.ID_ScaleRatio_A, _material.GetFloat(ShaderUtilities.ID_ScaleRatio_A));
                block.SetFloat(ShaderUtilities.ID_ScaleRatio_B, _material.GetFloat(ShaderUtilities.ID_ScaleRatio_B));
                block.SetFloat(ShaderUtilities.ID_ScaleRatio_C, _material.GetFloat(ShaderUtilities.ID_ScaleRatio_C));
            }

            // Set Padding based on selected font style
            #region Handle Style Padding
            if (((_style & FontStyles.Bold) == FontStyles.Bold)) // Checks for any combination of Bold Style.
            {
                if (_material.HasProperty(ShaderUtilities.ID_GradientScale))
                {
                    float gradientScale = _material.GetFloat(ShaderUtilities.ID_GradientScale);
                    _stylePadding = _fontAsset.boldStyle / 4.0f * gradientScale * _material.GetFloat(ShaderUtilities.ID_ScaleRatio_A);

                    // Clamp overall padding to Gradient Scale size.
                    if (_stylePadding + _padding > gradientScale)
                    {
                        _padding = gradientScale - _stylePadding;
                    }
                }
                else
                {
                    _stylePadding = 0;
                }
            }
            else
            {
                if (_material.HasProperty(ShaderUtilities.ID_GradientScale))
                {
                    float gradientScale = _material.GetFloat(ShaderUtilities.ID_GradientScale);
                    _stylePadding = _fontAsset.normalStyle / 4.0f * gradientScale * _material.GetFloat(ShaderUtilities.ID_ScaleRatio_A);

                    // Clamp overall padding to Gradient Scale size.
                    if (_stylePadding + _padding > gradientScale)
                    {
                        _padding = gradientScale - _stylePadding;
                    }
                }
                else
                {
                    _stylePadding = 0;
                }
            }
            #endregion Handle Style Padding
        }