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 void RenderAll() { var font = LoadFont((FIGfontReference)((FrameworkElement)Font.SelectedItem).Tag); var figDriver = new FIGdriver { Font = font, LayoutRule = LayoutRule }; figDriver.Write(Input.Text); Render.Text = figDriver.ToString(); }
private static void CheckRenderAsSmall(string literal, string expectedRendering, IDrawingElementBlender blender) { var d = new FIGdriver { Font = LoadSmallFIGfont(), Blender = blender }; d.Write(literal); var r = d.ToString(); Assert.IsTrue(Matches(expectedRendering, r)); }