Foxit PDF SDK

Public Member Functions | Static Public Member Functions | List of all members
foxit::pdf::graphics::TextObject Class Reference
Inheritance diagram for foxit::pdf::graphics::TextObject:

## Public Member Functions
int | GetCharCount () const
| Get character count in current text object. More...
float | GetCharHeightByIndex (int index) const
| Get the height of a character specified by index in current text object. More...
PointF | GetCharPos (int index) const
| Get the position of a character specified by index in current text object. More...
float | GetCharWidthByIndex (int index) const
| Get the width of a character specified by index in current text object. More...
WString | GetText () const
| Get text string. More...
TextState | GetTextState (const PDFPage &page) const
| Get text state information. More...
void | SetText (const wchar_t *text)
| Set text string. More...
void | SetText (const WString &text)
| Set text string. More...
void | SetTextState (const PDFPage &page, const TextState &text_state, bool is_italic, int weight)
| Set text state information. More...
Public Member Functions inherited from foxit::pdf::graphics::GraphicsObject
bool | AddClipPath (const common::Path &path, common::FillMode fill_mode)
| Add a path for clipping. More...
bool | AddClipTextObject (TextObject *textobject)
| Add text object for clipping. More...
bool | ClearClips ()
| Clear all clips. More...
GraphicsObject * | Clone ()
| Clone a new graphics object. More...
GraphicsObject * | Clone (foxit::pdf::GraphicsObjects src_graphicsobjects, foxit::pdf::GraphicsObjects dest_graphicsobjects)
| Clone a new graphics object. More...
BlendMode | GetBlendMode () const
| Get the blend mode for transparent imaging model. More...
common::Path | GetClipPath (int index) const
| Get a path clip by index. More...
int | GetClipPathCount () const
| Get the count of path clip. More...
common::FillMode | GetClipPathFillMode (int index) const
| Get the fill mode of a path clip by index. More...
RectF | GetClipRect () const
| Get clip rectangle. More...
TextObject * | GetClipTextObject (int index) const
| Get the text object of a text clip by index. More...
int | GetClipTextObjectCount () const
| Get the count of text clip. More...
ColorState | GetColorState () const
| Get color state. More...
ARGB | GetFillColor () const
| Get the fill color. More...
float | GetFillOpacity () const
| Get the opacity value for painting operations other than stroking. More...
FormXObject * | GetFormXObject () const
| Get the form XObject graphics object if current graphics object represents a form XObject object. More...
common::GraphState | GetGraphState () const
| Get graph state. More...
ImageObject * | GetImageObject () const
| Get the image graphics object if current graphics object represents an image object. More...
LayerNodeArray | GetLayers (const LayerTree &layer_tree)
| Get all the layers which are associated with current graphics object. More...
MarkedContent * | GetMarkedContent () const
| Get marked content object. More...
Matrix | GetMatrix () const
| Get matrix. More...
PathObject * | GetPathObject () const
| Get the path graphics object if current graphics object represents a path object. More...
RectF | GetRect () const
| Get the rectangle of current graphics object. More...
ShadingObject * | GetShadingObject () const
| Get the shading graphics object if current graphics object represents a shading object. More...
ARGB | GetStrokeColor () const
| Get the stroke color. More...
float | GetStrokeOpacity () const
| Get opacity value for stroke painting operations for paths and glyph outlines. More...
TextObject * | GetTextObject () const
| Get the text graphics object if current graphics object represents a text object. More...
Type | GetType () const
| Get the type of current graphics object. More...
bool | HasTransparency ()
| Check whether current graphics object has transparency or not. More...
void | Release ()
| Release a cloned or newly created PDF graphics object which has not been inserted into any PDF page or other object. More...
bool | RemoveClipPath (int index)
| Remove a path clip by index. More...
bool | RemoveClipTextObject (int index)
| Remove a text clip by index for clipping. More...
void | Rotate (int angle)
| Rotate current graphics object from current state with specified angle degree in clockwise. More...
void | SetBlendMode (BlendMode blend_mode)
| Set the blend mode for transparent imaging model. More...
void | SetClipRect (const RectF &clip_rect)
| Set clip rectangle. More...
void | SetColorState (const ColorState &color_state)
| Set color state. More...
void | SetFillColor (ARGB color)
| Set the fill color. More...
void | SetFillOpacity (float opacity)
| Set the opacity value for painting operations other than stroking. More...
void | SetGraphState (const common::GraphState &graph_state)
| Set graph state. More...
void | SetMatrix (const Matrix &matrix)
| Set matrix. More...
void | SetStrokeColor (ARGB color)
| Set the stroke color. More...
void | SetStrokeOpacity (float opacity)
| Set opacity value for stroke painting operations for paths and glyph outlines. More...
bool | Transform (const Matrix &matrix, bool need_transform_clippath)
| Transform current graphics object. More...

## Static Public Member Functions
static TextObject * | Create ()
| Create a new text graphics object. More...

