Class: Layout::FormattedText
Overview
A formatted text entity.
Constant Summary #
- Layout::FormattedText::GROW_MODE_UNBOUNDED
- Layout::FormattedText::GROW_MODE_BOUNDED
- Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT
- Layout::FormattedText::ANCHOR_TYPE_CENTER_LEFT
- Layout::FormattedText::ANCHOR_TYPE_BOTTOM_LEFT
- Layout::FormattedText::ANCHOR_TYPE_TOP_RIGHT
- Layout::FormattedText::ANCHOR_TYPE_CENTER_RIGHT
- Layout::FormattedText::ANCHOR_TYPE_BOTTOM_RIGHT
- Layout::FormattedText::ANCHOR_TYPE_TOP_CENTER
- Layout::FormattedText::ANCHOR_TYPE_CENTER_CENTER
- Layout::FormattedText::ANCHOR_TYPE_BOTTOM_CENTER
Class Method Summary # collapse
-
.new_from_file(*args) ⇒ Object
The FormattedText.new_from_file method creates a new FormattedText from a text file.
Instance Method Summary # collapse
-
#append_plain_text(plain_text, style) ⇒ Object
The #append_plain_text method appends new text with a given style to the end of the existing plain text of the FormattedText.
-
#apply_style(style, index = 0, length = length_to_end_of_text) ⇒ Object
The #apply_style method sets the Style for the text starting at the given character index, and running for the given number of characters.
-
#display_text(page = nil) ⇒ String
The #display_text method returns the display text representation of the FormattedText.
-
#grow_mode ⇒ Integer
The #grow_mode method returns the mode for how the FormattedText sizes itself.
-
#grow_mode=(grow_mode) ⇒ Integer
The #grow_mode= method sets the mode for how the FormattedText sizes itself.
-
#initialize(*args) ⇒ Object
constructor
The #initialize method creates a new FormattedText.
-
#plain_text ⇒ String
The #plain_text method returns the plain text representation of the FormattedText.
-
#plain_text=(plain_text) ⇒ Object
The #plain_text= method sets the plain text representation of the FormattedText.
-
#rtf(*args) ⇒ Object
The #rtf method returns the raw RTF representation of the FormattedText.
-
#rtf=(rtf_text) ⇒ Object
The #rtf= method sets the raw RTF representation of the FormattedText.
- #style(index = 0, length = 1) ⇒ Layout::Style
Methods inherited from Entity
#==, #bounds, #document, #drawing_bounds, #group, #layer_instance, #locked=, #locked?, #move_to_group, #move_to_layer, #on_shared_layer?, #page, #style=, #transform!, #transformation, #untransformed_bounds, #untransformed_bounds=
Constructor Details
↑ #initialize(text, bounds) ⇒ Layout::FormattedText #initialize(text, anchor_point, anchor_type) ⇒ Layout::FormattedText
The #initialize method creates a new Layout::FormattedText.
The anchor type can be one of the following values:
ANCHOR_TYPE_TOP_LEFT
ANCHOR_TYPE_CENTER_LEFT
ANCHOR_TYPE_BOTTOM_LEFT
ANCHOR_TYPE_TOP_RIGHT
ANCHOR_TYPE_CENTER_RIGHT
ANCHOR_TYPE_BOTTOM_RIGHT
ANCHOR_TYPE_TOP_CENTER
ANCHOR_TYPE_CENTER_CENTER
ANCHOR_TYPE_BOTTOM_CENTER
Class Method Details
↑ .new_from_file(path, bounds) ⇒ Layout::FormattedText .new_from_file(path, anchor_point, anchor_type) ⇒ Layout::FormattedText
The new_from_file method creates a new Layout::FormattedText from a text file.
The anchor type can be one of the following values:
ANCHOR_TYPE_TOP_LEFT
ANCHOR_TYPE_CENTER_LEFT
ANCHOR_TYPE_BOTTOM_LEFT
ANCHOR_TYPE_TOP_RIGHT
ANCHOR_TYPE_CENTER_RIGHT
ANCHOR_TYPE_BOTTOM_RIGHT
ANCHOR_TYPE_TOP_CENTER
ANCHOR_TYPE_CENTER_CENTER
ANCHOR_TYPE_BOTTOM_CENTER
-
Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT)
Instance Method Details
↑ #append_plain_text(plain_text, style) ⇒ Object
This method does not support more than two different style runs in a single text string.
The #append_plain_text method appends new text with a given style to the end of the existing plain text of the Layout::FormattedText.
↑ #apply_style(style, index = 0, length = length_to_end_of_text) ⇒ Object
The #apply_style method sets the Style for the text starting at the given character index, and running for the given number of characters.
↑ #display_text(page = nil) ⇒ String
Passing an invalid Page will prevent an auto-text tag from being substituted with its display representation.
The #display_text method returns the display text representation of the Layout::FormattedText.
Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT) doc.add_entity(text, doc.layers.first, doc.pages.first) text = text.display_text(doc.pages.first)
↑ #grow_mode ⇒ Integer
The #grow_mode method returns the mode for how the Layout::FormattedText sizes itself.
The grow mode can be one of the following values:
Layout::FormattedText::GROW_MODE_BOUNDED
Layout::FormattedText::GROW_MODE_UNBOUNDED
↑ #grow_mode=(grow_mode) ⇒ Integer
The #grow_mode= method sets the mode for how the Layout::FormattedText sizes itself.
The grow mode can be one of the following values:
Layout::FormattedText::GROW_MODE_BOUNDED
Layout::FormattedText::GROW_MODE_UNBOUNDED
↑ #plain_text ⇒ String
The #plain_text method returns the plain text representation of the Layout::FormattedText.
↑ #plain_text=(plain_text) ⇒ Object
The #plain_text= method sets the plain text representation of the Layout::FormattedText.
↑ #rtf ⇒ String #rtf(page) ⇒ String
Passing an invalid Page will prevent an auto-text tag from being substituted with its display representation.
The #rtf method returns the raw RTF representation of the Layout::FormattedText.
↑ #rtf=(rtf_text) ⇒ Object
The #rtf= method sets the raw RTF representation of the Layout::FormattedText.
text.par}“