SignDoc SDK (C++)  5.0.0
SignDocTextCluster Class Reference

A cluster of Unicode code points and glyphs. More...

#include <SignDocSDK-cpp.h>

Public Member Functions

 SignDocTextCluster ()
 Constructor. More...
 
 SignDocTextCluster (const SignDocTextCluster &aSource)
 Copy constructor. More...
 
 ~SignDocTextCluster ()
 Destructor. More...
 
SignDocTextClusteroperator= (const SignDocTextCluster &aSource)
 Assignment operator. More...
 
void swap (SignDocTextCluster &aOther)
 Efficiently swap this object with another one. More...
 
const char * getText () const
 Get the Unicode code points of the cluster (UTF-8). More...
 
int getPage () const
 Get the page on which the glyphs of this object appear. More...
 
void getPages (std::vector< int > &aOutput) const
 Get the pages on which the glyphs of this object appear. More...
 
int getUnicodeDirection () const
 Get the direction implied by the Unicode code points. More...
 
const wchar_t * getTextW () const
 Get the Unicode code points of the cluster (wide string). More...
 
int getNumberOfGlyphs () const
 Get the number of glyphs in this cluster. More...
 
int getGlyphPage (int aIndex) const
 Get the page on which a glyph appears. More...
 
bool getGlyphReferencePoint (int aIndex, double &aX, double &aY) const
 Get the reference point of a glyph. More...
 
bool getGlyphBoundingBox (int aIndex, Rect &aOutput) const
 Get the bounding box of a glyph. More...
 
int getGlyphTextRenderingMode (int aIndex) const
 Get the text rendering mode for a glyph. More...
 
double getGlyphFontSize (int aIndex) const
 Get the font size for a glyph. More...
 
double getGlyphAdvanceWidth (int aIndex) const
 Get the advance width of a glyph. More...
 
 SignDocTextCluster (SIGNDOC_TextCluster *aP)
 Internal function. More...
 
const SIGNDOC_TextCluster * getImpl () const
 Internal function. More...
 

Friends

class SignDocFindTextOccurrence
 
class SignDocTextIterator
 

Detailed Description

A cluster of Unicode code points and glyphs.

An object of this class contains a sequence of Unicode code points and a sequence of glyphs.

In the ideal case, each cluster contains exactly one Unicode code point and one glyph, making the relationship between the two unambiguous.

In the general case, the number of Unicode code points can be different from the number of glyphs and the relationship between the Unicode code points of the cluster and the glyphs of the cluster is unknown.

There can be more glyphs than Unicode code points, more Unicode code points than glyphs (e.g., for a ligature), or the same number of glyphs and Unicode code points.

The clusters returned by SignDocDocument::findText() may contain more characters than have been searched for (as clusters cannot be broken up). If a cluster contains multiple instances of the search text, SignDocDocument::findText() will return multiple instances of that cluster.

Constructor & Destructor Documentation

SignDocTextCluster ( )
inline

Constructor.

SignDocTextCluster ( const SignDocTextCluster aSource)
inline

Copy constructor.

Parameters
[in]aSourceThe object to be copied.
~SignDocTextCluster ( )
inline

Destructor.

SignDocTextCluster ( SIGNDOC_TextCluster *  aP)
inline

Internal function.

Member Function Documentation

double getGlyphAdvanceWidth ( int  aIndex) const
inline

Get the advance width of a glyph.

Parameters
[in]aIndexThe 0-based index of the glyph. The order of the glyphs is unspecified.
Returns
The advance width the glyph in document coordinates (see Coordinate Systems) or 0.0 if aIndex is out of range.
See also
getGlyphBoundingBox(), getNumberOfGlyphs()
bool getGlyphBoundingBox ( int  aIndex,
Rect aOutput 
) const
inline

Get the bounding box of a glyph.

Parameters
[in]aIndexThe 0-based index of the glyph. The order of the glyphs is unspecified.
[out]aOutputThe bounding box of the glyph in document coordinates, see Coordinate Systems.
Returns
true on success, false if the bounding box is not available or if aIndex is out of range.
See also
getGlyphReferencePoint(), getNumberOfGlyphs()
double getGlyphFontSize ( int  aIndex) const
inline

Get the font size for a glyph.

