Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

some fixes #9

Merged
merged 1 commit into from

2 participants

@Gemorroj
Collaborator

We need to do UnitTests =)

@CloCkWeRX
Owner

That will learn me to commit at 3am.

@CloCkWeRX CloCkWeRX merged commit 2070bab into pear:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 11, 2011
  1. @Gemorroj

    some fixes

    Gemorroj authored
This page is out of date. Refresh to see the latest.
View
2  Image/Barcode2/Code39.php
@@ -180,7 +180,7 @@ private function _plot($text)
$this->writer->imagestring(
$img,
$this->_font_size,
- ($barcode_len - $font_width * strlen($this->text)) / 2,
+ ($barcode_len - $font_width * strlen($text)) / 2,
$this->getBarcodeHeight() - $font_height,
$text,
$black
View
2  Image/Barcode2/DualHeight.php
@@ -1,3 +1,3 @@
-<?ph
+<?php
interface Image_Barcode2_DualHeight {
}
View
2  Image/Barcode2/DualWidth.php
@@ -1,4 +1,4 @@
-<?ph
+<?php
interface Image_Barcode2_DualWidth {
public function setBarWidthThick($width);
public function setBarWidthThin($width);
View
6 Image/Barcode2/Writer.php
@@ -13,7 +13,7 @@ public function imagecreate($width, $height) {
}
public function imagestring($image, $font, $x, $y, $string, $color) {
- return imagestring($image, $font, $x, $y, $string, $color;
+ return imagestring($image, $font, $x, $y, $string, $color);
}
public function imagefill($image, $x, $y, $color) {
@@ -23,10 +23,6 @@ public function imagefill($image, $x, $y, $color) {
public function imagefilledrectangle($image, $x1, $y1, $x2, $y2, $color) {
return imagefilledrectangle($image, $x1, $y1, $x2, $y2, $color);
}
-
- public function imagestring($image, $font, $x , $y, $string, $color) {
- return imagestring($image, $font, $x , $y, $string, $color);
- }
public function imagefontheight($font) {
return imagefontheight($font);
View
219 Image/Barcode2/code128.php
@@ -71,6 +71,110 @@ public function __construct(Image_Barcode2_Writer $writer)
parent::__construct($writer);
$this->setBarcodeHeight(60);
$this->setBarWidth(1);
+
+ $this->_code[0] = "212222"; // " "
+ $this->_code[1] = "222122"; // "!"
+ $this->_code[2] = "222221"; // "{QUOTE}"
+ $this->_code[3] = "121223"; // "#"
+ $this->_code[4] = "121322"; // "$"
+ $this->_code[5] = "131222"; // "%"
+ $this->_code[6] = "122213"; // "&"
+ $this->_code[7] = "122312"; // "'"
+ $this->_code[8] = "132212"; // "("
+ $this->_code[9] = "221213"; // ")"
+ $this->_code[10] = "221312"; // "*"
+ $this->_code[11] = "231212"; // "+"
+ $this->_code[12] = "112232"; // ","
+ $this->_code[13] = "122132"; // "-"
+ $this->_code[14] = "122231"; // "."
+ $this->_code[15] = "113222"; // "/"
+ $this->_code[16] = "123122"; // "0"
+ $this->_code[17] = "123221"; // "1"
+ $this->_code[18] = "223211"; // "2"
+ $this->_code[19] = "221132"; // "3"
+ $this->_code[20] = "221231"; // "4"
+ $this->_code[21] = "213212"; // "5"
+ $this->_code[22] = "223112"; // "6"
+ $this->_code[23] = "312131"; // "7"
+ $this->_code[24] = "311222"; // "8"
+ $this->_code[25] = "321122"; // "9"
+ $this->_code[26] = "321221"; // ":"
+ $this->_code[27] = "312212"; // ";"
+ $this->_code[28] = "322112"; // "<"
+ $this->_code[29] = "322211"; // "="
+ $this->_code[30] = "212123"; // ">"
+ $this->_code[31] = "212321"; // "?"
+ $this->_code[32] = "232121"; // "@"
+ $this->_code[33] = "111323"; // "A"
+ $this->_code[34] = "131123"; // "B"
+ $this->_code[35] = "131321"; // "C"
+ $this->_code[36] = "112313"; // "D"
+ $this->_code[37] = "132113"; // "E"
+ $this->_code[38] = "132311"; // "F"
+ $this->_code[39] = "211313"; // "G"
+ $this->_code[40] = "231113"; // "H"
+ $this->_code[41] = "231311"; // "I"
+ $this->_code[42] = "112133"; // "J"
+ $this->_code[43] = "112331"; // "K"
+ $this->_code[44] = "132131"; // "L"
+ $this->_code[45] = "113123"; // "M"
+ $this->_code[46] = "113321"; // "N"
+ $this->_code[47] = "133121"; // "O"
+ $this->_code[48] = "313121"; // "P"
+ $this->_code[49] = "211331"; // "Q"
+ $this->_code[50] = "231131"; // "R"
+ $this->_code[51] = "213113"; // "S"
+ $this->_code[52] = "213311"; // "T"
+ $this->_code[53] = "213131"; // "U"
+ $this->_code[54] = "311123"; // "V"
+ $this->_code[55] = "311321"; // "W"
+ $this->_code[56] = "331121"; // "X"
+ $this->_code[57] = "312113"; // "Y"
+ $this->_code[58] = "312311"; // "Z"
+ $this->_code[59] = "332111"; // "["
+ $this->_code[60] = "314111"; // "\"
+ $this->_code[61] = "221411"; // "]"
+ $this->_code[62] = "431111"; // "^"
+ $this->_code[63] = "111224"; // "_"
+ $this->_code[64] = "111422"; // "`"
+ $this->_code[65] = "121124"; // "a"
+ $this->_code[66] = "121421"; // "b"
+ $this->_code[67] = "141122"; // "c"
+ $this->_code[68] = "141221"; // "d"
+ $this->_code[69] = "112214"; // "e"
+ $this->_code[70] = "112412"; // "f"
+ $this->_code[71] = "122114"; // "g"
+ $this->_code[72] = "122411"; // "h"
+ $this->_code[73] = "142112"; // "i"
+ $this->_code[74] = "142211"; // "j"
+ $this->_code[75] = "241211"; // "k"
+ $this->_code[76] = "221114"; // "l"
+ $this->_code[77] = "413111"; // "m"
+ $this->_code[78] = "241112"; // "n"
+ $this->_code[79] = "134111"; // "o"
+ $this->_code[80] = "111242"; // "p"
+ $this->_code[81] = "121142"; // "q"
+ $this->_code[82] = "121241"; // "r"
+ $this->_code[83] = "114212"; // "s"
+ $this->_code[84] = "124112"; // "t"
+ $this->_code[85] = "124211"; // "u"
+ $this->_code[86] = "411212"; // "v"
+ $this->_code[87] = "421112"; // "w"
+ $this->_code[88] = "421211"; // "x"
+ $this->_code[89] = "212141"; // "y"
+ $this->_code[90] = "214121"; // "z"
+ $this->_code[91] = "412121"; // "{"
+ $this->_code[92] = "111143"; // "|"
+ $this->_code[93] = "111341"; // "}"
+ $this->_code[94] = "131141"; // "~"
+ $this->_code[95] = "114113"; // 95
+ $this->_code[96] = "114311"; // 96
+ $this->_code[97] = "411113"; // 97
+ $this->_code[98] = "411311"; // 98
+ $this->_code[99] = "113141"; // 99
+ $this->_code[100] = "114131"; // 100
+ $this->_code[101] = "311141"; // 101
+ $this->_code[102] = "411131"; // 102
}
/**
@@ -219,121 +323,6 @@ public function draw($text)
}
-
- /**
- * In the Image_Barcode2_code128 constructor, we initialize
- * the $code array, containing the bar and space pattern
- * for the Code128 B character set.
- */
- public function __construct(Image_Barcode2_Writer $writer)
- {
- __parent::construct($writer);
-
- $this->_code[0] = "212222"; // " "
- $this->_code[1] = "222122"; // "!"
- $this->_code[2] = "222221"; // "{QUOTE}"
- $this->_code[3] = "121223"; // "#"
- $this->_code[4] = "121322"; // "$"
- $this->_code[5] = "131222"; // "%"
- $this->_code[6] = "122213"; // "&"
- $this->_code[7] = "122312"; // "'"
- $this->_code[8] = "132212"; // "("
- $this->_code[9] = "221213"; // ")"
- $this->_code[10] = "221312"; // "*"
- $this->_code[11] = "231212"; // "+"
- $this->_code[12] = "112232"; // ","
- $this->_code[13] = "122132"; // "-"
- $this->_code[14] = "122231"; // "."
- $this->_code[15] = "113222"; // "/"
- $this->_code[16] = "123122"; // "0"
- $this->_code[17] = "123221"; // "1"
- $this->_code[18] = "223211"; // "2"
- $this->_code[19] = "221132"; // "3"
- $this->_code[20] = "221231"; // "4"
- $this->_code[21] = "213212"; // "5"
- $this->_code[22] = "223112"; // "6"
- $this->_code[23] = "312131"; // "7"
- $this->_code[24] = "311222"; // "8"
- $this->_code[25] = "321122"; // "9"
- $this->_code[26] = "321221"; // ":"
- $this->_code[27] = "312212"; // ";"
- $this->_code[28] = "322112"; // "<"
- $this->_code[29] = "322211"; // "="
- $this->_code[30] = "212123"; // ">"
- $this->_code[31] = "212321"; // "?"
- $this->_code[32] = "232121"; // "@"
- $this->_code[33] = "111323"; // "A"
- $this->_code[34] = "131123"; // "B"
- $this->_code[35] = "131321"; // "C"
- $this->_code[36] = "112313"; // "D"
- $this->_code[37] = "132113"; // "E"
- $this->_code[38] = "132311"; // "F"
- $this->_code[39] = "211313"; // "G"
- $this->_code[40] = "231113"; // "H"
- $this->_code[41] = "231311"; // "I"
- $this->_code[42] = "112133"; // "J"
- $this->_code[43] = "112331"; // "K"
- $this->_code[44] = "132131"; // "L"
- $this->_code[45] = "113123"; // "M"
- $this->_code[46] = "113321"; // "N"
- $this->_code[47] = "133121"; // "O"
- $this->_code[48] = "313121"; // "P"
- $this->_code[49] = "211331"; // "Q"
- $this->_code[50] = "231131"; // "R"
- $this->_code[51] = "213113"; // "S"
- $this->_code[52] = "213311"; // "T"
- $this->_code[53] = "213131"; // "U"
- $this->_code[54] = "311123"; // "V"
- $this->_code[55] = "311321"; // "W"
- $this->_code[56] = "331121"; // "X"
- $this->_code[57] = "312113"; // "Y"
- $this->_code[58] = "312311"; // "Z"
- $this->_code[59] = "332111"; // "["
- $this->_code[60] = "314111"; // "\"
- $this->_code[61] = "221411"; // "]"
- $this->_code[62] = "431111"; // "^"
- $this->_code[63] = "111224"; // "_"
- $this->_code[64] = "111422"; // "`"
- $this->_code[65] = "121124"; // "a"
- $this->_code[66] = "121421"; // "b"
- $this->_code[67] = "141122"; // "c"
- $this->_code[68] = "141221"; // "d"
- $this->_code[69] = "112214"; // "e"
- $this->_code[70] = "112412"; // "f"
- $this->_code[71] = "122114"; // "g"
- $this->_code[72] = "122411"; // "h"
- $this->_code[73] = "142112"; // "i"
- $this->_code[74] = "142211"; // "j"
- $this->_code[75] = "241211"; // "k"
- $this->_code[76] = "221114"; // "l"
- $this->_code[77] = "413111"; // "m"
- $this->_code[78] = "241112"; // "n"
- $this->_code[79] = "134111"; // "o"
- $this->_code[80] = "111242"; // "p"
- $this->_code[81] = "121142"; // "q"
- $this->_code[82] = "121241"; // "r"
- $this->_code[83] = "114212"; // "s"
- $this->_code[84] = "124112"; // "t"
- $this->_code[85] = "124211"; // "u"
- $this->_code[86] = "411212"; // "v"
- $this->_code[87] = "421112"; // "w"
- $this->_code[88] = "421211"; // "x"
- $this->_code[89] = "212141"; // "y"
- $this->_code[90] = "214121"; // "z"
- $this->_code[91] = "412121"; // "{"
- $this->_code[92] = "111143"; // "|"
- $this->_code[93] = "111341"; // "}"
- $this->_code[94] = "131141"; // "~"
- $this->_code[95] = "114113"; // 95
- $this->_code[96] = "114311"; // 96
- $this->_code[97] = "411113"; // 97
- $this->_code[98] = "411311"; // 98
- $this->_code[99] = "113141"; // 99
- $this->_code[100] = "114131"; // 100
- $this->_code[101] = "311141"; // 101
- $this->_code[102] = "411131"; // 102
- }
-
/**
* Get the Code128 code for a character
*
View
2  Image/Barcode2/ean13.php
@@ -186,7 +186,7 @@ public function draw($text)
$black
);
- $xpos= $this->writer->fontwidth($this->_font) + 1;
+ $xpos = $this->writer->imagefontwidth($this->_font) + 1;
// Draws the left guard pattern (bar-space-bar)
// bar
View
2  Image/Barcode2/int25.php
@@ -42,7 +42,7 @@
* @link http://pear.php.net/package/Image_Barcode2
*/
class Image_Barcode2_int25 extends Image_Barcode2_Common implements Image_Barcode2_Driver, Image_Barcode2_DualWidth
-
+{
/**
* Coding map
* @var array
View
2  Image/Barcode2/upca.php
@@ -49,7 +49,7 @@
* @link http://pear.php.net/package/Image_Barcode2
*/
class Image_Barcode2_upca extends Image_Barcode2_Common implements Image_Barcode2_Driver
-
+{
/**
* Font use to display text
*
Something went wrong with that request. Please try again.