Package org.openpdf.text.pdf.parser
Class GraphicsState
java.lang.Object
org.openpdf.text.pdf.parser.GraphicsState
Keeps all the parameters of the graphics state.
- Since:
- 2.1.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate floatThe current character spacing.private MatrixThe current transformation matrix.private CMapAwareDocumentFontThe active font.private floatThe current font size.private floatThe current horizontal scalingprivate booleanThe current knockout value.private floatThe current leading.private intThe current render mode.private floatThe current text riseprivate floatThe current word spacing. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new Graphics State object with the default values.GraphicsState(GraphicsState source) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionfloatcalculateCharacterWidthWithoutSpace(float charFontWidth) floatcalculateCharacterWidthWithSpace(float charFontWidth) floatgetCtm()Get the current transformation matrix.getFont()floatGet maximum height above the baseline reached by glyphs in this font, excluding the height of glyphs for accented characters.floatGet maximum depth below the baseline reached by glyphs in this font.floatfloatfloatintfloatgetRise()floatbooleanmultiplyCtm(Matrix matrix) Multiply transformation matrix and get result.voidsetCharacterSpacing(float characterSpacing) voidsetFont(CMapAwareDocumentFont font) voidsetFontSize(float fontSize) voidsetHorizontalScaling(float horizontalScaling) voidsetLeading(float leading) voidsetRenderMode(int renderMode) voidsetRise(float rise) voidsetWordSpacing(float wordSpacing)
-
Field Details
-
ctm
The current transformation matrix. -
characterSpacing
private float characterSpacingThe current character spacing. -
wordSpacing
private float wordSpacingThe current word spacing. -
horizontalScaling
private float horizontalScalingThe current horizontal scaling -
leading
private float leadingThe current leading. -
font
The active font. -
fontSize
private float fontSizeThe current font size. -
renderMode
private int renderModeThe current render mode. -
rise
private float riseThe current text rise -
knockout
private boolean knockoutThe current knockout value.
-
-
Constructor Details
-
GraphicsState
public GraphicsState()Constructs a new Graphics State object with the default values. -
GraphicsState
Copy constructor.- Parameters:
source- another GraphicsState object
-
-
Method Details
-
getCtm
Get the current transformation matrix.- Returns:
- current transformation matrix
-
getCharacterSpacing
public float getCharacterSpacing() -
setCharacterSpacing
public void setCharacterSpacing(float characterSpacing) -
getWordSpacing
public float getWordSpacing() -
setWordSpacing
public void setWordSpacing(float wordSpacing) -
getHorizontalScaling
public float getHorizontalScaling() -
setHorizontalScaling
public void setHorizontalScaling(float horizontalScaling) -
getLeading
public float getLeading() -
setLeading
public void setLeading(float leading) -
getFontAscentDescriptor
public float getFontAscentDescriptor()Get maximum height above the baseline reached by glyphs in this font, excluding the height of glyphs for accented characters.- Returns:
- ascent descriptor value
-
getFontDescentDescriptor
public float getFontDescentDescriptor()Get maximum depth below the baseline reached by glyphs in this font. The value is a negative number- Returns:
- descent descriptor value
-
calculateCharacterWidthWithSpace
public float calculateCharacterWidthWithSpace(float charFontWidth) -
calculateCharacterWidthWithoutSpace
public float calculateCharacterWidthWithoutSpace(float charFontWidth) -
getFont
-
setFont
-
getFontSize
public float getFontSize() -
setFontSize
public void setFontSize(float fontSize) -
getRenderMode
public int getRenderMode() -
setRenderMode
public void setRenderMode(int renderMode) -
getRise
public float getRise() -
setRise
public void setRise(float rise) -
isKnockout
public boolean isKnockout() -
multiplyCtm
Multiply transformation matrix and get result. Result would be also stored in thisGraphicsStateinstance- Parameters:
matrix- multiply by matrix- Returns:
- result matrix
-