protected override void EndProcessing() { FIGfont font = null; if (!string.IsNullOrEmpty(Font)) { font = FIGfontReference.GetFIGfont(Font); } if (font == null) { var first = FIGfontReference.Integrated.First(); if (!string.IsNullOrEmpty(Font)) { WriteWarning($"Can't find a font with the name '{Font}' font. Using default font '{first.Name}'"); } font = first.LoadFont(); } var driver = new FIGdriver(font); driver.LayoutRule = LayoutRule; driver.Write(Message); var output = new PSObject(driver); output.Properties.Add(new PSNoteProperty("Foreground", Foreground)); output.Properties.Add(new PSNoteProperty("Background", Background)); output.Properties.Add(new PSNoteProperty("Colorspace", Colorspace)); output.Properties.Add(new PSNoteProperty("ColorChars", ColorChars)); output.Properties.Add(new PSNoteProperty("Message", Message)); WriteObject(driver); base.EndProcessing(); }
private FIGfont LoadFont(FIGfontReference reference) { if (reference.Name != _currentFontName) { _currentFont = reference.LoadFont(); _currentFontName = reference.Name; Spacing.SelectedItem = Spacing.Items.Cast <FrameworkElement>().FirstOrDefault(e => (LayoutRule)e.Tag == _currentFont.DefaultLayoutRule); } return(_currentFont); }
private void OnLoaded(object sender, RoutedEventArgs e) { FocusManager.SetFocusedElement(Input, Input); Input.TextChanged += delegate { RenderAll(); }; Spacing.SelectionChanged += delegate { RenderAll(); }; Font.SelectionChanged += delegate { RenderAll(); }; var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); var fontRefs = FIGfontReference.Parse(typeof(FontsRoot)).Concat(FIGfontReference.Parse(desktopFolder, true)); foreach (var fontRef in fontRefs.OrderBy(f => f.Name)) { Font.Items.Add(new ComboBoxItem { Content = fontRef.Name, Tag = fontRef }); } Font.SelectedIndex = 0; }
public FontNameCompleter() { Fonts = FIGfontReference.FindFIGfonts().ToArray(); }