private void ImportTTFFont(string fileName, string newTTFName, string newWFNName) { int fontSize = NumberEntryDialog.Show("Font size", "Select the font size to import this TTF font at:", DEFAULT_IMPORTED_FONT_SIZE, 1); if (fontSize > 0) { File.Copy(fileName, newTTFName, true); try { if (File.Exists(newWFNName)) { Factory.AGSEditor.DeleteFileOnDiskAndSourceControl(newWFNName); } Factory.NativeProxy.ReloadFont(_item.ID); _item.PointSize = fontSize; _item.SizeMultiplier = 1; _item.SourceFilename = Utilities.GetRelativeToProjectPath(fileName); } catch (AGSEditorException ex) { Factory.GUIController.ShowMessage("Unable to import the font.\n\n" + ex.Message, MessageBoxIcon.Warning); File.Delete(newTTFName); } } }
private void ImportWFNFont(string fileName, string newTTFName, string newWFNName) { try { if (File.Exists(newTTFName)) { Factory.AGSEditor.DeleteFileOnDiskAndSourceControl(newTTFName); } if (fileName.ToLower().EndsWith(".wfn")) { File.Copy(fileName, newWFNName, true); } else { Factory.NativeProxy.ImportSCIFont(fileName, _item.ID); } Factory.NativeProxy.ReloadFont(_item.ID); _item.PointSize = 0; _item.SizeMultiplier = 1; _item.SourceFilename = Utilities.GetRelativeToProjectPath(fileName); } catch (AGSEditorException ex) { Factory.GUIController.ShowMessage("Unable to import the font.\n\n" + ex.Message, MessageBoxIcon.Warning); } }
private void ImportTTFFont(string fileName, string newTTFName, string newWFNName) { FontHeightDefinition sizeType; int sizeValue; if (!ImportTTFDialog.Show(out sizeType, out sizeValue, _item.PointSize > 0 ? _item.PointSize : DEFAULT_IMPORTED_FONT_SIZE, Int32.MaxValue)) { return; } File.Copy(fileName, newTTFName, true); try { if (File.Exists(newWFNName)) { Factory.AGSEditor.DeleteFileOnDiskAndSourceControl(newWFNName); } Factory.NativeProxy.ReloadFont(_item.ID); // If user asked to get a certain pixel height, then try to change the font's // point size, until found the closest result if (sizeType == FontHeightDefinition.PixelHeight) { sizeValue = Factory.NativeProxy.FindTTFSizeForHeight(newTTFName, sizeValue); } } catch (AGSEditorException ex) { Factory.GUIController.ShowMessage("Unable to import the font.\n\n" + ex.Message, MessageBoxIcon.Warning); File.Delete(newTTFName); } _item.PointSize = sizeValue; _item.SizeMultiplier = 1; _item.SourceFilename = Utilities.GetRelativeToProjectPath(fileName); }
private void _events_GamePostLoad() { Game game = Factory.AGSEditor.CurrentGame; // Convert absolute paths to relative paths. This is an automatic fixup from when the // editor stored absolute paths only foreach (Sprite sprite in game.RootSpriteFolder.GetAllSpritesFromAllSubFolders()) { sprite.SourceFile = Utilities.GetRelativeToProjectPath(sprite.SourceFile); } foreach (Types.Font font in game.Fonts) { font.SourceFilename = Utilities.GetRelativeToProjectPath(font.SourceFilename); } foreach (AudioClip audio in game.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders()) { audio.SourceFileName = Utilities.GetRelativeToProjectPath(audio.SourceFileName); } }
private void _events_GamePostLoad() { Game game = Factory.AGSEditor.CurrentGame; // TODO: this may be noticably slow especially for sprites. Display some kind of // progress window to notify user. // Convert absolute paths to relative paths. This is an automatic fixup from when the // editor stored absolute paths only foreach (Sprite sprite in game.RootSpriteFolder.GetAllSpritesFromAllSubFolders()) { sprite.SourceFile = Utilities.GetRelativeToProjectPath(sprite.SourceFile); } foreach (Types.Font font in game.Fonts) { font.SourceFilename = Utilities.GetRelativeToProjectPath(font.SourceFilename); } foreach (AudioClip audio in game.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders()) { audio.SourceFileName = Utilities.GetRelativeToProjectPath(audio.SourceFileName); } }