예제 #1
0
 /// <summary>Copy a line of Glyphs.</summary>
 /// <param name="other">line of Glyphs to copy</param>
 public GlyphLine(iText.IO.Font.Otf.GlyphLine other)
 {
     this.glyphs     = other.glyphs;
     this.actualText = other.actualText;
     this.start      = other.start;
     this.end        = other.end;
     this.idx        = other.idx;
 }
예제 #2
0
 /// <summary>Copy a slice of this Glyphline.</summary>
 /// <param name="left">leftmost index of the slice</param>
 /// <param name="right">rightmost index of the slice</param>
 /// <returns>new GlyphLine containing the copied slice</returns>
 public virtual iText.IO.Font.Otf.GlyphLine Copy(int left, int right)
 {
     iText.IO.Font.Otf.GlyphLine glyphLine = new iText.IO.Font.Otf.GlyphLine();
     glyphLine.start      = 0;
     glyphLine.end        = right - left;
     glyphLine.glyphs     = new List <Glyph>(glyphs.SubList(left, right));
     glyphLine.actualText = actualText == null ? null : new List <GlyphLine.ActualText>(actualText.SubList(left,
                                                                                                           right));
     return(glyphLine);
 }
예제 #3
0
 /// <summary>Copy a slice of a line of Glyphs</summary>
 /// <param name="other">line of Glyphs to copy</param>
 /// <param name="start">starting index of the slice</param>
 /// <param name="end">terminating index of the slice</param>
 public GlyphLine(iText.IO.Font.Otf.GlyphLine other, int start, int end)
 {
     this.glyphs = other.glyphs.SubList(start, end);
     if (other.actualText != null)
     {
         this.actualText = other.actualText.SubList(start, end);
     }
     this.start = 0;
     this.end   = end - start;
     this.idx   = other.idx - start;
 }
예제 #4
0
 /// <summary>Add a line to the current one.</summary>
 /// <remarks>
 /// Add a line to the current one.
 /// The glyphs from the start till the end points will be copied.
 /// The same is true for the actual text.
 /// </remarks>
 /// <param name="other">the line that should be added to the current one</param>
 public virtual void Add(iText.IO.Font.Otf.GlyphLine other)
 {
     if (other.actualText != null)
     {
         if (actualText == null)
         {
             actualText = new List <GlyphLine.ActualText>(glyphs.Count);
             for (int i = 0; i < glyphs.Count; i++)
             {
                 actualText.Add(null);
             }
         }
         actualText.AddAll(other.actualText.SubList(other.start, other.end));
     }
     glyphs.AddAll(other.glyphs.SubList(other.start, other.end));
 }
예제 #5
0
 public virtual void ReplaceContent(iText.IO.Font.Otf.GlyphLine other)
 {
     glyphs.Clear();
     glyphs.AddAll(other.glyphs);
     if (actualText != null)
     {
         actualText.Clear();
     }
     if (other.actualText != null)
     {
         if (actualText == null)
         {
             actualText = new List <GlyphLine.ActualText>();
         }
         actualText.AddAll(other.actualText);
     }
     start = other.start;
     end   = other.end;
 }
예제 #6
0
 public override bool Equals(Object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (obj == null || GetType() != obj.GetType())
     {
         return(false);
     }
     iText.IO.Font.Otf.GlyphLine other = (iText.IO.Font.Otf.GlyphLine)obj;
     if (end - start != other.end - other.start)
     {
         return(false);
     }
     if (actualText == null && other.actualText != null || actualText != null && other.actualText == null)
     {
         return(false);
     }
     for (int i = start; i < end; i++)
     {
         int   otherPos   = other.start + i - start;
         Glyph myGlyph    = Get(i);
         Glyph otherGlyph = other.Get(otherPos);
         if (myGlyph == null && otherGlyph != null || myGlyph != null && !myGlyph.Equals(otherGlyph))
         {
             return(false);
         }
         GlyphLine.ActualText myAT    = actualText == null ? null : actualText[i];
         GlyphLine.ActualText otherAT = other.actualText == null ? null : other.actualText[otherPos];
         if (myAT == null && otherAT != null || myAT != null && !myAT.Equals(otherAT))
         {
             return(false);
         }
     }
     return(true);
 }