Class: Prawn::SVG::Elements::Text
- Inherits:
-
DirectRenderBase
- Object
- Base
- DirectRenderBase
- Prawn::SVG::Elements::Text
- Defined in:
- lib/prawn/svg/elements/text.rb
Defined Under Namespace
Classes: Cursor
Constant Summary
Constants inherited from Base
Base::COMMA_WSP_REGEXP, Base::MissingAttributesError, Base::PAINT_TYPES, Base::SVG_NAMESPACE, Base::SkipElementError, Base::SkipElementQuietly
Constants included from Attributes::Stroke
Attributes::Stroke::CAP_STYLE_TRANSLATIONS, Attributes::Stroke::JOIN_STYLE_TRANSLATIONS
Instance Attribute Summary
Attributes inherited from Base
#attributes, #base_calls, #calls, #document, #parent_calls, #properties, #source, #state
Instance Method Summary collapse
Methods inherited from Base
#initialize, #name, #parse_and_apply, #process
Methods included from TransformParser
Methods included from PDFMatrix
#load_matrix, #matrix_for_pdf, #rotation_matrix, #scale_matrix, #translation_matrix
Methods included from Attributes::Space
Methods included from Attributes::Stroke
#parse_stroke_attributes_and_call
Methods included from Attributes::ClipPath
#parse_clip_path_attribute_and_call
Methods included from Attributes::Opacity
#parse_opacity_attributes_and_call
Methods included from Attributes::Transform
#parse_transform_attribute_and_call
Constructor Details
This class inherits a constructor from Prawn::SVG::Elements::Base
Instance Method Details
#parse ⇒ Object
5 6 7 8 9 10 |
# File 'lib/prawn/svg/elements/text.rb', line 5 def parse @root_component = Elements::TextComponent.new(document, source, [], state.dup) @root_component.process reintroduce_trailing_and_leading_whitespace end |
#render(prawn, renderer) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/prawn/svg/elements/text.rb', line 12 def render(prawn, renderer) @root_component.lay_out(prawn) translate_x = case @root_component.computed_properties.text_anchor when 'middle' -@root_component.calculated_width / 2.0 when 'end' -@root_component.calculated_width end cursor = Cursor.new(0, document.sizing.output_height) @root_component.render_component(prawn, renderer, cursor, translate_x) end |