private void Setup() { // Setup minimum window size minSize = DefaultWindowSize; // Setting up previews for each character sets DebugFoldout = new DebugCharacterSets(this, PresetCharacterSets); LanguageFoldout = new LanguageSets(this, Languages); FontFoldout = new FontSets(this, Languages, LanguageFoldout.LanguageToUpdate); FontFoldout.OnAfterButtonClicked += OnUpdateFontClicked; FontFoldout.UpdateFonts(); }
private void OnUpdateFontClicked(FontSets source, FontSets.OnClickEventArgs args) { // Setup variables FontAssetCreationSettings settings = args.Font.creationSettings; CurrentSet.Clear(); // Start appending characters already in the settings if (args.ActionToTake == Action.Append) { // Add them to the hashset Add(CurrentSet, TMP_FontAsset.GetCharacters(args.Font)); } // Add all the preset characters foreach (KeyValuePair <PresetCharacters, CharacterSet> pair in PresetCharacterSets) { // Check if this preset should be appended to the hashset if ((args.PresetsToAdd & pair.Key) != 0) { Add(CurrentSet, pair.Value.characters); } } // Go through the languages this font supports foreach (string language in args.Languages) { // Grab the language index int languageIndex = Languages[language]; // Go through all the texts in the translation file foreach (TranslationDictionary.LanguageTextMap languageMap in DictionaryToEdit.AllTranslations.Values) { // Add the text into the set Add(CurrentSet, languageMap[languageIndex]); } } // Apply changes settings.characterSetSelectionMode = 7; settings.characterSequence = ToString(CurrentSet); args.Font.creationSettings = settings; // Open the window TMPro.EditorUtilities.TMPro_FontAssetCreatorWindow.ShowFontAtlasCreatorWindow(args.Font); }