Class TextChunkLocationDefaultImp
java.lang.Object
com.itextpdf.kernel.pdf.canvas.parser.listener.TextChunkLocationDefaultImp
- All Implemented Interfaces:
ITextChunkLocation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final floatThe width of a single space character in the font of the chunk.private static final floatprivate final floatDistance of the end of the chunk parallel to the orientation unit vector (i.e.private final floatDistance of the start of the chunk parallel to the orientation unit vector (i.e.private final intPerpendicular distance to the orientation unit vector (i.e.private final VectorThe ending location of the chunk.private final intThe orientation as a scalar for quick sorting.private final VectorUnit vector in the orientation of the chunk.private final VectorThe starting location of the chunk. -
Constructor Summary
ConstructorsConstructorDescriptionTextChunkLocationDefaultImp(Vector startLocation, Vector endLocation, float charSpaceWidth) -
Method Summary
Modifier and TypeMethodDescription(package private) static booleancontainsMark(ITextChunkLocation baseLocation, ITextChunkLocation markLocation) floatComputes the distance between the end of 'other' and the beginning of this chunk in the direction of this chunk's orientation vector.floatfloatintfloatbooleanisAtWordBoundary(ITextChunkLocation previous) intboolean
-
Field Details
-
DIACRITICAL_MARKS_ALLOWED_VERTICAL_DEVIATION
private static final float DIACRITICAL_MARKS_ALLOWED_VERTICAL_DEVIATION- See Also:
-
startLocation
The starting location of the chunk. -
endLocation
The ending location of the chunk. -
orientationVector
Unit vector in the orientation of the chunk. -
orientationMagnitude
private final int orientationMagnitudeThe orientation as a scalar for quick sorting. -
distPerpendicular
private final int distPerpendicularPerpendicular 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 distParallelStartDistance 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 distParallelEndDistance 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 charSpaceWidthThe width of a single space character in the font of the chunk.
-
-
Constructor Details
-
TextChunkLocationDefaultImp
-
-
Method Details
-
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
- Specified by:
getStartLocationin interfaceITextChunkLocation- Returns:
- the start location of the text
-
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
- 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
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
- Specified by:
isAtWordBoundaryin interfaceITextChunkLocation
-
containsMark
-