Foxit PDF SDK
com.foxit.sdk.pdf.graphics.TextState Class Reference

Public Member Functions

 TextState (int version, Font font, float font_size, float charspace, float wordspace, int textmode, PointF origin_position, float[] textmatrix)
 Constructor, with parameters. More...
 
 TextState ()
 Constructor.
 
 TextState (TextState state)
 Constructor, with another text state object. More...
 
synchronized void delete ()
 Clean up related resources immediately. More...
 
float getCharspace ()
 Get character spacing. More...
 
Font getFont ()
 Get a font object. More...
 
float getFont_size ()
 Get the font size in "Tf". More...
 
PointF getOrigin_position ()
 Get the origin point, in PDF coordinate system. More...
 
float [] getTextmatrix ()
 Get text transformation matrix. More...
 
int getTextmode ()
 Get text rendering mode. More...
 
int getVersion ()
 Get version of this class. More...
 
float getWordspace ()
 Get word spacing (only apply to space character). More...
 
void set (int version, Font font, float font_size, float charspace, float wordspace, int textmode, PointF origin_position, float[] textmatrix)
 Set value. More...
 
void setCharspace (float value)
 Set character spacing. More...
 
void setFont (Font value)
 Set a font object. More...
 
void setFont_size (float value)
 Set the font size in "Tf". More...
 
void setOrigin_position (PointF value)
 Set the origin point, in PDF coordinate system. More...
 
void setTextmatrix (float[] value)
 Set text transformation matrix. More...
 
void setTextmode (int value)
 Set text rendering mode. More...
 
void setVersion (int value)
 Set version of this class. More...
 
void setWordspace (float value)
 Set word spacing (only apply to space character). More...
 

Static Public Attributes

static final int e_ModeClip = 7
 Text mode: add text to path for clipping.
 
static final int e_ModeFill = 0
 Text mode: fill text.
 
static final int e_ModeFillClip = 4
 Text mode: fill text and add to path for clipping.
 
static final int e_ModeFillStroke = 2
 Text mode: fill and stroke text.
 
static final int e_ModeFillStrokeClip = 6
 Text mode: fill and stroke text, and add to path for clipping.
 
static final int e_ModeInvisible = 3
 Text mode: neither fill nor stroke text, to make it invisible.
 
static final int e_ModeStroke = 1
 Text mode: stroke text.
 
static final int e_ModeStrokeClip = 5
 Text mode: stroke text and add to path for clipping.
 

Detailed Description

This class represents PDF text state.

Constructor & Destructor Documentation

◆ TextState() [1/2]

com.foxit.sdk.pdf.graphics.TextState.TextState ( int  version,
Font  font,
float  font_size,
float  charspace,
float  wordspace,
int  textmode,
PointF  origin_position,
float []  textmatrix 
)

Constructor, with parameters.

Parameters
[in]versionVersion of this structure, which is used to decide which members are useful. Currently, only 1 is valid.
[in]font(Version 1) A valid font object.
[in]font_size(Version 1) The font size in "Tf", It should be above 0.
[in]charspace(Version 1) Character spacing.
[in]wordspace(Version 1) Word spacing (only apply to space character).
[in]textmode(Version 1) Text rendering mode. Please refer to values starting from com.foxit.sdk.pdf.graphics.TextState.e_ModeFill and this should be one of these values.
[in]origin_position(Version 1) The origin point, in PDF coordinate system.
[in]textmatrix(Version 1) Text transformation matrix. This is an array of four numbers.
Returns
None.

◆ TextState() [2/2]

com.foxit.sdk.pdf.graphics.TextState.TextState ( TextState  state)

Constructor, with another text state object.

Parameters
[in]stateAnother text state object.

Member Function Documentation

◆ delete()

synchronized void com.foxit.sdk.pdf.graphics.TextState.delete ( )

Clean up related resources immediately.

Returns
None.
Note
Once this function is called, current object cannot be used anymore.

◆ getCharspace()

com.foxit.sdk.pdf.graphics.TextState.getCharspace ( )

Get character spacing.

For horizontal writing, a positive value has the effect of expanding the distance between glyphs, whereas for vertical writing, a negative value has this effect.

Returns
Character spacing.

◆ getFont()

com.foxit.sdk.pdf.graphics.TextState.getFont ( )

Get a font object.

Returns
A font object.

◆ getFont_size()

com.foxit.sdk.pdf.graphics.TextState.getFont_size ( )

Get the font size in "Tf".

Returns
The font size in "Tf". If valid, it should be above 0.

◆ getOrigin_position()

com.foxit.sdk.pdf.graphics.TextState.getOrigin_position ( )

