Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix height bug with ^B commands #54

Merged
merged 3 commits into from
Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 1.1.0 (next)

* Your contribution here.
* [#54](https://github.com/bbulpett/zebra-zpl/pull/54): Fix height bug with ^B commands - [@mtking2](https://github.com/mtking2)
* [#53](https://github.com/bbulpett/zebra-zpl/pull/53): Added support for symbol types, fixed other bugs with the `Graphic` class, updated specs - [@mtking2](https://github.com/mtking2)
* [#50](https://github.com/bbulpett/zebra-zpl/pull/50): Add support for image elements by incorporating the [img2zpl](https://github.com/mtking2/img2zpl) gem - [@mtking2](https://github.com/mtking2)
* [#49](https://github.com/bbulpett/zebra-zpl/pull/49): Fixed bug with `Barcode`'s `^BY` command. Added UPCA, UPCE, & EAN13 types - [@mtking2](https://github.com/mtking2)
Expand Down
2 changes: 1 addition & 1 deletion lib/zebra/zpl/datamatrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def aspect_ratio=(value)

def to_zpl
check_attributes
"^FW#{rotation}^FO#{x},#{y}^BX#{orientation},#{symbol_height},#{quality},#{columns},#{rows},#{format},#{escape_sequence},#{aspect_ratio}^FD#{data}^FS"
"^FW#{rotation}^FO#{x},#{y}^BY,,10^BX#{orientation},#{symbol_height},#{quality},#{columns},#{rows},#{format},#{escape_sequence},#{aspect_ratio}^FD#{data}^FS"
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/zebra/zpl/pdf417.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def security_level=(value)

def to_zpl
check_attributes
"^FO#{x},#{y}^B7#{rotation},#{row_height},#{security_level},#{column_number},#{row_number},#{truncate} ^FD #{data} ^FS"
"^FO#{x},#{y}^BY,,10^B7#{rotation},#{row_height},#{security_level},#{column_number},#{row_number},#{truncate} ^FD #{data} ^FS"
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/zebra/zpl/qrcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def correction_level=(value)

def to_zpl
check_attributes
"^FW#{rotation}^FO#{x},#{y}^BQN,2,#{scale_factor},,3^FD#{correction_level}A,#{data}^FS"
"^FW#{rotation}^FO#{x},#{y}^BY,,10^BQN,2,#{scale_factor},,3^FD#{correction_level}A,#{data}^FS"
end

private
Expand Down
8 changes: 4 additions & 4 deletions spec/zebra/zpl/datamatrix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@
end

it "contains Data Matrix code type" do
expect(tokens[4]).to eq "^BXN"
expect(tokens[6]).to eq "^BXN"
end

it "contains the symbol_height" do
expect(tokens[5]).to eq "5"
expect(tokens[7]).to eq "5"
end

it "contains the quality level" do
expect(tokens[6]).to eq "200"
expect(tokens[8]).to eq "200"
end

it "contains the data to be printed in the datamatrix" do
expect(tokens[8]).to eq "foobar"
expect(tokens[10]).to eq "foobar"
end
end
end
12 changes: 6 additions & 6 deletions spec/zebra/zpl/pdf417_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,27 @@
end

it "contains the row height" do
expect(tokens[2]).to eq "5"
expect(tokens[4]).to eq "5"
end

it "contains the security level" do
expect(tokens[3]).to eq "5"
expect(tokens[5]).to eq "5"
end

it "contains the column number" do
expect(tokens[4]).to eq "15"
expect(tokens[6]).to eq "15"
end

it "contains the row number" do
expect(tokens[5]).to eq "30"
expect(tokens[7]).to eq "30"
end

it "contains the trucate option" do
expect(tokens[6].match(/(\w) \^/)[1]).to eq "N"
expect(tokens[8].match(/(\w) \^/)[1]).to eq "N"
end

it "contains the data to be printed in the pdf417 barcode" do
expect(tokens[6].include?("Do away with it!")).to eq true
expect(tokens[8].include?("Do away with it!")).to eq true
end
end
end
8 changes: 4 additions & 4 deletions spec/zebra/zpl/qrcode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@
end

it "contains QR code type" do
expect(tokens[4]).to eq "^BQN"
expect(tokens[6]).to eq "^BQN"
end

it "contains the scale factor" do
expect(tokens[6]).to eq "3"
expect(tokens[8]).to eq "3"
end

it "contains the error correction level" do
expect(tokens[7]).to eq "3"
expect(tokens[9]).to eq "3"
end

it "contains the data to be printed in the qrcode" do
expect(tokens[9]).to eq "foobar"
expect(tokens[11]).to eq "foobar"
end
end
end