ソースコード
using System; using System.Collections.Generic; using System.Text; using TMPro; namespace Kogane { public static class TMP_CharacterExtensionMethods { private static readonly Encoding ENCODING = Encoding.Unicode; public static TMP_Character FindByCharacter ( this List<TMP_Character> self, string character ) { var bytes = ENCODING.GetBytes( character ); var unicode = BitConverter.ToUInt16( bytes, 0 ); return self.Find( x => x.unicode == unicode ); } } }
使用例
var tmpCharacter = tmpFontAsset.characterTable.FindByCharacter( "あ" );