Get the origin point, in PDF coordinate system.

Returns
The origin point, in PDF coordinate system.

◆ getTextmatrix()

com.foxit.sdk.pdf.graphics.TextState.getTextmatrix ( )

Get text transformation matrix.

This is an array of four numbers. The first number is the input coefficient a, the second number is the input coefficient b, the third number is the input coefficient c, the forth number is the input coefficient d.

Returns
Text transformation matrix.

◆ getTextmode()

com.foxit.sdk.pdf.graphics.TextState.getTextmode ( )

Get text rendering mode.

Returns
Text rendering mode. Please refer to values starting from com.foxit.sdk.pdf.graphics.TextState.e_ModeFill and this should be one of these values.

◆ getVersion()

com.foxit.sdk.pdf.graphics.TextState.getVersion ( )

Get version of this class.

Members of this class may be extended in the future. This version can be used to separate the different extended members.

Returns
Version of this class.

◆ getWordspace()

com.foxit.sdk.pdf.graphics.TextState.getWordspace ( )

Get word spacing (only apply to space character).

For horizontal writing, a positive value has the effect of increasing the spacing between words. For vertical writing, a positive value decreases the spacing between words (and a negative value increases it), since vertical coordinates increase from bottom to top. This will not take effect if font of current object is an embedded font.

Returns
Word spacing (only apply to space character).

◆ set()

void com.foxit.sdk.pdf.graphics.TextState.set ( int  version,
Font  font,
float  font_size,
float  charspace,
float  wordspace,
int  textmode,
PointF  origin_position,
float []  textmatrix 
)

Set value.

Parameters
[in]versionVersion of this structure, which is used to decide which members are useful. Currently, only 1 is valid.
[in]font(Version 1) A valid font object.
[in]font_size(Version 1) The font size in "Tf". It should be above 0.
[in]charspace(Version 1) Character spacing.
[in]wordspace(Version 1) Word spacing (only apply to space character).
[in]textmode(Version 1) Text rendering mode. Please refer to values starting from com.foxit.sdk.pdf.graphics.TextState.e_ModeFill and this should be one of these values.
[in]origin_position(Version 1) The origin point, in PDF coordinate system.
[in]textmatrix(Version 1) Text transformation matrix. This is an array of four numbers.
Returns
None.

◆ setCharspace()

com.foxit.sdk.pdf.graphics.TextState.setCharspace ( float  value)

Set character spacing.

For horizontal writing, a positive value has the effect of expanding the distance between glyphs, whereas for vertical writing, a negative value has this effect.

Parameters
[in]valueCharacter spacing.
Returns
None.

◆ setFont()

com.foxit.sdk.pdf.graphics.TextState.setFont ( Font  value)

Set a font object.

Parameters
[in]valueA font object.
Returns
None.

◆ setFont_size()

com.foxit.sdk.pdf.graphics.TextState.setFont_size ( float  value)

Set the font size in "Tf".

Parameters
[in]valueThe font size in "Tf". If valid, it should be above 0.
Returns
None.

◆ setOrigin_position()

com.foxit.sdk.pdf.graphics.TextState.setOrigin_position ( PointF  value)

Set the origin point, in PDF coordinate system.

Parameters
[in]valueThe origin point, in PDF coordinate system.
Returns
None.

◆ setTextmatrix()

com.foxit.sdk.pdf.graphics.TextState.setTextmatrix ( float []  value)

Set text transformation matrix.

This is an array of four numbers. The first number is the input coefficient a, the second number is the input coefficient b, the third number is the input coefficient c, the forth number is the input coefficient d.

Parameters
[in]valueText transformation matrix.
Returns
None.

◆ setTextmode()

com.foxit.sdk.pdf.graphics.TextState.setTextmode ( int  value)

Set text rendering mode.

Parameters
[in]valueText rendering mode. Please refer to values starting from com.foxit.sdk.pdf.graphics.TextState.e_ModeFill and this should be one of these values.
Returns
None.

◆ setVersion()

com.foxit.sdk.pdf.graphics.TextState.setVersion ( int  value)

Set version of this class.

Members of this class may be extended in the future. This version can be used to separate the different extended members.

Parameters
[in]valueVersion of this class.
Returns
None.

◆ setWordspace()

com.foxit.sdk.pdf.graphics.TextState.setWordspace ( float  value)

Set word spacing (only apply to space character).

For horizontal writing, a positive value has the effect of increasing the spacing between words. For vertical writing, a positive value decreases the spacing between words (and a negative value increases it), since vertical coordinates increase from bottom to top. This will not take effect if font of current object is an embedded font.

Parameters
[in]valueWord spacing (only apply to space character).
Returns
None.