Пример #1
0
 /// <summary>
 /// Private constructor accepting the full set of parameters in order to construct a full PDFFont
 /// </summary>
 /// <param name="family">The fonts family name</param>
 /// <param name="size">The fonts unit size</param>
 /// <param name="style">The fonts style</param>
 /// <param name="isStd">Flag to identify if this is one of the PDF standard fonts.</param>
 public PDFFont(PDFFontSelector selector, PDFUnit size, FontStyle style)
 {
     this._selector = selector;
     this._size     = size;
     this._style    = style;
     this.ClearResourceFont();
 }
        public bool Equals(PDFFontSelector selector)
        {
            if (null == selector)
            {
                return(false);
            }

            else if (string.Equals(this.FamilyName, selector.FamilyName, StringComparison.OrdinalIgnoreCase))
            {
                if (null == selector.Next)
                {
                    return(null == this.Next);
                }
                else if (null == this.Next)
                {
                    return(false);
                }
                else
                {
                    return(this.Next.Equals(selector.Next));
                }
            }
            else
            {
                return(false);
            }
        }
 private void AssertChain(PDFFontSelector entry)
 {
     while (null != entry)
     {
         if (entry == this)
         {
             throw new InvalidOperationException("The linked font selector list is circular and links back to itself. This is not allowed");
         }
         else
         {
             entry = entry.Next;
         }
     }
 }
        public static PDFFontSelector Parse(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }

            var index = value.IndexOf(',');

            if (index < 0)
            {
                var selector = ParseSingle(value);
                return(selector);
            }
            else
            {
                PDFFontSelector root = null;
                PDFFontSelector curr = null;

                string[] all = value.Split(',');

                foreach (var f in all)
                {
                    var one = ParseSingle(f);
                    if (null != one)
                    {
                        if (null == root)
                        {
                            root = one;
                        }
                        if (null != curr)
                        {
                            curr.Next = one;
                        }

                        curr = one;
                    }
                }

                //Return the linked list of names
                return(root);
            }
        }
Пример #5
0
 /// <summary>
 /// Creates a new PDFFont with specified family name and size
 /// </summary>
 /// <param name="family">The family name of the font (e.g. Arial, Helvetica, Courier)</param>
 /// <param name="size">The em size of the font</param>
 /// <param name="style">The new font style</param>
 public PDFFont(string family, PDFUnit size, FontStyle style)
     : this(PDFFontSelector.Parse(family), size, style)
 {
 }
 public PDFFontSelector(string name, PDFFontSelector next)
 {
     this._familyName = name;
     this._next       = next;
 }