Class: Arrolio::TextLayout::KnuthPlass::Box

Inherits:
Item
  • Object
show all
Defined in:
lib/arrolio/text_layout/knuth_plass/item.rb

Overview

A box is a unit of content that cannot be broken across lines (a word, a glyph cluster). Has a fixed width.

Instance Attribute Summary collapse

Attributes inherited from Item

#width

Instance Method Summary collapse

Methods inherited from Item

#glue?, #penalty?

Constructor Details

#initialize(width:, run_index:, char_offset:, char_length:) ⇒ Box

Returns a new instance of Box.



26
27
28
29
30
31
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 26

def initialize(width:, run_index:, char_offset:, char_length:)
  super(width: width)
  @run_index = run_index
  @char_offset = char_offset
  @char_length = char_length
end

Instance Attribute Details

#char_lengthObject (readonly)

Returns the value of attribute char_length.



24
25
26
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 24

def char_length
  @char_length
end

#char_offsetObject (readonly)

Returns the value of attribute char_offset.



24
25
26
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 24

def char_offset
  @char_offset
end

#run_indexObject (readonly)

Returns the value of attribute run_index.



24
25
26
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 24

def run_index
  @run_index
end

Instance Method Details

#box?Boolean

Returns:

  • (Boolean)


33
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 33

def box? = true