Parameters
[in]aIndexThe 0-based index of the glyph. The order of the glyphs is unspecified.
Returns
The font size of the glyph or 0.0 if aIndex is out of range.
See also
getNumberOfGlyphs()
int getGlyphPage ( int  aIndex) const
inline

Get the page on which a glyph appears.

In extreme (theoretical) cases, the glyphs of a single cluster can appear on different pages, even on pages outside the range of pages passed to SignDocDocument::findText() or SignDocDocument::createTextIterator().

Parameters
[in]aIndexThe 0-based index of the glyph. The order of the glyphs is unspecified.
Returns
The 1-based page number of the page on which the glyph appears or 0 if aIndex is out of range.
See also
getNumberOfGlyphs(), getPage(), getPages(), SignDocFindTextOccurrence::getPage()
bool getGlyphReferencePoint ( int  aIndex,
double &  aX,
double &  aY 
) const
inline

Get the reference point of a glyph.

Parameters
[in]aIndexThe 0-based index of the glyph. The order of the glyphs is unspecified.
[out]aXThe X coordinate of the reference point of the glyph in document coordinates (see Coordinate Systems).
[out]aYThe Y coordinate of the reference point of the glyph in document coordinates.
Returns
true on success, false if aIndex is out of range.
See also
getGlyphBoundingBox(), getNumberOfGlyphs()
int getGlyphTextRenderingMode ( int  aIndex) const
inline

Get the text rendering mode for a glyph.

Parameters
[in]aIndexThe 0-based index of the glyph. The order of the glyphs is unspecified.
Returns
The text rendering mode for the glyph, as defined in the PDF specification. 0 if aIndex is out of range or if the text rendering mode is invalid.
See also
getNumberOfGlyphs()
const SIGNDOC_TextCluster* getImpl ( ) const
inline

Internal function.

int getNumberOfGlyphs ( ) const
inline

Get the number of glyphs in this cluster.

The order of the glyphs is unspecified.

Returns
The number of glyphs in this cluster.
int getPage ( ) const
inline

Get the page on which the glyphs of this object appear.

The glyphs of a can appear on different pages, even on pages outside the range of pages passed to SignDocDocument::findText() or SignDocDocument::createTextIterator().

Returns
The 1-based page number of the page on which the glyphs appear or 0 if the glyphs appear on two or more different pages.
See also
getGlyphPage(), getPages(), SignDocFindTextOccurrence::getPage()
void getPages ( std::vector< int > &  aOutput) const
inline

Get the pages on which the glyphs of this object appear.

The glyphs of a can appear on different pages, even on pages outside the range of pages passed to SignDocDocument::findText() or SignDocDocument::createTextIterator().

Parameters
[out]aOutputThe 1-based page numbers of the pages on which the glyphs appear will be stored here.
See also
getGlyphPage(), getPage(), SignDocFindTextOccurrence::getPages()
const char * getText ( ) const
inline

Get the Unicode code points of the cluster (UTF-8).

Returns
A pointer to the UTF-8-encoded Unicode code points of the cluster, in logical order. The string must not be modifed and it must not be destroyed. The pointer will become invalid when this object is destroyed.
See also
getTextW()
const wchar_t * getTextW ( ) const
inline

Get the Unicode code points of the cluster (wide string).

Returns
A pointer to the UTF-16-encoded (Windows) or UTF-32-encoded (everywhere else) Unicode code points of the cluster, in logical order. The string must not be modifed and it must not be destroyed. The pointer will become invalid when this object is destroyed.
See also
getText()
int getUnicodeDirection ( ) const
inline

Get the direction implied by the Unicode code points.

A lot of characters (such as punctuation characters) do not imply a direction. Unless there is at least one character that defines a direction, 0 will be returned. 0 is also returned if there are conflicting directions.

Returns
-1 for RTL, 1 for LTR, 0 if the direction cannot be determined unambiguously.
SignDocTextCluster & operator= ( const SignDocTextCluster aSource)
inline

Assignment operator.

Parameters
[in]aSourceThe source object.
Returns
This object.
void swap ( SignDocTextCluster aOther)
inline

Efficiently swap this object with another one.

Parameters
[in]aOtherThe other object.

Friends And Related Function Documentation

friend class SignDocFindTextOccurrence
friend
friend class SignDocTextIterator
friend

The documentation for this class was generated from the following file: