Sha256: fab9bf23b1ab175dc235d300a753e3b0c3efb59dfe4381910cfe4139df9a1488

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

module Zebra
  module Zpl
    module FontSize
      class InvalidFontSizeError < StandardError; end

      SIZE_0 = 12 # tiny
      SIZE_1 = 17 # 6pt
      SIZE_2 = 22 # 8pt
      SIZE_3 = 28 # 10pt
      SIZE_4 = 33 # 12pt
      SIZE_5 = 44 # 16pt
      SIZE_6 = 67 # 24pt
      SIZE_7 = 100 # 32pt
      SIZE_8 = 111 # 40pt
      SIZE_9 = 133 # 48pt

      def self.valid_font_size?(font_size)
        (0..32000).include?(font_size.to_i)
      end

      def self.validate_font_size(font_size)
        raise InvalidFontSizeError unless valid_font_size?(font_size)
      end
    end

    module FontType
      class InvalidFontTypeError < StandardError; end

      TYPE_0  = "0" # 6pt
      TYPE_CD = "CD" # 6pt
      TYPE_A  = "A" # 6pt
      TYPE_B  = "B" # 6pt
      TYPE_D  = "D" # 6pt
      TYPE_E  = "E" # 6pt
      TYPE_F  = "F" # 6pt
      TYPE_G  = "G" # 6pt
      TYPE_H  = "H" # 6pt

      def self.valid_font_type?(font_type)
        ["0", "CD", "A", "B", "D", "E", "F", "G", "H"].include?(font_type)
      end

      def self.validate_font_type(font_type)
        raise InvalidFontTypeError unless valid_font_type?(font_type)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zebra-zpl-1.1.4 lib/zebra/zpl/font.rb