using System.IO; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; namespace ConformalDecals.Text { [DatabaseLoaderAttrib(new[] {"kspfont"})] public class FontLoader : DatabaseLoader { public static List fonts; public override IEnumerator Load(UrlDir.UrlFile urlFile, FileInfo fileInfo) { fonts ??= new List(); Debug.Log($"[ConformalDecals] '{urlFile.fullPath}'"); var bundle = AssetBundle.LoadFromFile(urlFile.fullPath); if (!bundle) { Debug.Log($"[ConformalDecals] could not load font asset {urlFile.fullPath}"); } else { var loadedFonts = bundle.LoadAllAssets(); foreach (var font in loadedFonts) { Debug.Log($"[ConformalDecals] adding font {font.name}" ); fonts.Add(font); Debug.Log($"ConformalDecals] isReadable: {font.atlas.isReadable}"); } } yield break; } } }