Class: RGhost::Barcode::Text

Inherits:
Parameter
  • Object
show all
Defined in:
lib/rghost_barcode/rghost_barcode_base.rb

Overview

Enables properties of text. It's used on the contructor of the class RGhost::Barcode::Base(parent of all barcodes) by Hash :text. Between parenthesis the original parameter.

  • :size - (textsize) - size of text in points.

  • :font - (textfont) - name of font, see the font catalog.

  • :offset - (textxoffset, textyoffset) - Used as array. Example :offset => [10,8], textxoffset and textyoffset

  • :x and :y - (textxalign, textyalign) - Align of X and Y. Example :x => 0.2, :y => 5

  • :color - (textcolor) - Color of text. Only rgb hex. Example: :color => 'FF0000'

  • :enable Array

Enables

  • :text - (includetext) - Show human readable text for data in symbol.

  • :check - (includecheck) - Generate check digit(s), where relevant.

  • :checkintext - (includecheckintext) - Generate check digit(s), where relevant.

Example: doc=Document.new doc.barcode_interleaved2of5('0123456789', :text => {:size => 10, :offset => [0,-10], :enable => [:text, :check, :checkintext] })

Instance Method Summary collapse

Instance Method Details

#makeObject


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 60

def make
  add_single("includetext")
  @options.each do |key,value| 
    case key
    when :enable then  value.each{|item| add_single("include#{item}")   }
    when :offset 
      add("textxoffset", value[0])
      add("textyoffset", value[1])
    when :color then add_color("textcolor", value)          
    when :x, :y then add("text#{key}align",value) 
    else
      add("text#{key}",value)
    end
  end
end