void LoadFont() { string filename = fontSelection.ToString() + ".FNT"; if (fntFile.Load(Path.Combine(dfUnity.Arena2Path, filename), FileUsage.UseMemory, true)) { lastFontSelection = fontSelection; } }
private void menuItemModernDark_Click(object sender, EventArgs e) { var names = new[] { "Lyon", "Ideal Sans", "Helvetica", "Trebuchet MS", "Calibri" }; Settings.Instance.ReadingFont = FontSelection.GetBest(names, 14); Settings.Instance.ReadingForeColor = Color.LightGray; Settings.Instance.ReadingBackColor = Color.FromArgb(20, 20, 20); Settings.Instance.ReadingWindowColor = Color.FromArgb(20, 20, 20); Settings.Instance.ReadingVertPadding = 10; Settings.Instance.ReadingHorizPadding = 20; LoadSettingsAndDefaults(); }
private void btnFont_Click(object sender, EventArgs e) { #if DEMO new DemoVersionOnly("Changing font").ShowDialog(); #else FontSelection fsForm = new FontSelection(); currentRow.FontId = currentRow.AutoNumber; fsForm.LoadFont(PresenterFont.GetFontFromDatabase(currentRow.FontId)); if (fsForm.ShowDialog() == DialogResult.OK) { PresenterFont.SaveFontToDatabase(currentRow.FontId, fsForm.PresenterFont); } #endif }
private void btnFont_Click(object sender, EventArgs e) { #if DEMO new DemoVersionOnly("Changing font").ShowDialog(); #else FontSelection fsForm = new FontSelection(); fsForm.LoadFont(PresenterFont.GetFontFromDatabase(-2)); if (fsForm.ShowDialog() == DialogResult.OK) { PresenterFont.SaveFontToDatabase(-2, fsForm.PresenterFont); } Program.ConfigHelper.NotifySongDefaultsChanged(); #endif }
private void btnFont_Click(object sender, EventArgs e) { FontSelection f = new FontSelection(); f.LoadFont(proj.font); f.gbAlignment.Visible = false; f.gbEffects.Visible = false; if (f.ShowDialog() == DialogResult.OK) { proj.font = f.PresenterFont; proj.RefreshUI(); proj.dirty = true; } }
private void btnFont_Click(object sender, EventArgs e) { #if DEMO new DemoVersionOnly("Changing font").ShowDialog(); #else FontSelection fsForm = new FontSelection(); fsForm.LoadFont(PresenterFont.GetFontFromDatabase(-1)); fsForm.cbDoubleSpace.Visible = false; fsForm.gbAlignment.Visible = (GetCurrentFormat() != BibleRenderingFormat.MultiTranslation); if (fsForm.ShowDialog() == DialogResult.OK) { PresenterFont.SaveFontToDatabase(-1, fsForm.PresenterFont); proj.RefreshData(); } #endif }
private void btnFont_Click(object sender, EventArgs e) { #if DEMO new DemoVersionOnly("Changing font").ShowDialog(); #else FontSelection fsForm = new FontSelection(); fsForm.LoadFont(PresenterFont.GetFontFromDatabase(proj.currentSong.FontId)); if (fsForm.ShowDialog() == DialogResult.OK) { proj.currentSong.FontId = proj.currentSong.AutoNumber; PresenterFont.SaveFontToDatabase(proj.currentSong.FontId, fsForm.PresenterFont); proj.RefreshData(); } proj.currentSong.AcceptChanges(); #endif }
FontSelection() { instance = this; icon = (Texture2D)Resources.Load("CoreImages/FontIcon", typeof(Texture2D)); DirectoryInfo dir = new DirectoryInfo(Application.dataPath + "/Resources/Fonts"); FileInfo[] info = dir.GetFiles("*.*"); foreach (FileInfo f in info) { if (f.Extension.ToLower() == ".ttf" && !fontDictionary.ContainsKey(f.Name)) { string filePath = Path.GetFileNameWithoutExtension(f.Name); Font font = (Font)Resources.Load("Fonts/" + filePath, typeof(Font)); fontDictionary.Add(f.Name, font); } } }
private void btnChangeFont_Click(object sender, EventArgs e) { #if DEMO new DemoVersionOnly("Changing font").ShowDialog(); #else if (currentRegion == null) { return; } FontSelection fsForm = new FontSelection(); fsForm.LoadFont(currentRegion.textRegion.font); if (fsForm.ShowDialog() == DialogResult.OK) { currentRegion.textRegion.font = (PresenterFont)fsForm.PresenterFont.Clone(); proj.RefreshUI(); proj.dirty = true; } #endif }
void OnGUI() { if (!IsReady()) { EditorGUILayout.HelpBox("DaggerfallUnity instance not ready. Have you set your Arena2 path?", MessageType.Info); return; } // Load font when changed or not loaded if (lastFontSelection != fontSelection || lastBackgroundColor != BackgroundColor || lastTextColor != TextColor || lastFilterMode != TextureFilterMode || !fntFile.IsLoaded) { LoadFont(); UpdateFontPreview(); } // Exit if font not loaded for some reason if (!fntFile.IsLoaded || !fontPreviewTexture) { EditorGUILayout.HelpBox("Could not load font.", MessageType.Info); return; } // Font selection EditorGUILayout.Space(); fontSelection = (FontSelection)EditorGUILayout.EnumPopup(new GUIContent("Font", "Select one of the supported Daggerfall fonts."), (FontSelection)fontSelection); // Font colours BackgroundColor = EditorGUILayout.ColorField(new GUIContent("Background Color", "Background color of font."), BackgroundColor); TextColor = EditorGUILayout.ColorField(new GUIContent("Text Color", "Text color of font."), TextColor); // Preview filtering TextureFilterMode = (FilterMode)EditorGUILayout.EnumPopup(new GUIContent("Filter Mode", "FilterMode of generated texture."), (FilterMode)TextureFilterMode); // Character spacing CharacterSpacing = EditorGUILayout.IntSlider(new GUIContent("Character Spacing", "Number of pixels between characters."), CharacterSpacing, 0, 4); // Resources path ResourcesPath = EditorGUILayout.TextField(new GUIContent("Resources Path", "Target Resources path. Must be a Resources folder."), ResourcesPath.Trim()); // Buttons GUILayoutHelper.Horizontal(() => { if (GUILayout.Button("Reset Colors")) { BackgroundColor = Color.clear; TextColor = Color.white; } if (GUILayout.Button("Generate Custom Font")) { Texture2D fontAtlas; Rect[] fontRects; if (SaveFontTextureAsset(this.FontName, out fontAtlas, out fontRects)) { Font font; Material material; SaveOtherFontAssets(this.FontName, fontAtlas, out font, out material); //ImportFontSettings(fntFile,font, fontRects, CharacterSpacing); } } }); // Note for exporters string path = Path.Combine(ResourcesPath, this.FontName); EditorGUILayout.HelpBox(string.Format("Font will be saved to {0}...", path), MessageType.Info); // Font preview EditorGUILayout.Space(); DrawFontPreview(); }
public SingleTypefaceInfo(string path, DataFormat format, string family, FontRestrictions restrictions, WeightClass weight, WidthClass width, FontSelection selection, long offset) { this.Source = path; this.SourceFormat = format; this.FamilyName = family; this.Restrictions = restrictions; this.FontWeight = weight; this.FontWidth = width; this.Selections = selection; this.OffsetInFile = offset; _thisRef = new IFontInfo[] { this }; }