Difference() публичный Метод

Replaces the attributes that are equal to null with the attributes of a given font.
public Difference ( Font font ) : Font
font Font the font of a bigger element class
Результат Font
Пример #1
0
        // overriding some of the ArrayList-methods

        /// <summary>
        /// Adds a Chunk, an Anchor or another Phrase
        /// to this Phrase.
        /// </summary>
        /// <param name="index">index at which the specified element is to be inserted</param>
        /// <param name="o">an object of type Chunk, Anchor, or Phrase</param>
        public virtual void Add(int index, Object o)
        {
            if (o == null)
            {
                return;
            }
            try {
                IElement element = (IElement)o;
                if (element.Type == Element.CHUNK)
                {
                    Chunk chunk = (Chunk)element;
                    if (!font.IsStandardFont())
                    {
                        chunk.Font = font.Difference(chunk.Font);
                    }
                    base.Insert(index, chunk);
                }
                else if (element.Type == Element.PHRASE ||
                         element.Type == Element.ANCHOR ||
                         element.Type == Element.ANNOTATION ||
                         element.Type == Element.TABLE || // line added by David Freels
                         element.Type == Element.GRAPHIC)
                {
                    base.Insert(index, element);
                }
                else
                {
                    throw new Exception(element.Type.ToString());
                }
            }
            catch (Exception cce) {
                throw new Exception("Insertion of illegal Element: " + cce.Message);
            }
        }
Пример #2
0
 /// <summary>
 /// Adds a Chunk, an Anchor or another Phrase
 /// to this Phrase.
 /// </summary>
 /// <param name="index">index at which the specified element is to be inserted</param>
 /// <param name="o">an object of type Chunk, Anchor, or Phrase</param>
 public virtual void Add(int index, object o)
 {
     if (o == null)
     {
         return;
     }
     try
     {
         IElement element = (IElement)o;
         if (element.Type == Element.CHUNK)
         {
             Chunk chunk = (Chunk)element;
             if (!font.IsStandardFont())
             {
                 chunk.Font = font.Difference(chunk.Font);
             }
             if (hyphenation != null && chunk.GetHyphenation() == null && !chunk.IsEmpty())
             {
                 chunk.SetHyphenation(hyphenation);
             }
             Insert(index, chunk);
         }
         else if (element.Type == Element.PHRASE ||
                  element.Type == Element.ANCHOR ||
                  element.Type == Element.ANNOTATION ||
                  element.Type == Element.TABLE || // line added by David Freels
                  element.Type == Element.YMARK ||
                  element.Type == Element.MARKED)
         {
             Insert(index, element);
         }
         else
         {
             throw new Exception(element.Type.ToString());
         }
     }
     catch (Exception cce)
     {
         throw new Exception("Insertion of illegal Element: " + cce.Message);
     }
 }
Пример #3
0
        // overriding some of the ArrayList-methods

        /// <summary>
        /// Adds a Chunk, an Anchor or another Phrase
        /// to this Phrase.
        /// </summary>
        /// <param name="index">index at which the specified element is to be inserted</param>
        /// <param name="o">an object of type Chunk, Anchor, or Phrase</param>
        public virtual void Add(int index, IElement element)
        {
            if (element == null)
            {
                return;
            }
            switch (element.Type)
            {
            case Element.CHUNK:
                Chunk chunk = (Chunk)element;
                if (!font.IsStandardFont())
                {
                    chunk.Font = font.Difference(chunk.Font);
                }
                if (hyphenation != null && chunk.GetHyphenation() == null && !chunk.IsEmpty())
                {
                    chunk.SetHyphenation(hyphenation);
                }
                base.Insert(index, chunk);
                return;

            case Element.PHRASE:
            case Element.PARAGRAPH:
            case Element.MARKED:
            case Element.DIV:
            case Element.ANCHOR:
            case Element.ANNOTATION:
            case Element.PTABLE:
            case Element.LIST:
            case Element.YMARK:
            case Element.WRITABLE_DIRECT:
                base.Insert(index, element);
                return;

            default:
                throw new Exception(MessageLocalization.GetComposedMessage("insertion.of.illegal.element.1", element.Type.ToString()));
            }
        }
Пример #4
0
        // overriding some of the ArrayList-methods

        /// <summary>
        /// Adds a Chunk, an Anchor or another Phrase
        /// to this Phrase.
        /// </summary>
        /// <param name="index">index at which the specified element is to be inserted</param>
        /// <param name="o">an object of type Chunk, Anchor, or Phrase</param>
        public virtual void Add(int index, Object o)
        {
            if (o == null)
            {
                return;
            }
            try {
                IElement element = (IElement)o;
                if (element.Type == Element.CHUNK)
                {
                    Chunk chunk = (Chunk)element;
                    if (!font.IsStandardFont())
                    {
                        chunk.Font = font.Difference(chunk.Font);
                    }
                    if (hyphenation != null && chunk.GetHyphenation() == null && !chunk.IsEmpty())
                    {
                        chunk.SetHyphenation(hyphenation);
                    }
                    base.Insert(index, chunk);
                }
                else if (element.Type == Element.PHRASE ||
                         element.Type == Element.ANCHOR ||
                         element.Type == Element.ANNOTATION ||
                         element.Type == Element.YMARK ||
                         element.Type == Element.MARKED)
                {
                    base.Insert(index, element);
                }
                else
                {
                    throw new Exception(element.Type.ToString());
                }
            }
            catch (Exception cce) {
                throw new Exception(MessageLocalization.GetComposedMessage("insertion.of.illegal.element.1", cce.Message));
            }
        }