Beispiel #1
0
        private void AddFallbacksToFont(TMP_FontAsset fontAsset, IEnumerable <TMP_FontAsset> fallbacks)
        {
            Plugin.Log.Info($"Adding fallbacks to '{fontAsset.name}' ({(uint)fontAsset.GetHashCode()})");

            fontAsset.fallbackFontAssetTable.RemoveAll(f => kFontNamesToRemove.Contains(f.name));

            foreach (TMP_FontAsset fallback in fallbacks.Reverse())
            {
                TMP_FontAsset fallbackCopy = _fontAssetHelper.CopyFontAsset(fallback, fontAsset.material);

                // insert as first possible fallback font
                fontAsset.fallbackFontAssetTable.Insert(0, fallbackCopy);
            }

            _processedFontAssets.Add(fontAsset);
        }
Beispiel #2
0
        private void ApplyFallbacks(TMP_FontAsset fontAsset, IList <TMP_FontAsset> fallbacks)
        {
            Plugin.Log.Debug($"Adding fallbacks to '{fontAsset.name}' ({(uint)fontAsset.GetHashCode()})");

            fontAsset.fallbackFontAssetTable.RemoveAll(f => kFontNamesToRemove.Contains(f.name));

            foreach (TMP_FontAsset fallback in fallbacks.Reverse())
            {
                TMP_FontAsset fallbackCopy = Object.Instantiate(fallback);

                fallbackCopy.name                    = fallback.name;
                fallbackCopy.material.shader         = fontAsset.material.shader;
                fallbackCopy.material.shaderKeywords = fontAsset.material.shaderKeywords;

                // insert as first possible fallback fonts
                fontAsset.fallbackFontAssetTable.Insert(0, fallbackCopy);
            }
        }