Class: Pdfrb::Layout::InlineBox
- Defined in:
- lib/pdfrb/layout/inline_box.rb
Overview
A box that sits inline within a text line (e.g., a styled span or an inline icon). Width + height are fixed; Line arranges it alongside TextFragments.
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Attributes inherited from Box
Instance Method Summary collapse
- #draw_content(canvas, x, y) ⇒ Object
-
#initialize(width:, height:, &block) ⇒ InlineBox
constructor
A new instance of InlineBox.
- #supports_position_flow? ⇒ Boolean
Methods inherited from Box
Constructor Details
#initialize(width:, height:, &block) ⇒ InlineBox
Returns a new instance of InlineBox.
11 12 13 14 |
# File 'lib/pdfrb/layout/inline_box.rb', line 11 def initialize(width:, height:, &block) super(width: width, height: height) @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
9 10 11 |
# File 'lib/pdfrb/layout/inline_box.rb', line 9 def block @block end |
Instance Method Details
#draw_content(canvas, x, y) ⇒ Object
20 21 22 |
# File 'lib/pdfrb/layout/inline_box.rb', line 20 def draw_content(canvas, x, y) @block&.call(canvas, x, y) end |
#supports_position_flow? ⇒ Boolean
16 17 18 |
# File 'lib/pdfrb/layout/inline_box.rb', line 16 def supports_position_flow? true end |