## Additional Inherited Members
Public Types inherited from foxit::pdf::graphics::GraphicsObject
enum | BlendMode { e_BlendNormal = 0, e_BlendMultiply = 1, e_BlendScreen = 2, e_BlendOverlay = 3, e_BlendDarken = 4, e_BlendLighten = 5, e_BlendColorDodge = 6, e_BlendColorBurn = 7, e_BlendHardlight = 8, e_BlendSoftlight = 9, e_BlendDifference = 10, e_BlendExclusion = 11, e_BlendHue = 21, e_BlendSaturation = 22, e_BlendColor = 23, e_BlendLuminosity = 24 }
| Enumeration for render blend mode. More...
enum | Type { e_TypeAll = 0, e_TypeText = 1, e_TypePath = 2, e_TypeImage = 3, e_TypeShading = 4, e_TypeFormXObject = 5, e_TypeInlines = 6, e_TypeEmptyMarkedContent = 7 }
| Enumeration for PDF graphics object type. More...

## Detailed Description

Text graphics object is a kind of PDF graphics object, so class TextObject is derived from class GraphicsObject. It offers functions to get/set text graphics object's data.
To create a new text graphics object, please use function TextObject::Create and then use setting functions to set information to the new text graphics object.

See also
  GraphicsObject

## Member Function Documentation

## ◆ Create()

static TextObject* foxit::pdf::graphics::TextObject::Create | ( |  | ) |
| static

Create a new text graphics object.

The newly created text graphics object does not have any data yet. Then, setting functions can be called to set data to the new text graphics object. If the newly created text graphics object will not inserted to any page or other objects, please remember to call function GraphicsObject::Release to release it when no use.

Returns
  A new text graphics object. If there is any error, this function will return NULL.

## ◆ GetCharCount()

int foxit::pdf::graphics::TextObject::GetCharCount | ( |  | ) | const

Get character count in current text object.

Returns
  Character count.

## ◆ GetCharHeightByIndex()

float foxit::pdf::graphics::TextObject::GetCharHeightByIndex | ( | int | index | ) | const

Get the height of a character specified by index in current text object.

Parameters

  [in] | index | The index of character whose position is to be retrieved. Valid range: from 0 to (count-1). count is returned by function TextObject::GetCharCount.

Returns
  Height of the specified character.

## ◆ GetCharPos()

PointF foxit::pdf::graphics::TextObject::GetCharPos | ( | int | index | ) | const

Get the position of a character specified by index in current text object.

Parameters

  [in] | index | The index of character whose position is to be retrieved. Valid range: from 0 to (count-1). count is returned by function TextObject::GetCharCount.

Returns
  Position of the specified character, in PDF coordinate system.

## ◆ GetCharWidthByIndex()

float foxit::pdf::graphics::TextObject::GetCharWidthByIndex | ( | int | index | ) | const

Get the width of a character specified by index in current text object.

Parameters

  [in] | index | The index of character whose position is to be retrieved. Valid range: from 0 to (count-1). count is returned by function TextObject::GetCharCount.

Returns
  Width of the specified character.

## ◆ GetText()

WString foxit::pdf::graphics::TextObject::GetText | ( |  | ) | const

Get text string.

Returns
  Text string.

## ◆ GetTextState()

TextState foxit::pdf::graphics::TextObject::GetTextState | ( | const PDFPage & | page | ) | const

Get text state information.

Parameters

  [in] | page | A valid PDF page.Please ensure that current graphics object just belongs to this page.

Returns
  Text state information.

## ◆ SetText() [1/2]

void foxit::pdf::graphics::TextObject::SetText | ( | const wchar_t * | text | ) |

Set text string.

Parameters

  [in] | text | New text string.

Returns
  None.

Note
  Before setting text, please ensure that current text graphics object has valid font which is a part of text state. If not, please call function TextObject::SetTextState to set valid font first; otherwise setting text will fail.
  When this function succeeds, function GraphicsObjects::GenerateContent should be called. Please refer to function GraphicsObjects::GenerateContent for more details.

## ◆ SetText() [2/2]

void foxit::pdf::graphics::TextObject::SetText | ( | const WString & | text | ) |

Set text string.

Parameters

  [in] | text | New text string.

Returns
  None.

Note
  Before setting text, please ensure that current text graphics object has valid font which is a part of text state. If not, please call function TextObject::SetTextState to set valid font first; otherwise setting text will fail.
  When this function succeeds, function GraphicsObjects::GenerateContent should be called. Please refer to function GraphicsObjects::GenerateContent for more details.

## ◆ SetTextState()

void foxit::pdf::graphics::TextObject::SetTextState | ( | const PDFPage & | page,
|  | const TextState & | text_state,
|  | bool | is_italic,
|  | int | weight
| ) |  |

Set text state information.

Parameters

  [in] | page | A valid PDF page.Please ensure that current graphics object just belongs to this page.
  [in] | text_state | New text state information.
  [in] | is_italic | true means the text of current graphics object is italic, while false means not.
  [in] | weight | Original font weight. If the value is larger than 500, that means to use bold.

Returns
  None.

Note
  When this function succeeds, function GraphicsObjects::GenerateContent should be called. Please refer to function GraphicsObjects::GenerateContent for more details.