org.icepdf.core.pobjects.graphics.text
Class WordText

java.lang.Object
  extended by org.icepdf.core.pobjects.graphics.text.AbstractText
      extended by org.icepdf.core.pobjects.graphics.text.WordText
All Implemented Interfaces:
Text, TextSelect

public class WordText
extends AbstractText
implements TextSelect

Word text represents an individual word in the document. A word can also represent white space between words th isWhiteSpace method can be used to distguish between words and whiteSpace

If extracted text has extract white space then the space width fraction can be adjusted. The deault value a 4th of the current character width. To add more sapces the number can be increase or decrease to limit the number of spaces that are added. The system property is as follows: Default
org.icepdf.core.views.page.text.spaceFraction=4

Since:
4.0

Field Summary
static int spaceFraction
           
 
Fields inherited from class org.icepdf.core.pobjects.graphics.text.AbstractText
bounds, hasHighlight, hasSelected, highlight, selected
 
Constructor Summary
WordText()
           
 
Method Summary
protected  void addText(GlyphText sprite)
           
protected  WordText buildSpaceWord(GlyphText sprite)
           
 void clearHighlighted()
           
 void clearSelected()
           
protected static boolean detectPunctuation(GlyphText sprite)
           
protected  boolean detectSpace(GlyphText sprite)
           
protected static boolean detectWhiteSpace(GlyphText sprite)
           
 java.awt.geom.Rectangle2D.Float getBounds()
          Gets the bounds of the respective text object.
 java.util.ArrayList<GlyphText> getGlyphs()
           
 java.lang.StringBuilder getSelected()
           
 java.lang.String getText()
           
static boolean isPunctuation(int c)
           
 boolean isWhiteSpace()
           
static boolean isWhiteSpace(int c)
           
 void selectAll()
           
 void setWhiteSpace(boolean whiteSpace)
           
 java.lang.String toString()
           
 
Methods inherited from class org.icepdf.core.pobjects.graphics.text.AbstractText
clearBounds, hasHighligh, hasSelected, intersects, isHighlighted, isSelected, setHasHighlight, setHasSelected, setHighlighted, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

spaceFraction

public static int spaceFraction
Constructor Detail

WordText

public WordText()
Method Detail

isWhiteSpace

public boolean isWhiteSpace()

setWhiteSpace

public void setWhiteSpace(boolean whiteSpace)

detectSpace

protected boolean detectSpace(GlyphText sprite)

detectPunctuation

protected static boolean detectPunctuation(GlyphText sprite)

detectWhiteSpace

protected static boolean detectWhiteSpace(GlyphText sprite)

isPunctuation

public static boolean isPunctuation(int c)

isWhiteSpace

public static boolean isWhiteSpace(int c)

buildSpaceWord

protected WordText buildSpaceWord(GlyphText sprite)

addText

protected void addText(GlyphText sprite)

getBounds

public java.awt.geom.Rectangle2D.Float getBounds()
Description copied from class: AbstractText
Gets the bounds of the respective text object.

Specified by:
getBounds in interface Text
Specified by:
getBounds in class AbstractText
Returns:
bounds of text object.

getGlyphs

public java.util.ArrayList<GlyphText> getGlyphs()

getSelected

public java.lang.StringBuilder getSelected()
Specified by:
getSelected in interface TextSelect

clearHighlighted

public void clearHighlighted()
Specified by:
clearHighlighted in interface TextSelect

clearSelected

public void clearSelected()
Specified by:
clearSelected in interface TextSelect

selectAll

public void selectAll()
Specified by:
selectAll in interface TextSelect

getText

public java.lang.String getText()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object