예제 #1
0
        private void ApplyFontCollection()
        {
            TextMeshProUGUICustom textMeshProComponent = m_textMeshProComponent;

            if (null == m_fontCollection)
            {
                textMeshProComponent.set_font(TMP_FontAsset.get_defaultFontAsset());
                return;
            }
            textMeshProComponent.set_font(m_fontCollection.fontAsset);
            Material styleMaterial = m_fontCollection.styleMaterial;

            if (null != styleMaterial)
            {
                textMeshProComponent.set_fontSharedMaterial(m_fontCollection.styleMaterial);
            }
            else
            {
                textMeshProComponent.set_fontSharedMaterial(textMeshProComponent.get_font().material);
            }
            FontData fontData = m_fontCollection.fontData;

            if (fontData != null)
            {
                textMeshProComponent.set_fontSize(fontData.fontSize);
                textMeshProComponent.set_characterSpacing(fontData.characterSpacing);
                textMeshProComponent.set_wordSpacing(fontData.wordSpacing);
                textMeshProComponent.set_lineSpacing(fontData.lineSpacing);
                textMeshProComponent.set_paragraphSpacing(fontData.paragraphSpacing);
            }
        }