/// <summary> /// Add more text to this TextInfo. /// </summary> /// <param name="additionalTextChunk"></param> public void appendText(TextChunkEx additionalTextChunk) { BottomRight = additionalTextChunk.DecentLine.GetEndPoint(); m_Text += additionalTextChunk.Text; }
/// <summary> /// Create a TextInfo. /// </summary> /// <param name="initialTextChunk"></param> public TextInfo(TextChunkEx initialTextChunk) { TopLeft = initialTextChunk.AscentLine.GetStartPoint(); BottomRight = initialTextChunk.DecentLine.GetEndPoint(); m_Text = initialTextChunk.Text; }
/// <summary> /// true if this location is on the the same line as the other text chunk /// </summary> /// <param name="textChunkToCompare">the location to compare to</param> /// <returns>true if this location is on the the same line as the other</returns> public bool sameLine(TextChunkEx textChunkToCompare) { if (m_orientationMagnitude != textChunkToCompare.m_orientationMagnitude) return false; if (m_distPerpendicular != textChunkToCompare.m_distPerpendicular) return false; return true; }
/// <summary> /// Computes the distance between the end of 'other' and the beginning of this chunk /// in the direction of this chunk's orientation vector. Note that it's a bad idea /// to call this for chunks that aren't on the same line and orientation, but we don't /// explicitly check for that condition for performance reasons. /// </summary> /// <param name="other"></param> /// <returns>the number of spaces between the end of 'other' and the beginning of this chunk</returns> public float distanceFromEndOf(TextChunkEx other) { float distance = m_distParallelStart - other.m_distParallelEnd; return distance; }
public object Clone() { TextChunkEx copy = new TextChunkEx(m_text, m_startLocation, m_endLocation, m_charSpaceWidth, AscentLine, DecentLine); return copy; }
/// <summary> /// /// </summary> /// <param name="renderInfo"></param> public override void RenderText(TextRenderInfo renderInfo) { iTextSharp.text.pdf.parser.LineSegment segment = renderInfo.GetBaseline(); TextChunkEx location = new TextChunkEx(renderInfo.GetText(), segment.GetStartPoint(), segment.GetEndPoint(), renderInfo.GetSingleSpaceWidth(), renderInfo.GetAscentLine(), renderInfo.GetDescentLine()); m_locationResult.Add(location); }