Skip to content

Commit

Permalink
Merge pull request #40 from LagTag/bold_text_b
Browse files Browse the repository at this point in the history
Bold Text
  • Loading branch information
mtking2 authored Oct 15, 2019
2 parents cab8f23 + 96b441e commit d0c2fd4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/zebra/zpl/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ class Text

class InvalidMaxLinesError < StandardError; end

attr_reader :font_size, :font_type, :width, :line_spacing, :hanging_indent
attr_reader :font_size, :font_type, :width, :line_spacing, :hanging_indent, :bold

def font_size=(f)
FontSize.validate_font_size f
@font_size = f
end

def bold=(value)
@bold = value
end

def width=(width)
unless (margin.nil? || margin < 1)
@width = (width - (margin*2))
Expand Down Expand Up @@ -81,10 +85,11 @@ def max_lines

def to_zpl
check_attributes
# ["A#{x}", y, rotation, font_size, h_multiplier, v_multiplier, print_mode, "\"#{data}\""].join(",")
# "^FO25,25^FB600,100,0,C,0^FDFoo^FS"
# "^CF#{font_type},#{font_size}^FO#{x},#{y}^FB609,4,0,#{justification},0^FD#{data}^FS"
"^FW#{rotation}^CF#{font_type},#{font_size}^CI28^FO#{x},#{y}^FB#{width},#{max_lines},#{line_spacing},#{justification},#{hanging_indent}^FD#{data}^FS"
if !bold.nil?
zpl += "^FW#{rotation}^CF#{font_type},#{font_size}^CI28^FO#{x+2},#{y}^FB#{width},#{max_lines},#{line_spacing},#{justification},#{hanging_indent}^FD#{data}^FS"
zpl += "^FW#{rotation}^CF#{font_type},#{font_size}^CI28^FO#{x},#{y+2}^FB#{width},#{max_lines},#{line_spacing},#{justification},#{hanging_indent}^FD#{data}^FS"
end
end

private
Expand Down

0 comments on commit d0c2fd4

Please sign in to comment.