Class: Zebra::Zpl::Text
- Inherits:
-
Object
- Object
- Zebra::Zpl::Text
- Includes:
- Printable
- Defined in:
- lib/zebra/zpl/text.rb
Defined Under Namespace
Classes: InvalidMaxLinesError
Instance Attribute Summary collapse
-
#bold ⇒ Object
Returns the value of attribute bold.
-
#font_size ⇒ Object
Returns the value of attribute font_size.
-
#font_type ⇒ Object
Returns the value of attribute font_type.
-
#hanging_indent ⇒ Object
Returns the value of attribute hanging_indent.
-
#line_spacing ⇒ Object
Returns the value of attribute line_spacing.
- #reverse_print ⇒ Object
-
#width ⇒ Object
Returns the value of attribute width.
Attributes included from Printable
#data, #margin, #position, #x, #y
Instance Method Summary collapse
Methods included from Printable
#initialize, #justification, #justification=, #rotation, #rotation=
Instance Attribute Details
#bold ⇒ Object
Returns the value of attribute bold.
10 11 12 |
# File 'lib/zebra/zpl/text.rb', line 10 def bold @bold end |
#font_size ⇒ Object
Returns the value of attribute font_size.
10 11 12 |
# File 'lib/zebra/zpl/text.rb', line 10 def font_size @font_size end |
#font_type ⇒ Object
Returns the value of attribute font_type.
10 11 12 |
# File 'lib/zebra/zpl/text.rb', line 10 def font_type @font_type end |
#hanging_indent ⇒ Object
Returns the value of attribute hanging_indent.
10 11 12 |
# File 'lib/zebra/zpl/text.rb', line 10 def hanging_indent @hanging_indent end |
#line_spacing ⇒ Object
Returns the value of attribute line_spacing.
10 11 12 |
# File 'lib/zebra/zpl/text.rb', line 10 def line_spacing @line_spacing end |
#reverse_print ⇒ Object
56 57 58 |
# File 'lib/zebra/zpl/text.rb', line 56 def reverse_print @reverse_print || false end |
#width ⇒ Object
Returns the value of attribute width.
10 11 12 |
# File 'lib/zebra/zpl/text.rb', line 10 def width @width end |
Instance Method Details
#max_lines ⇒ Object
35 36 37 |
# File 'lib/zebra/zpl/text.rb', line 35 def max_lines @max_lines || 4 end |
#max_lines=(value) ⇒ Object
30 31 32 33 |
# File 'lib/zebra/zpl/text.rb', line 30 def max_lines=(value) raise InvalidMaxLinesError unless value.to_i >= 1 @max_lines = value end |
#to_zpl ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/zebra/zpl/text.rb', line 60 def to_zpl check_attributes if !bold.nil? "^FW#{rotation}^A#{font_type},#{font_size}^CI28^FO#{x+1},#{y}^FB#{width},#{max_lines},#{line_spacing},#{justification},#{hanging_indent}#{appear_in_reverse}^FD#{data}^FS" + "^FW#{rotation}^A#{font_type},#{font_size}^CI28^FO#{x},#{y+1}^FB#{width},#{max_lines},#{line_spacing},#{justification},#{hanging_indent}#{appear_in_reverse}^FD#{data}^FS" else "^FW#{rotation}^A#{font_type},#{font_size}^CI28^FO#{x},#{y}^FB#{width},#{max_lines},#{line_spacing},#{justification},#{hanging_indent}#{appear_in_reverse}^FD#{data}^FS" end end |