Represents a text run in a PDF document.
More...
#include <pdfsdk/cxx/text_run.h>
|
| TextRun | Copy () const |
| TextRun | MakeEmptyCopy () const |
| bool | Equals (const TextRun &that) const |
| void | InsertChars (size_t index, const char *chars, size_t numChars) |
| void | AppendChars (const char *chars, size_t numChars) |
| void | InsertChars (size_t index, const std::string &chars) |
| void | AppendChars (const std::string &chars) |
| void | RemoveChars (size_t index, size_t numChars) |
| void | InsertUnicodeChars (size_t index, const UnicodeChar *unicodeChars, size_t numUnicodeChars) |
| void | AppendUnicodeChars (const UnicodeChar *unicodeChars, size_t numUnicodeChars) |
| void | InsertUnicodeChars (size_t index, const std::wstring &unicodeChars) |
| void | AppendUnicodeChars (const std::wstring &unicodeChars) |
| GState | GetGState () const |
| void | SetGState (const GState &gState) |
| PDETextState | GetTextState () const |
| void | SetTextState (const PDETextState &textState) |
| Font | GetFont () const |
| void | SetFont (const Font &font) |
| void | SetFont (const Font &font, float fontSize) |
| float | GetFontSize () const |
| void | SetFontSize (float fontSize) |
| Matrix | GetTextMatrix () const |
| void | SetTextMatrix (const Matrix &textMatrix) |
| size_t | GetNumChars () const |
| RectF | GetCharsRect (size_t begindex, size_t endindex) const |
| Quad | GetCharQuad (size_t index) const |
| Quad | GetOutlineQuad (size_t index) const |
| std::wstring | GetText () const |
| std::wstring | GetNthUnicode (size_t charindex) const |
| std::string | GetNthCharCode (size_t charindex) const |
| unsigned int | GetGlyphIndex (size_t charindex) const |
| RectF | GetBBox () const |
| Matrix | GetMatrix () const |
| void | SetMatrix (const Matrix &matrix) |
| Element | GetParent () const |
| bool | IsCharWhitespace (size_t index) const |
|
| TextRun (PDETextItem handle, bool adopt=false) noexcept |
|
| TextRun (const TextRun &rhs) noexcept |
|
TextRun & | operator= (const TextRun &rhs) noexcept |
|
| TextRun (TextRun &&rhs) noexcept |
|
TextRun & | operator= (TextRun &&rhs) noexcept |
Represents a text run in a PDF document.
ISO 32000-2:2020 - 9.4 Text objects
◆ AppendChars() [1/2]
| void PDF::TextRun::AppendChars |
( |
const char * | chars, |
|
|
size_t | numChars ) |
Appends a string encoded in the font's encoding.
- Parameters
-
| chars | The string in the font's encoding. |
| numChars | The number of chars. |
◆ AppendChars() [2/2]
| void PDF::TextRun::AppendChars |
( |
const std::string & | chars | ) |
|
Appends a string encoded in the font's encoding.
- Parameters
-
| chars | The string in the font's encoding. |
◆ AppendUnicodeChars() [1/2]
| void PDF::TextRun::AppendUnicodeChars |
( |
const std::wstring & | unicodeChars | ) |
|
Appends characters by converting Unicode to character codes using the text run's font ToUnicode map or encoding.
- Parameters
-
| unicodeChars | The Unicode characters to append. |
◆ AppendUnicodeChars() [2/2]
| void PDF::TextRun::AppendUnicodeChars |
( |
const UnicodeChar * | unicodeChars, |
|
|
size_t | numUnicodeChars ) |
Appends characters by converting Unicode to character codes using the text run's font ToUnicode map or encoding.
- Parameters
-
| unicodeChars | The Unicode characters to append. |
| numUnicodeChars | The number of Unicode characters to append. |
◆ Copy()
| TextRun PDF::TextRun::Copy |
( |
| ) |
const |
Creates a copy of the TextRun object.
- Returns
- A copy of the TextRun object.
◆ Create()
| TextRun PDF::TextRun::Create |
( |
| ) |
|
|
static |
Creates a new TextRun object.
- Returns
- The newly created TextRun object.
◆ Equals()
| bool PDF::TextRun::Equals |
( |
const TextRun & | that | ) |
const |
Checks if the TextRun object is equal to another TextRun object.
- Parameters
-
| that | The TextRun object to compare with. |
- Returns
- True if the TextRun objects are equal, false otherwise.
◆ GetBBox()
| RectF PDF::TextRun::GetBBox |
( |
| ) |
const |
Gets the bounding box of the TextRun object.
- Returns
- The bounding box of the TextRun object.
◆ GetCharQuad()
| Quad PDF::TextRun::GetCharQuad |
( |
size_t | index | ) |
const |
Gets the quad for a character in the TextRun object.
- Parameters
-
| index | The index of the character. |
- Returns
- The quad for the character.
◆ GetCharsRect()
| RectF PDF::TextRun::GetCharsRect |
( |
size_t | begindex, |
|
|
size_t | endindex ) const |
Gets the bounding box of a range of characters in the TextRun object.
- Parameters
-
| begindex | The beginning index of the range. |
| endindex | The ending index of the range. |
- Returns
- The bounding box of the range of characters.
◆ GetFont()
| Font PDF::TextRun::GetFont |
( |
| ) |
const |
Gets the font of the TextRun object.
- Returns
- The font of the TextRun object.
◆ GetFontSize()
| float PDF::TextRun::GetFontSize |
( |
| ) |
const |
Gets the font size of the TextRun object.
- Returns
- The font size of the TextRun object.
◆ GetGlyphIndex()
| unsigned int PDF::TextRun::GetGlyphIndex |
( |
size_t | charindex | ) |
const |
Gets the glyph index for a character in the font.
- Parameters
-
| charindex | The index of the character. |
- Returns
- The glyph index in the font (0 for .notdef glyph).
◆ GetGState()
| GState PDF::TextRun::GetGState |
( |
| ) |
const |
Gets the graphics state of the TextRun object.
- Returns
- The graphics state of the TextRun object.
◆ GetMatrix()
| Matrix PDF::TextRun::GetMatrix |
( |
| ) |
const |
Gets the matrix of the TextRun object.
- Returns
- The matrix of the TextRun object.
◆ GetNthCharCode()
| std::string PDF::TextRun::GetNthCharCode |
( |
size_t | charindex | ) |
const |
Gets the character code at the specified index in the font's encoding.
- Parameters
-
| charindex | The index of the character. |
- Returns
- The character code as a string (1-2 bytes for simple fonts, 2 bytes for composite fonts).
◆ GetNthUnicode()
| std::wstring PDF::TextRun::GetNthUnicode |
( |
size_t | charindex | ) |
const |
Extracts a single character by converting its character code to Unicode using the font's ToUnicode map or encoding.
- Parameters
-
| charindex | The index of the character. |
- Returns
- The extracted Unicode character.
◆ GetNumChars()
| size_t PDF::TextRun::GetNumChars |
( |
| ) |
const |
Gets the number of characters in the TextRun object.
- Returns
- The number of characters in the TextRun object.
◆ GetOutlineQuad()
| Quad PDF::TextRun::GetOutlineQuad |
( |
size_t | index | ) |
const |
Gets the outline quad for a character in the TextRun object.
- Parameters
-
| index | The index of the character. |
- Returns
- The outline quad for the character.
◆ GetParent()
| Element PDF::TextRun::GetParent |
( |
| ) |
const |
Gets the parent element of the TextRun object.
- Returns
- The parent element of the TextRun object.
◆ GetText()
| std::wstring PDF::TextRun::GetText |
( |
| ) |
const |
Extracts the text by converting character codes to Unicode using the font's ToUnicode map or encoding.
- Returns
- The extracted Unicode text.
◆ GetTextMatrix()
| Matrix PDF::TextRun::GetTextMatrix |
( |
| ) |
const |
Gets the text matrix of the TextRun object.
- Returns
- The text matrix of the TextRun object.
◆ GetTextState()
Gets the text state of the TextRun object.
- Returns
- The text state of the TextRun object.
◆ InsertChars() [1/2]
| void PDF::TextRun::InsertChars |
( |
size_t | index, |
|
|
const char * | chars, |
|
|
size_t | numChars ) |
Inserts a string encoded in the font's encoding.
- Parameters
-
| index | The index at which to insert. |
| chars | The string in the font's encoding. |
| numChars | The number of chars. |
◆ InsertChars() [2/2]
| void PDF::TextRun::InsertChars |
( |
size_t | index, |
|
|
const std::string & | chars ) |
Inserts a string encoded in the font's encoding.
- Parameters
-
| index | The index at which to insert. |
| chars | The string in the font's encoding. |
◆ InsertUnicodeChars() [1/2]
| void PDF::TextRun::InsertUnicodeChars |
( |
size_t | index, |
|
|
const std::wstring & | unicodeChars ) |
Inserts characters by converting Unicode to character codes using the text run's font ToUnicode map or encoding.
- Parameters
-
| index | The index at which to insert the characters. |
| unicodeChars | The Unicode characters to insert. |
◆ InsertUnicodeChars() [2/2]
| void PDF::TextRun::InsertUnicodeChars |
( |
size_t | index, |
|
|
const UnicodeChar * | unicodeChars, |
|
|
size_t | numUnicodeChars ) |
Inserts characters by converting Unicode to character codes using the text run's font ToUnicode map or encoding.
- Parameters
-
| index | The index at which to insert the characters. |
| unicodeChars | The Unicode characters to insert. |
| numUnicodeChars | The number of Unicode characters to insert. |
◆ IsCharWhitespace()
| bool PDF::TextRun::IsCharWhitespace |
( |
size_t | index | ) |
const |
Checks if a character in the TextRun object is whitespace.
- Parameters
-
| index | The index of the character. |
- Returns
- True if the character is whitespace, false otherwise.
◆ MakeEmptyCopy()
| TextRun PDF::TextRun::MakeEmptyCopy |
( |
| ) |
const |
Creates an empty copy of the TextRun object.
- Returns
- An empty copy of the TextRun object.
◆ RemoveChars()
| void PDF::TextRun::RemoveChars |
( |
size_t | index, |
|
|
size_t | numChars ) |
Removes characters from the TextRun object starting at the specified index.
- Parameters
-
| index | The index at which to start removing characters. |
| numChars | The number of characters to remove. |
◆ SetFont() [1/2]
| void PDF::TextRun::SetFont |
( |
const Font & | font | ) |
|
Sets the font of the TextRun object.
- Warning
- This function re-interprets existing character codes with the new font's encoding. If the new font has an incompatible encoding, character codes may map to different glyphs or become invalid, resulting in corrupted text. Only use this when:
- The new font has a compatible encoding with the current font, or
- The TextRun is empty (contains no characters)
- Parameters
-
◆ SetFont() [2/2]
| void PDF::TextRun::SetFont |
( |
const Font & | font, |
|
|
float | fontSize ) |
Sets the font and font size of the TextRun object.
- Warning
- See SetFont(const Font&) for encoding compatibility warnings.
- Parameters
-
| font | The font to set. |
| fontSize | The font size to set. |
◆ SetFontSize()
| void PDF::TextRun::SetFontSize |
( |
float | fontSize | ) |
|
Sets the font size of the TextRun object.
- Parameters
-
| fontSize | The font size to set. |
◆ SetGState()
| void PDF::TextRun::SetGState |
( |
const GState & | gState | ) |
|
Sets the graphics state of the TextRun object.
- Parameters
-
| gState | The graphics state to set. |
◆ SetMatrix()
| void PDF::TextRun::SetMatrix |
( |
const Matrix & | matrix | ) |
|
Sets the matrix of the TextRun object.
- Parameters
-
◆ SetTextMatrix()
| void PDF::TextRun::SetTextMatrix |
( |
const Matrix & | textMatrix | ) |
|
Sets the text matrix of the TextRun object.
- Parameters
-
| textMatrix | The text matrix to set. |
◆ SetTextState()
| void PDF::TextRun::SetTextState |
( |
const PDETextState & | textState | ) |
|
Sets the text state of the TextRun object.
- Parameters
-
| textState | The text state to set. |
The documentation for this class was generated from the following file: