protected override bool IsChunkAtWordBoundary(TextChunk chunk, TextChunk previousChunk) { ITextChunkLocation curLoc = chunk.GetLocation(); ITextChunkLocation prevLoc = previousChunk.GetLocation(); if (curLoc.GetStartLocation().Equals(curLoc.GetEndLocation()) || prevLoc.GetEndLocation().Equals(prevLoc.GetStartLocation ())) { return(false); } return(curLoc.DistParallelEnd() - prevLoc.DistParallelStart() > (curLoc.GetCharSpaceWidth() + prevLoc.GetCharSpaceWidth ()) / 2.0f); }
/// <summary> /// Computes the distance between the end of 'other' and the beginning of this chunk /// in the direction of this chunk's orientation vector. /// </summary> /// <remarks> /// 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. /// </remarks> /// <param name="other"/> /// <returns>the number of spaces between the end of 'other' and the beginning of this chunk</returns> public virtual float DistanceFromEndOf(ITextChunkLocation other) { return(DistParallelStart() - other.DistParallelEnd()); }