static void ReplaceFontForLocalization(FontDictionary dict, Font font)
 {
     if (dict != null && dict.ContainsKey(font.name))
     {
         font.fontNames = dict[font.name].fontNames;
         // Avoid the font to be unloaded in EditorUtility.UnloadUnusedAssetsIgnoreManagedReferences and lose the font name information.
         font.hideFlags = HideFlags.HideAndDontSave;
     }
 }
Example #2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();

            PromptUser.Draw(spriteBatch);



            spriteBatch.DrawString(FontDictionary.getFont("[acknowTT20]"), powered, new Vector2(278, 140), Color.White);


            spriteBatch.End();
        }
    /// <summary>
    /// returns the TextMesh font based on font name
    /// if fontName not matched it will returns default font
    /// </summary>
    /// <param name="fontName"></param>
    /// <returns></returns>
    public TMP_FontAsset GetFont(string fontName)
    {
        FontDictionary font = new FontDictionary();

        font = fontList.Find(obj => obj.fontName.Equals(fontName));

        if (font == null)
        {
            return(fontList[0].font);
        }
        else
        {
            return(font.font);
        }
    }