Text Class Documentation
classText : ElementNamespace:datalogics_interface
- Inherits from:
Element
Detailed Description
A Text object is container that represents both a series of TextRun elements and a series of text characters. Operations can be performed on individual TextRuns within a Text or on individual characters within a Text by specifying the index of the individual TextRun or character. All indices start at 0.
Referenced by
Constructor & Destructor Documentation
Member Function Documentation
add_glyphs
voidadd_glyphs(const std::vector< std::uint8_t > &glyph_ids, const std::vector< std::uint8_t > &uni_text, Font &font, GraphicState &gs, TextState &ts, const Matrix &matrix, TextFlagsflags)Parameters
glyph_ids: const std::vector< std::uint8_t > &Glyphs IDs in the specified font for adding to the page's content
uni_text: const std::vector< std::uint8_t > &Unicode codes for the specified glyph IDs
font: Font &- Font for wich GlyphIDs were specified
gs: GraphicState &- The GraphicsState for Text element
ts: TextState &- TextState flags
matrix: const Matrix &- matrix for the Text element
flags: TextFlags- TextFlags that specifies what kind of text to add
Returns:
voidAdds Unicode text to a Text object
add_glyphs
voidadd_glyphs(const std::vector< std::uint8_t > &glyph_ids, const std::vector< std::uint8_t > &uni_text, Font &font, GraphicState &gs, TextState &ts, const Matrix &matrix, TextFlagsflags, intindex)Parameters
glyph_ids: const std::vector< std::uint8_t > &Glyphs IDs in the specified font for adding to the page's content
uni_text: const std::vector< std::uint8_t > &Unicode codes for the specified glyph IDs
font: Font &- Font for wich GlyphIDs were specified
gs: GraphicState &- The GraphicsState for Text element
ts: TextState &- TextState flags
matrix: const Matrix &- matrix for the Text element
flags: TextFlags- TextFlags that specifies what kind of text to add
index: int
Returns:
voidAdds Unicode text to a Text object
add_run
voidadd_run(TextRun &run)Parameters
run: TextRun &The TextRun to append.
Returns:
voidAdds a TextRun to the end of this text element.
add_run
voidadd_run(TextRun &run, intindex)Parameters
run: TextRun &The TextRun to append.
index: int
Returns:
voidAdds a TextRun to the end of this text element.
change_text_matrix_for_text_run
voidchange_text_matrix_for_text_run(const Matrix &new_matrix, inttext_run_index)Parameters
new_matrix: const Matrix &The new transformation matrix to use for the TextRun.
text_run_index: intThe index of a TextRun, relative to the Text object (the first TextRun in the Text object is at index 0).
Returns:
voidChanges the transformation matrix from user space to the current text space for the specified TextRun. The H and V values of the matrix indicate the origin of the first character.
clone
std::unique_ptr< Element >clone(ElementCloneFlagsflags)Parameters
flags: ElementCloneFlags
Returns:
The copied element.Makes a copy of the element.
Make a copy of an element to obtain a new element that has a distinct set of attributes.
Note: TextRun objects may not be cloned.
clone
std::unique_ptr< Text >clone()Returns:
std::unique_ptr< Text >Makes a copy of this Text object.
find_text_run_index_for_character
intfind_text_run_index_for_character(intchar_index)Parameters
char_index: intThe index of a character, relative to the Text object (the first character in the Text object is at index 0).
Returns:
The index of the TextRun that contains the character specified by characterIndex.Finds the index of the TextRun that contains the nth character in a Text object.
get_advance_for_character
Pointget_advance_for_character(intindex)Parameters
index: intThe index of a character, relative to the Text object (the first character in the Text object is at index 0).
Returns:
A value specifying both the horizontal and vertical components of the advance width of a character in user space.Gets the advance width of a character, in user space. The advance width is the amount by which the current point advances when the character is drawn.
Advance width may be horizontal or vertical, depending on the writing style. Thus, the return value has both a horizontal and a vertical component.
get_advance_for_text_run
Pointget_advance_for_text_run(intindex)Parameters
index: intThe index of a TextRun, relative to the Text object (the first TextRun in the Text object is at index 0).
Returns:
A value specifying both the horizontal and vertical components of the advance width of a TextRun in user space.Gets the advance width of a TextRun, in user space. The advance width is the amount by which the current point advances when the TextRun is drawn.
Advance width may be horizontal or vertical, depending on the writing style. Thus, the return value has both a horizontal and a vertical component.
get_bounding_box
Rectget_bounding_box()Returns:
The bounding box for this element. The coordinates of the bounding box are specified in user space coordinates, relative to the element's Content. Note that user space coordinates correspond to unrotated pages; any rotation specified in the page dictionary is not taken into account.The bounding box is a rectangle that is guaranteed to encompass the element, but it is not guaranteed to be the smallest box that could contain the element. For example, if the element is a Path that contains an arc, the bounding box encompasses the bezier control points, and not just the curve itself.
get_bounding_box_for_character
Rectget_bounding_box_for_character(intindex)Parameters
index: intThe index of a character, relative to the Text object (the first character in the Text object is at index 0)
Returns:
A Rect specifying the bounding box for the character.The bounding box for a character in this text element.
get_clip
std::unique_ptr< Clip >get_clip()Returns:
The current Clip for this Element, or NULL if no clip is set.Gets the current Clip for an Element.
get_element_type
ElementTypeget_element_type()Returns:
ElementTypeReturns the runtime type of this element.
get_matrix
Matrixget_matrix()Returns:
The current transformation matrix applied to this element.The transformation matrix for the element.
get_number_of_characters
intget_number_of_characters()Returns:
intThe number of characters in this text element.
get_number_of_runs
intget_number_of_runs()Returns:
intThe number of text runs in this text element.
get_run
std::unique_ptr< TextRun >get_run(intindex)Parameters
index: intThe zero-based index of the TextRun to retrieve.
Returns:
The TextRun at the specified index.Obtains the TextRun at the specified index.
get_text_matrix_for_character
Matrixget_text_matrix_for_character(intindex)Parameters
index: intThe index of a character, relative to the Text object (the first character in the Text object is at index 0).
Returns:
The transformation matrix for the character specified by characterIndex.Gets the transformation matrix from user space to the current text space for the specified character. The H and V values of the matrix indicate the origin of the first character.
get_text_matrix_for_text_run
Matrixget_text_matrix_for_text_run(intindex)Parameters
index: intThe index of a TextRun, relative to the Text object (the first TextRun in the Text object is at index 0).
Returns:
The transformation matrix for the TextRun specified by TextRunIndex.Gets the transformation matrix from user space to the current text space for the specified TextRun. The H and V values of the matrix indicate the origin of the first character.
operator=
Parameters
: Text &&
Returns:
Text &point_intersects_character
boolpoint_intersects_character(const Point &p, intindex)Parameters
p: const Point &The point to test, in user space coordinates.
index: intThe index of the character. The first character in the Text has an index of 0.
Returns:
true if the point is on the character, false if the point is not on the character.Tests whether a point is on a specified character within this Text object.
point_intersects_text_run
boolpoint_intersects_text_run(const Point &p, intindex)Parameters
p: const Point &The point to test, in user space coordinates.
index: intThe index of the TextRun. The first TextRun in the Text has an index of 0.
Returns:
true if the point is on the TextRun, false if the point is not on the TextRun.Tests whether a point is on a specified TextRun within this Text object.
rect_intersects_character
boolrect_intersects_character(const Rect &r, intindex)Parameters
r: const Rect &The rect to test, in user space coordinates.
index: intThe index of the character. The first character in the Text has an index of 0.
Returns:
true if any part of the rectangle is on the character, false if no part of the rectangle is on the character.Tests whether any part of a rectangle is on a specified character within this Text object.
rect_intersects_text_run
boolrect_intersects_text_run(const Rect &r, intindex)Parameters
r: const Rect &The rect to test, in user space coordinates.
index: intThe index of the TextRun. The first TextRun in the Text has an index of 0.
Returns:
true if any part of the rectangle is on the TextRun, false if no part of the rectangle is on the TextRun.Tests whether any part of a rectangle is on a specified TextRun within this Text object.
remove_runs
voidremove_runs(intindex, intcount)Parameters
index: intStart position of range to delete
count: intCount of TextRuns to delete
Returns:
voidRemoves a count of TextRuns, starting from index
rotate
voidrotate(doubletheta)Parameters
theta: doubleThe rotation angle in degrees.
Returns:
voidRotate an element by theta degrees counterclockwise using the matrix [ cos T sin T -sin T cos T 0 0 ].
scale
voidscale(doublesx, doublesy)Parameters
sx: doubleThe horizontal scale factor.
sy: doubleThe vertical scale factor.
Returns:
voidScale an element by (sx,sy) units using the matrix [ sx 0 0 sy 0 0 ].
set_clip
voidset_clip(Clip &clip)Parameters
clip: Clip &The clip to set as the current clip for this element, or NULL to remove clipping.
Returns:
voidSets the current Clip for an Element.
set_matrix
voidset_matrix(const Matrix &matrix)Parameters
matrix: const Matrix &The transformation matrix for the element.
Returns:
voidSet the transformation matrix for the element.
split_text_run_at_character
voidsplit_text_run_at_character(intsplit_location)Parameters
split_location: intThe split location, relative to the Text object.
Returns:
voidSplits the TextRun containing the character at the specified location into two contiguous TextRuns. The character at the specified index will be part of the first TextRun.
translate
voidtranslate(doubletx, doublety)Parameters
tx: doubleThe horizontal translation distance in user space units.
ty: doubleThe vertical translation distance in user space units.
Returns:
voidTranslate an element by (tx,ty) units using the matrix [ 1 0 0 1 tx ty ].
try_as
T *try_as(typename T)Parameters
: typename T
Returns:
T *Attempt to downcast this element to a derived type. Returns a pointer to the derived type, or nullptr if the type doesn't match.
try_as
const T *try_as(typename T)Parameters
: typename T
Returns:
const T *Const overload of try_as(). Returns a const pointer, or nullptr.