public void LoadFontFromZip() { var f = FIGfont.FromEmbeddedResource("small.zip", typeof(FontsRoot)); Assert.IsNotNull(f); // it doesn't fail and that's a good start }
/// <summary> /// Loads the font. /// </summary> /// <returns></returns> public override FIGfont LoadFont() { var font = FIGfont.FromFile(_path); font.Name = base.Name; return(font); }
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(); }
/// <summary> /// Renders the specified text using the given <see cref="FIGfont"/>. /// </summary> /// <param name="font">The font.</param> /// <param name="text">The text.</param> /// <returns></returns> public static string Render(this FIGfont font, string text) { var driver = new FIGdriver(font); driver.Write(text); return(driver.ToString()); }
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 static FIGfont LoadSmallFIGfont() { return(FIGfont.FromEmbeddedResource("small.flf", typeof(FontsRoot))); }
/// <summary> /// Loads the font. /// </summary> /// <returns></returns> public override FIGfont LoadFont() { return(FIGfont.FromFile(_path)); }