Exemplo n.º 1
0
        public void LoadFontFromZip()
        {
            var f = FIGfont.FromEmbeddedResource("small.zip", typeof(FontsRoot));

            Assert.IsNotNull(f);
            // it doesn't fail and that's a good start
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Loads the font.
        /// </summary>
        /// <returns></returns>
        public override FIGfont LoadFont()
        {
            var font = FIGfont.FromFile(_path);

            font.Name = base.Name;
            return(font);
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        /// <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());
        }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 private static FIGfont LoadSmallFIGfont()
 {
     return(FIGfont.FromEmbeddedResource("small.flf", typeof(FontsRoot)));
 }
Exemplo n.º 7
0
 /// <summary>
 ///     Loads the font.
 /// </summary>
 /// <returns></returns>
 public override FIGfont LoadFont()
 {
     return(FIGfont.FromFile(_path));
 }