iTextSharp.text.Phrase.AddChunk C# (CSharp) Метод

AddChunk() защищенный Метод

Adds a Chunk.
This method is a hack to solve a problem I had with phrases that were split between chunks in the wrong place.
protected AddChunk ( Chunk chunk ) : bool
chunk Chunk a Chunk
Результат bool
        protected bool AddChunk(Chunk chunk) {
    	    Font f = chunk.Font;
    	    String c = chunk.Content;
            if (font != null && !font.IsStandardFont()) {
                f = font.Difference(chunk.Font);
            }
            if (Count > 0 && !chunk.HasAttributes()) {
                try {
                    Chunk previous = (Chunk) this[Count - 1];
                    if (!previous.HasAttributes()
                            && (f == null
                            || f.CompareTo(previous.Font) == 0)
                            && previous.Font.CompareTo(f) == 0
                            && !"".Equals(previous.Content.Trim())
                            && !"".Equals(c.Trim())) {
                        previous.Append(c);
                        return true;
                    }
                }
                catch {
                }
            }
            Chunk newChunk = new Chunk(c, f);
            newChunk.Attributes = chunk.Attributes;
            if (hyphenation != null && newChunk.GetHyphenation() == null && !newChunk.IsEmpty()) {
                newChunk.SetHyphenation(hyphenation);
            }
            base.Add(newChunk);
            return true;
        }