Class TextChunkLocationDefaultImp
- java.lang.Object
-
- com.itextpdf.kernel.pdf.canvas.parser.listener.TextChunkLocationDefaultImp
-
- All Implemented Interfaces:
ITextChunkLocation
class TextChunkLocationDefaultImp extends java.lang.Object implements ITextChunkLocation
-
-
Field Summary
Fields Modifier and Type Field Description private floatcharSpaceWidthThe width of a single space character in the font of the chunk.private static floatDIACRITICAL_MARKS_ALLOWED_VERTICAL_DEVIATIONprivate floatdistParallelEndDistance of the end of the chunk parallel to the orientation unit vector (i.e.private floatdistParallelStartDistance of the start of the chunk parallel to the orientation unit vector (i.e.private intdistPerpendicularPerpendicular distance to the orientation unit vector (i.e.private VectorendLocationThe ending location of the chunk.private intorientationMagnitudeThe orientation as a scalar for quick sorting.private VectororientationVectorUnit vector in the orientation of the chunk.private VectorstartLocationThe starting location of the chunk.
-
Constructor Summary
Constructors Constructor Description TextChunkLocationDefaultImp(Vector startLocation, Vector endLocation, float charSpaceWidth)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static booleancontainsMark(ITextChunkLocation baseLocation, ITextChunkLocation markLocation)floatdistanceFromEndOf(ITextChunkLocation other)Computes the distance between the end of 'other' and the beginning of this chunk in the direction of this chunk's orientation vector.floatdistParallelEnd()floatdistParallelStart()intdistPerpendicular()floatgetCharSpaceWidth()VectorgetEndLocation()VectorgetStartLocation()booleanisAtWordBoundary(ITextChunkLocation previous)intorientationMagnitude()booleansameLine(ITextChunkLocation as)
-
-
-
Field Detail
-
DIACRITICAL_MARKS_ALLOWED_VERTICAL_DEVIATION
private static final float DIACRITICAL_MARKS_ALLOWED_VERTICAL_DEVIATION
- See Also:
- Constant Field Values
-
startLocation
private final Vector startLocation
The starting location of the chunk.
-
endLocation
private final Vector endLocation
The ending location of the chunk.
-
orientationVector
private final Vector orientationVector
Unit vector in the orientation of the chunk.
-
orientationMagnitude
private final int orientationMagnitude
The orientation as a scalar for quick sorting.
-
distPerpendicular
private final int distPerpendicular
Perpendicular distance to the orientation unit vector (i.e. the Y position in an unrotated coordinate system). We round to the nearest integer to handle the fuzziness of comparing floats.
-
distParallelStart
private final float distParallelStart
Distance of the start of the chunk parallel to the orientation unit vector (i.e. the X position in an unrotated coordinate system).
-
distParallelEnd
private final float distParallelEnd
Distance of the end of the chunk parallel to the orientation unit vector (i.e. the X position in an unrotated coordinate system).
-
charSpaceWidth
private final float charSpaceWidth
The width of a single space character in the font of the chunk.
-
-
Method Detail
-
orientationMagnitude
public int orientationMagnitude()
- Specified by:
orientationMagnitudein interfaceITextChunkLocation
-
distPerpendicular
public int distPerpendicular()
- Specified by:
distPerpendicularin interfaceITextChunkLocation
-
distParallelStart
public float distParallelStart()
- Specified by:
distParallelStartin interfaceITextChunkLocation
-
distParallelEnd
public float distParallelEnd()
- Specified by:
distParallelEndin interfaceITextChunkLocation
-
getStartLocation
public Vector getStartLocation()
- Specified by:
getStartLocationin interfaceITextChunkLocation- Returns:
- the start location of the text
-
getEndLocation
public Vector getEndLocation()
- Specified by:
getEndLocationin interfaceITextChunkLocation- Returns:
- the end location of the text
-
getCharSpaceWidth
public float getCharSpaceWidth()
- Specified by:
getCharSpaceWidthin interfaceITextChunkLocation- Returns:
- the width of a single space character as rendered by this chunk
-
sameLine
public boolean sameLine(ITextChunkLocation as)
- Specified by:
sameLinein interfaceITextChunkLocation- Parameters:
as- the location to compare to- Returns:
- true is this location is on the the same line as the other
-
distanceFromEndOf
public float distanceFromEndOf(ITextChunkLocation other)
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.- Specified by:
distanceFromEndOfin interfaceITextChunkLocation- Parameters:
other-- Returns:
- the number of spaces between the end of 'other' and the beginning of this chunk
-
isAtWordBoundary
public boolean isAtWordBoundary(ITextChunkLocation previous)
- Specified by:
isAtWordBoundaryin interfaceITextChunkLocation
-
containsMark
static boolean containsMark(ITextChunkLocation baseLocation, ITextChunkLocation markLocation)
-
-