Package com.snowtide.pdf.layout
Interface TextUnit
-
- All Superinterfaces:
Bounded
public interface TextUnit extends Bounded
A single character or discrete character grouping positioned within aLine
.Note that space characters are typically not encoded in PDF documents; rather, they are implicit in the spacing between the bounding boxes of adjacent TextUnits.
- Since:
- v1.4
- Version:
- ©2004-2024 Snowtide
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
TextUnit.Predicate
Type to be satisfied when implementing aTextUnit
predicate for filtering characters in aPage
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description char[]
getCharacterSequence()
Returns the characters that should be rendered for this TextUnit instead of the 'raw' character code provided bygetCharCode()
.int
getCharCode()
Returns the 'raw' character code used to encode this TextUnit in the source PDF document.Font
getFont()
Returns theFont
that was in force when thisTextUnit
was outputted.float
getFontSize()
Returns the size of thefont
used to render thisTextUnit
.float
getTheta()
Returns the angle (in degrees) by which thisTextUnit
's baseline is rotated.boolean
isStruckThrough()
Returns true if thisTextUnit
is struck through (like this).boolean
isUnderlined()
Returns true if thisTextUnit
is underlined (like this).
-
-
-
Method Detail
-
getCharCode
int getCharCode()
Returns the 'raw' character code used to encode this TextUnit in the source PDF document.In many cases, this character code is equivalent to the Unicode character id. Otherwise, the font and encoding information in force when the character code was read from the PDF document dictates that a particular
character sequence
be rendered instead of the Unicode character corresponding to the character code returned by this function.
-
getCharacterSequence
char[] getCharacterSequence()
Returns the characters that should be rendered for this TextUnit instead of the 'raw' character code provided bygetCharCode()
.This function may return null, in which case the Unicode character corresponding with the 'raw' character code should be used when rendering this TextUnit.
-
getFontSize
float getFontSize()
Returns the size of thefont
used to render thisTextUnit
.
-
isUnderlined
boolean isUnderlined()
Returns true if thisTextUnit
is underlined (like this). While this will report an appropriate value for text that is rotated by a "regular" angle (90º, -90º, 180º), it will always return false for text that is rotated by any other angle (i.e. 30º, -45º, 16º, etc).
-
isStruckThrough
boolean isStruckThrough()
Returns true if thisTextUnit
is struck through (like this). This will report an appropriate value for for text that is not rotated, and will return always false otherwise.
-
getTheta
float getTheta()
Returns the angle (in degrees) by which thisTextUnit
's baseline is rotated.
-
-